comp 2 Flashcards

1
Q

What is abstraction?

A

The process of removing unnecessary detail from a problem leaving only the relevant features.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is abstraction important?

A

saves time
saves storage space
makes the problem simpler for programmers to solve

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What shape is used for start/end in flowcharts?

A

ellipse (horizontal oval)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What shape is used for conditions?

A

diamond

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What shape is used for general processing?

A

rectangle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What shape is used for I/O?

A

parallelogram

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What shape is used for subprograms?

A

rectangle with bars on sides

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the 3 programming constructs?

A

sequence - line by line
selection - conditions
iteration - loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a recursive function?

A

A function that calls itself until a stopping condition has been met.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the benefits and drawbacks of recursion?

A

provides an elegant solution that takes less lines of code

uses more memory space as variable values have to be transferred into a stack every time the function is called again

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the benefits and drawbacks of iteration?

A

less memory space needed as variables are only defined once

can be harder to understand the program and it takes up more lines of code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a variable?

A

An identifier that is used to reference an address in memory. Its value can be changed during program execution.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the difference between local and global variables?

A

Local variables can only be accessed within the scope of the function in which they’re declared whereas global variables can be directly accessed from anywhere in the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the advantages of global variables?

A

simple to implement
can be used for config/user info
uses pass by ref so saves memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the disadvantage of global variables?

A

can cause bugs and problems implementing modules if names are reused

maintainability reduced as purpose of different glob variables may be unclear

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is modular code?

A

Code that can be separated into small, independent, reusable modules that each perform specific tasks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What are the advantages of modular code?

A

organisation
reliability
maintainability

diff people can work on diff modules at same time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a subprogram?

A

A named section of code that performs a clearly defined task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are 2 types of subprogram and what is the difference?

A

function - returns a value
procedure - doesn’t return a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What are 2 ways of passing variables to subprograms?

A

passing by value
passing by reference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is passing by val vs passing by ref?

A

passing by val - copy of the val is passed to the function

passing by ref - location of the val is passed to the function

22
Q

What are the benefits/drawbacks of passing by value?

A

function is isolated from the rest of the program as changes made to the variable won’t impact the rest of the program

simple to implement

takes up more memory space

23
Q

What are the benefits/drawbacks of passing by reference?

A

saves CPU time and memory space

permanently changes the variable value for the whole program

harder to debug and can cause side-effects as the variable’s value isn’t encapsulated within the function

24
Q

What does IDE stand for?

A

integrated development environment

25
Q

What is an IDE?

A

A piece of software that provides tools that facilitate for the development of code/writing programs.

26
Q

What are the tools provided by an IDE?

A

debugging tools
interpreter
autocomplete
colour formatting
AI suggest
versioning

27
Q

What are some debugging tools provided by IDEs?

A

interpreter
trace table
break points
stack content viewer
crash dump

28
Q

What is an interpreter?

A

A translator that translates and runs the code line by line until an error is reached.

29
Q

What is a trace table?

A

A table that allows you to view the values of variables during program execution.

30
Q

What is the stack content viewer?

A

Something that shows you the order/sequence in which functions are called.

31
Q

What are break points?

A

Marked lines of code where program execution stops so the state of variables at that point can be examined.

32
Q

What is the crash dump?

A

The state of all the variables when the program crashes.

33
Q

What is a class?

A

A blueprint used to define objects including their specific attributes and methods.

34
Q

What is inheritance?

A

When a child class takes on the methods/attributes of a parent class but can override them or have its own in addition.

35
Q

What is an instance?

A

An occurrence of a class with specific values for each attribute.

36
Q

What is an object?

A

An entity that represents a single instance of a class with specific attribute values.

37
Q

What is an attribute?

A

A piece of data that is associated with a class.

38
Q

What is a method?

A

An action that an object can perform.

39
Q

What is a property?

A

An attribute that has been accessed or modified through getter/setter methods.

40
Q

What is encapsulation?

A

When a class’ private attributes can only be accessed and modified through public methods.

41
Q

What is the difference between public/private?

A

Public methods/attributes can be accessed from outside the object whereas private methods/attributes can not.

42
Q

What is polymorphism?

A

When objects of different classes are treated as objects of a common superclass.

43
Q

What is the similarity and difference between parent and superclasses?

A

Both have had their methods/attributes inherited by a child/subclass.

Parent classes can be used in the context of multiple inheritance whereas superclasses can not.

44
Q

What is multiple inheritance?

A

When a subclass inherits its methods/attributes from multiple parent classes.

45
Q

What is divide and conquer?

A

Break down a problem into smaller subproblems, solving all the subproblems independently and then combining the solutions to form a solution to the original problem.

46
Q

What is performance modelling?

A

Simulating the behaviour of a computer system before it is used.

47
Q

What is pipelining?

A

Processes are arranged in a series so that the output of one process is the direct input of the next process.

48
Q

What is concurrent processing?

A

When one task can start before a previous task has been completed.

49
Q

What is the benefit of concurrent processing?

A

Maximises CPU efficiency and minimises idle times to improve responsiveness and performance.

50
Q

What are the drawbacks of concurrent processing?

A

not all tasks can benefit from concurrency

non-deterministic - no guarantee which thread will finish executing 1st

deadlock if tasks each keep hold of resources that other tasks need