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?

A

Private

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?

A

A type of

24
Q

Which C++ construct implements ADTs?

A

Class

25
Q

What distinguishes a class constructor from other members?

A

No function return type

26
Q

What is an active data structure?

A

One that contains both data and operations in a single cohesive unit

27
Q

Conceptually, classes have a “barrier” surrounding them. Its referred to as?

A

Abstraction barrier

28
Q

Abstraction barrier prevents what?

A

Private members and methods of classes being accessed by client code, and class members and methods from accessing outside its scope

29
Q

What happens if you try to access class private members and methods from outside the class?

A

Compile time error

30
Q

Observer/accessor and transformer/mutator methods otherwise known as?

A

Getters and setters

31
Q

Observer/accessor methods are declared with which keyword following parameter list?

A

Const

32
Q

Classes should be structured into header files which delineate the class I to its:

A

Implementation and specification

33
Q

Specification of a class?

A

Its public interface

34
Q

Implementation of a class?

A

Its internal workings

35
Q

What type of file is produced by a multi file project before the executable?

A

.obj files

36
Q

The individual data stored by objects, what it is?

A

Attributes

37
Q

Objects communicate in which way?

A

Message passing

38
Q

C way of referring to message passing?

A

Function application (of a public member function)

39
Q

What are responsibilities?

A

The public operations of a class provided for outside use

40
Q

What are the two types of responsibilities?

A

Action and knowledge

41
Q

Encapsulation?

A

The design of a class to privatise its internal state and member functions and provide a formal interface for interaction

42
Q

Formal interface?

A

Class’ documented specification

43
Q

Control abstraction?

A

Combining control statements into a single unit

44
Q

OOP paradigm lends itself to?

A

Modularity, modifiability, reuse

45
Q

Mutability and immutability with regards to objects?

A

Mutable objects can be altered after instantiation, immutable objects cannot

46
Q

Class declaration and implementation

A