Chapter 20. Further programming Flashcards

(50 cards)

1
Q

What is a programming paradigm?

A

A set of programming concepts and methodologies used to write and structure code.

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

What is low-level programming?

A

Programming that uses the computer’s basic instruction set, such as assembly or machine code.

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

What is imperative programming?

A

A paradigm where the program’s logic is expressed through statements that change a program’s state step by step.

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

What is object-oriented programming (OOP)?

A

A programming methodology using self-contained objects containing data and methods to model real-world entities.

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

What is declarative programming?

A

A style of programming that expresses the logic of computation without describing its control flow; based on facts and rules.

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

What is a class in OOP?

A

A template that defines the methods and attributes for objects of a certain type.

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

What is encapsulation?

A

The process of bundling data and methods into a single unit, a class.

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

What is an object?

A

An instance of a class that includes data and methods.

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

What are attributes in a class?

A

The data items that define the state of an object.

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

What is a method in OOP?

A

A procedure or function that operates on the attributes of an object.

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

What is data hiding?

A

A technique where attributes are kept private and only accessible through public methods, ensuring integrity of the data.

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

What is inheritance in OOP?

A

The process by which a class (subclass) derives properties and methods from another class (superclass).

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

What is polymorphism?

A

An OOP feature that allows a method to behave differently depending on the object calling it.

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

What is method overloading?

A

Defining multiple methods with the same name but different parameters within a class.

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

What is containment (aggregation)?

A

A relationship where one class contains objects of other classes.

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

What is a constructor?

A

A method used to initialise new objects when an instance of a class is created.

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

What is a destructor?

A

A method automatically invoked when an object is destroyed to free resources.

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

What is a getter method?

A

A method used to retrieve the value of an attribute.

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

What is a setter method?

A

A method used to modify the value of a private attribute.

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

What is a fact in declarative programming?

A

A statement representing a basic piece of information known to be true.

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

What is a rule in declarative programming?

A

A logical relationship that connects facts to derive new information or conclusions.

22
Q

What is exception handling?

A

Responding to and managing unexpected events (exceptions) that disrupt normal program execution.

23
Q

What is a file in programming?

A

A collection of data stored on disk that can be read from or written to by a program.

24
Q

What is the ‘Read’ file access mode?

A

Opens a file for reading data without modifying its content.

25
What is the 'Write' file access mode?
Opens a file for writing, overwriting any existing content.
26
What is the 'Append' file access mode?
Opens a file to add new data at the end without deleting existing content.
27
What does 'Open' mean in file processing?
A command to access a file and make it available for reading or writing in a program.
28
What does 'Close' mean in file processing?
A command to end access to a file, releasing any resources it was using.
29
What is a serial file?
A file where records are stored one after another in no specific order.
30
What is a sequential file?
A file where records are stored in a specific order, usually sorted by a key field.
31
What is a random (direct access) file?
A file where records can be accessed directly using an address or key.
32
Why is exception handling important?
To prevent a program from crashing and allow graceful handling of errors.
33
Give an example of an exception
Trying to divide by zero or open a non-existent file.
34
What is the difference between a function and a procedure?
A function returns a value, while a procedure does not.
35
What are parameters in programming?
Values passed to functions or procedures to customise their operation.
36
What does 'passing by value' mean?
Passing a copy of the variable so the original is not affected.
37
What does 'passing by reference' mean?
Passing the actual variable so changes affect the original.
38
How does object initialisation occur in Python?
Using a constructor method: def __init__(self, ...)
39
How do you define a constructor in VB.NET?
Using Public Sub New(...) to initialise object attributes.
40
How does Java create an object?
Using new keyword: employee myStaff = new employee(...);
41
What is the purpose of the method `setName`?
It sets or updates the value of the 'name' attribute in an object.
42
What is the purpose of the method `getHoursWorked`?
It retrieves the value of the 'hoursWorked' attribute from an object.
43
How does containment relate to real-world modelling?
It shows 'has-a' relationships, e.g., a flight contains passengers and crew.
44
Describe a sample containment diagram structure for a flight.
Flight contains flightID, crew (array of crew), passengers (array of passenger), and related methods.
45
What is the role of the 'teaching' predicate in declarative programming examples?
It identifies languages that are both high-level and use OOP.
46
What does the predicate `language(X
oop)` signify?
47
What does the predicate `translator(Y
lowLevel)` define?
48
What is the use of a destructor in OOP?
To clean up and free memory when an object is no longer needed.
49
What are common file-processing operations?
Open, Read, Write, Append, Close.
50
What is the difference between serial and random file access?
Serial reads records in order, random allows direct access to any record.