Programming Flashcards

(39 cards)

1
Q

What two things are data types defined by?

A

The values they can take, and 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. An integer is a whole number- positive or negative- including zero.

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 meant by assignment?

A

Giving a constant or variable a value.

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

What is meant by iteration?

A

Repeating an instruction.

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

What is meant by a subroutine?

A

A named block of code containing 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

In which type of iteration is the number of repetitions required not known before the loop starts?

A

Indefinite iteration

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

Using integer division- what is 14 DIV 3?

A

4

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

Using the modulo operation- what is 30 MOD 4?

A

2

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

What is 1 XOR 1?

A

0

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

Name two advantages of using constants over hard-coded values

A

Constants can be given identifier names making code easier for a human to understand- and when updating a value constants only need updating at one position in code

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

What is meant by concatenation?

A

Joining 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.

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

What is a Catch block

A

The code which is run to handle an exception

17
Q

What name is given to a type of subroutine which always returns a value?

18
Q

What are parameters used for?

A

Passing data between subroutines in programs.

19
Q

What name is given to the actual value passed by a parameter?

20
Q

Where can a global variable be accessed from

A

Any part of the program

21
Q

Name three items stored in a stack frame

A

Return addresses
Parameters
Local variables

22
Q

What is meant by a recursive subroutine?

A

A subroutine which is defined in terms of itself.

23
Q

What is meant by a base case?

A

The terminating situation in recursion that does not use recursion to produce a result.

24
Q

When would stack overflow occur

A

When a recursive subroutine never meets its base case

25
What scope is a variable that can be accessed from all parts of a program said to have?
Global
26
List the four types of basic structure used in the structured approach to program design and construction
Assignment Sequence Selection Iteration
27
What do rectangles represent in hierarchy charts?
Procedures
28
How is data stored in procedural programs?
By constants and variables
29
What are Objects in OOP
The name for the data and instructions
30
In OOP, what do classes do?
Specifies the properties and methods that objects have
31
In OOP, what is encapsulation?
The name given to the process of combining methods and procedures in an object
32
In OOP, when does polymorphism occur
Occurs when objects are processed differently depending on their class
33
In OOP, what is an overridden method
When the method has the same name as a method in an inherited class but a different implementation
34
Name the stronger of the two kinds of association
Composition
35
In OOP- what is the purpose of inheritance?
Inheritance allows one class to share the properties and methods of another class
36
What type of association exists between a class and a student: aggregation or composition?
Aggregation- If the class is destroyed the student still exists
37
In class diagrams which feature properties and methods- what symbol represents a private property?
A minus sign (-)
38
Name two object-oriented design principles
Two from: Encapsulate what varies Favour composition over inheritance Program to interfaces not implementation
39
In class diagrams which type of line represents aggregation?
A line with a white diamond cap