Exam Review Flashcards

1
Q

Principles and characteristics of imperative language?

A

Statements are executed in a step-wise, sequence manner.
Order of execution is crucial
Programmer must declare variables
Memory management is responsibility of a programmer

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

Principles and characteristics of oo language

A

Encapsulation: functions that operate on data of an objects are tied together in data structures
Polymorphism
Inheritance
Data is hidden

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

Principles and characteristics of functional language

A

Simple and concise syntax and semantics
Repetition is expressed as recursion
Lazy evaluation expressions are evaluated only when needed

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

What makes up a class?

A

Data(Private, protected, public) + functions that work this data and provide controlled access to outside world

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

Compile time polymorphism?

A

Binding at compile to a particular function

Compiler needs sufficient information to resolve which function to call

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

What is run-time polymorphism?

A

Inheritance, virtual functions and pointers.

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

private vs public vs protected

A
Private: only member functions of that class can access the variables
Protected: same as private except it gives access to derived classes
Public: accessible to the world
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

When are constructor and destructor function invoked?

A

Constructor - to create an object

Destructor - when the object falls out of scope or whenever delete operator is called

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

Differences when inheriting via private and public access specifiers.

A

Using private access specifier for inheritance -> makes everything private in the derived class

Using public access specifier for inheritance -> makes protected data members protected in the derived class + everything becomes public available

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

order of invocation of constructors and destructors

A

Constructors - parent then children

Destructors - children first then up the inheritance to the most parent class

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

What is a pure virtual function?

A
A virtual function has no definition in the base class. The derived classes must provide a definition for the function.
This class becomes abstract class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly