4.1 Fundamentals of Programming

studied byStudied by 0 people
0.0(0)
Get a hint
Hint

What two things are data types defined by?

1 / 42

43 Terms

1

What two things are data types defined by?

  • The values they can take.

  • The operations that can be performed on them.

New cards
2

Is -44 an integer?

Yes. An integer is a whole number, positive or negative, including zero.

New cards
3

Which data type can only be true or false?

Boolean.

New cards
4

What is a user-defined data type?

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

New cards
5

What is meant by assignment?

Giving a constant or variable a value.

New cards
6

What is meant by iteration?

Repeating an instruction.

New cards
7

What is meant by a subroutine?

A named block of code containing a set of instructions designed to perfom a frequently used operation.

New cards
8

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

Indefinite iteration.

New cards
9

What visible feature of program code signifies nesting?

Identation.

New cards
10

Using integer division, what is 14 DIV 3?

4

New cards
11

Using the modulo operation, what is 30 MOD 4?

2

New cards
12

What is 1 XOR 1?

0

New cards
13

Name two advantages of using constants over hard-coded values.

  • Constants can be given identifier names, making code easier for a human to understand.

  • When updating a value, constants only need updating at one position in code.

New cards
14

What is meant by concatenation?

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

New cards
15

What is a seed value used for?

Generating random numbers.

New cards
16

What name is given to the code which is run to handle an exception?

Catch block.

New cards
17

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

Function.

New cards
18

What are parameters used for?

Passing data between subroutines in programs.

New cards
19

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

Argument.

New cards
20

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

Global.

New cards
21

Name three items stored in a stack frame.

  • Return addresses

  • Parameters

  • Local variables

New cards
22

What is meant by a recursive subroutine?

A subroutine which is defined in terms of itself.

New cards
23

What is meant by a base case?

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

New cards
24

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

Stack overflow.

New cards
25

What scope is a variable that can be accessed from all parts of a program said to have?

Global.

New cards
26

List the four types of basic structure used in the structured approach to program design and construction.

  • Assignment

  • Sequence

  • Selection

  • Iteration

New cards
27

What do rectangles represent in hierarchy charts?

Procedures

New cards
28

How is data stored in procedural programs?

By constants and variables.

New cards
29

What name is given to containers for data and instructions in object-oriented programming?

Objects.

New cards
30

In object-oriented programming, what specifies the properties and methods that objects have?

Classes.

New cards
31
<p><span style="color: red">Which of the following is an example of a  hierarchy chart?</span></p>

Which of the following is an example of a hierarchy chart?

B.

New cards
32

In OOP, what name is given to the process of combining methods and procedures in an object?

Encapsulation.

New cards
33
<p><span style="color: red">Which class definition is correct?</span></p>

Which class definition is correct?

C.

New cards
34

In OOP, what is said to occur when objects are processed differently depending on their class?

Polymorphism.

New cards
35
<p><span style="color: red">Which class definition shows inheritance?</span></p>

Which class definition shows inheritance?

C.

New cards
36

In OOP, what type of method has the same name as a method in an inherited class but different implementation?

An overridden method.

New cards
37

Name the stronger of the two kinds of association.

Composition.

New cards
38

In OOP, what is the purpose of inheritance?

Inheritance allows one class to share the properties and methods of another class.

New cards
39

What type of association exists between a class and a student: aggregation or composition?

Aggregation. If the class is destroyed, the student still exists.

New cards
40

In class diagrams which feature properties and methods, what symbol represents a private property?

A minus sign (-).

New cards
41

Name three object-oriented design principles.

  • Encapsulate what varies.

  • Favour composition over inheritance.

  • Program to interfaces, not implementation.

New cards
42
<p><span style="color: red">What is an inheritance diagram?</span></p>

What is an inheritance diagram?

A.

New cards
43

In class diagrams which type of line represents aggregation?

A line with a hollow diamond cap.

New cards

Explore top notes

note Note
studied byStudied by 28 people
... ago
5.0(1)
note Note
studied byStudied by 10 people
... ago
5.0(1)
note Note
studied byStudied by 10 people
... ago
5.0(1)
note Note
studied byStudied by 3 people
... ago
5.0(1)
note Note
studied byStudied by 13 people
... ago
5.0(1)
note Note
studied byStudied by 8 people
... ago
5.0(1)
note Note
studied byStudied by 31 people
... ago
5.0(2)

Explore top flashcards

flashcards Flashcard (255)
studied byStudied by 13 people
... ago
5.0(1)
flashcards Flashcard (56)
studied byStudied by 6 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 12 people
... ago
5.0(2)
flashcards Flashcard (38)
studied byStudied by 24 people
... ago
5.0(1)
flashcards Flashcard (72)
studied byStudied by 132 people
... ago
5.0(3)
flashcards Flashcard (87)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (96)
studied byStudied by 22 people
... ago
5.0(1)
flashcards Flashcard (485)
studied byStudied by 305 people
... ago
5.0(6)
robot