4.1 Fundamentals of Programming

0.0(0)
studied byStudied by 2 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/42

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

43 Terms

1
New cards

What two things are data types defined by?

  • The values they can take.

  • The operations that can be performed on them.

2
New cards

Is -44 an integer?

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

3
New cards

Which data type can only be true or false?

Boolean.

4
New cards

What is a user-defined data type?

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

5
New cards

What is meant by assignment?

Giving a constant or variable a value.

6
New cards

What is meant by iteration?

Repeating an instruction.

7
New cards

What is meant by a subroutine?

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

8
New cards

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

Indefinite iteration.

9
New cards

What visible feature of program code signifies nesting?

Identation.

10
New cards

Using integer division, what is 14 DIV 3?

4

11
New cards

Using the modulo operation, what is 30 MOD 4?

2

12
New cards

What is 1 XOR 1?

0

13
New cards

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.

14
New cards

What is meant by concatenation?

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

15
New cards

What is a seed value used for?

Generating random numbers.

16
New cards

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

Catch block.

17
New cards

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

Function.

18
New cards

What are parameters used for?

Passing data between subroutines in programs.

19
New cards

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

Argument.

20
New cards

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

Global.

21
New cards

Name three items stored in a stack frame.

  • Return addresses

  • Parameters

  • Local variables

22
New cards

What is meant by a recursive subroutine?

A subroutine which is defined in terms of itself.

23
New cards

What is meant by a base case?

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

24
New cards

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

Stack overflow.

25
New cards

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

Global.

26
New cards

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

  • Assignment

  • Sequence

  • Selection

  • Iteration

27
New cards

What do rectangles represent in hierarchy charts?

Procedures

28
New cards

How is data stored in procedural programs?

By constants and variables.

29
New cards

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

Objects.

30
New cards

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

Classes.

31
New cards
<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.

32
New cards

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

Encapsulation.

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

Which class definition is correct?

C.

34
New cards

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

Polymorphism.

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

Which class definition shows inheritance?

C.

36
New cards

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

An overridden method.

37
New cards

Name the stronger of the two kinds of association.

Composition.

38
New cards

In OOP, what is the purpose of inheritance?

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

39
New cards

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

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

40
New cards

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

A minus sign (-).

41
New cards

Name three object-oriented design principles.

  • Encapsulate what varies.

  • Favour composition over inheritance.

  • Program to interfaces, not implementation.

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

What is an inheritance diagram?

A.

43
New cards

In class diagrams which type of line represents aggregation?

A line with a hollow diamond cap.