Topic One - Programming Flashcards

1
Q

Integer

A

Whole number, positive or negative

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

Real/Float

A

+/- that can have a fractional part

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

Boolean

A

True or False

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

Character

A

Single letter or symbol

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

String

A

Collection of characters

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

Pointer

A

A way of storing memory addresses

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

Record

A

A collection of fields each of which could have a different data type

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

Arrays

A

A finite, indexed set of related elements each of which has the same data type

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

What happens after an exception has been ‘thrown’?

A

Once an exception has been thrown, the computer has to handle the exception to avoid crashing. It does this by pausing execution of the program and saving the current volatile state of the program on the system stack before running a section of code called a catch block. This code will prevent the program from crashing and might inform the user that an error has occurred. Once the exception has been handled, the program uses the system stack to restore its previous state before resuming execution.

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

What is the difference between a function and a procedure?

A

A function must return a value whereas a procedure does not have too.

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

What is a Local variable?

A

A local variable is a variable that can only be accessed from the subroutine within which it is declared.

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

What is a global variable?

A

Global variables can be accessed from any part of a program and exist in memory for the entire duration of the program’s execution.

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

What is the role of stack frames in a subroutine?

A

Stack frames are used by computers to store return addresses, parameters, and local variables for each subroutine call that occurs during the execution of a program. If one subroutine calls another, nesting is said to occur. Each subroutine call will be pushed onto the computer’s call stack in the form of a stack frame before the subroutine’s code begins to execute. When the nested subroutine finishes executing, the stack frame is popped from the call stack and the computer uses the information to return to execution of the previous subroutine.

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

What is a recursive subroutine?

A

A recursive subroutine is one which is defined in terms of itself. This means that somewhere within the recursive subroutine, there is a call to the subroutine itself. Any recursive subroutine must meet have a stopping condition (called a base case) which must be met at some point in the execution of the program. If an algorithm calls itself, but doesn’t have a base case, it will never terminate. This will cause a stack overflow as more and more stack frames are pushed onto the call stack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
A
17
Q
A
18
Q
A
19
Q
A
20
Q
A