Fundamentals of Programming Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What two things are data types defined by?

A
  1. The values they take
  2. The operations that can be performed on them
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Is -44 an Integer?

A

Yes.
Integer : Whole number, positive or negative, including 0

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

Which data type can only be true or false?

A

Boolean

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

What is a user-defined data type?

A

A data type derived from existing data types in order to create a customised data structure

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

What is assignment?

A

Giving a constant/variable a value

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

What is iteration?

A

Repeating an instruction

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

What is a subroutine?

A

A named block of code with a set of instructions, designed to perform a frequently used operation

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

Which iteration is the number of repetitions not needed before the loop starts?

A

Condition controlled/Indefinite

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

What visible feature of program code signifies nesting?

A

Indentation

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

14 DIV 3?

A

4

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

30 MOD 4

A

2 (MOD is the remainder)

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

1 XOR 1?

A

0

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

Advantages of constants over hard-coded values

A
  1. Constants can have identifiers - easier for a human to understand
  2. When updating a value, constants only get updated at 1 position
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is concatenation?

A

Join two or more strings together to form a new, longer string

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

What is a seed value used for?

A

Generating random numbers
(The seed value initialises it)

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

What name is given to code which is ran to handle an exception?

A

Catch block

17
Q

What subroutine always returns a value?

A

Function

18
Q

What do we use parameters for?

A

Passing data between subroutines in programs

19
Q

What name is given to the value passed into a parameter?

A

Argument

20
Q

What type of variable can be accessed from any part of a program?

A

Global variable

21
Q

Three items stored in a stack frame

A
  1. Return addresses
  2. Parameters
  3. Local variables
22
Q

What is a recursive subroutine?

A

A subroutine which is defined in terms of itself, it calls itself.

23
Q

What is a ‘base case’?

A

The terminating situation in recursion that doesn’t use recursion to produce a result

24
Q

What error will occur if a recursive subroutine never meets its base case?

A

Stack overflow

25
Q

Break down the meaning of this:
for (int i = 0; i < x; i++)

A

for (initializer; condition; iterator)