OOP1 Classes Flashcards

1
Q

Data representation

A

The concrete existing data types used to create an abstract data type

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

Abstract data type

A

A user defined data type that has a properties of domain (data), and operations, also known as a class, which is independent of any particular implementation

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

Constructor

A

An operation/method that instantiates a new variable/object of the class type

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

Destructor

A

A method that destroys and deallocates the memory for an class instance variable

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

Transformer/mutator

A

A method/operarion that changes the value of an instance of a class , or an object

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

The state

A

The current state of an object / class instance

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

Observer / accessor

A

A method/operation for accessing and observing the state or part of the state of a class instance/object

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

Iterator method

A

A method that successively returns each item in a specific list of a class instance

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

What does the specification of an ADT describe?

A

It specifies the data values and operations in an abstract way that can be given as documentation to both user and programmer

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

What are the two things a programmer must do to implement an ADT?

A
  1. Choose a concrete data representation using existing data types
  2. Implement each of the allowable operations in terms of program instructions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Class

A

A data type that is used to represent an abstract data type

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

Why are classes useful?

A

An entity’s data and operations may not well be split apart, sometimes they act better as a single cohesive unit

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

How are classes defined?

A

class keyword, {} definition block, containing declaration of data members and operations, with access modifiers, terminated by ;

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

What is an access modifier?

A

A keyword used when declaring data types and methods for a class that specifies how they might be externally accessed

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

What does private access modifier do?

A

Prevents implementations external to the class from accessing it

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

When are constructors invoked?

A

They are invoked at instantiation

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

What is a default constructor?

A

A parameterless constructor that is invoked implicitly as a default unless otherwise specified

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

What is a class client?

A

Any implementation that creates and manipulates instances of a class

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

What is the public interface?

A

The data and methods declared as public before private in the class definition

20
Q

What does public keyword mean?

A

Data and methods of the class can be accessed externally to the class

21
Q

Are class members public or private by default?

22
Q

In terms of classes, how can structs be described?

A

Structs are classes that whereby all data members are public by default

23
Q

If an object is a variable, what is a class?

24
Q

Which C++ construct implements ADTs?

25
What distinguishes a class constructor from other members?
No function return type
26
What is an active data structure?
One that contains both data and operations in a single cohesive unit
27
Conceptually, classes have a “barrier” surrounding them. Its referred to as?
Abstraction barrier
28
Abstraction barrier prevents what?
Private members and methods of classes being accessed by client code, and class members and methods from accessing outside its scope
29
What happens if you try to access class private members and methods from outside the class?
Compile time error
30
Observer/accessor and transformer/mutator methods otherwise known as?
Getters and setters
31
Observer/accessor methods are declared with which keyword following parameter list?
Const
32
Classes should be structured into header files which delineate the class I to its:
Implementation and specification
33
Specification of a class?
Its public interface
34
Implementation of a class?
Its internal workings
35
What type of file is produced by a multi file project before the executable?
.obj files
36
The individual data stored by objects, what it is?
Attributes
37
Objects communicate in which way?
Message passing
38
C way of referring to message passing?
Function application (of a public member function)
39
What are responsibilities?
The public operations of a class provided for outside use
40
What are the two types of responsibilities?
Action and knowledge
41
Encapsulation?
The design of a class to privatise its internal state and member functions and provide a formal interface for interaction
42
Formal interface?
Class’ documented specification
43
Control abstraction?
Combining control statements into a single unit
44
OOP paradigm lends itself to?
Modularity, modifiability, reuse
45
Mutability and immutability with regards to objects?
Mutable objects can be altered after instantiation, immutable objects cannot
46
Class declaration and implementation