QUIZ 1 Flashcards

1
Q

Namespace

A

Region that provides scope for identifiers declared inside .

Syntax:
namespace name{
Body
}

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

Nested Namespace declaration

A

Namespace f{
Namespace p{
Namespace d{
//……
}
}
}

Or Namespace f :: s :: d;

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

InLine Namespaces

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

Dynamic Memory Allocation

A

Delete:
For arrays- delete [ ]
For non-arrays - delete

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

Member Selection Operator

A

‘ . ‘

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

Data Encapsulation

A

Interface and Implementation

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

int getCount () const {
//….
}

A

Const cannot change the value of an object. I.e it cannot change data attributes

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

Passed by reference vs Passed by Value

A

Passed by Reference: No copy of the original variable is made. Any change in referenced variable will affect original variable

Passed by value: A copy of original variable is made. Any change in parametered variable will not affect original variable.

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

Copy vs modify

A

Copy- propagatea source object value without modifying it
Move- propagates source object value and also is permitted to modify it

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

Constructor

A

Member function that is called automatically when object is created to initialize its values
-Cannot be called directly
-Has no return type
-Can be overloaded

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

Default constructors

A

-Have no parameters and can be called without arguments (cuz it doesn’t have parameters)

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

In Constructors declaration order matters

A

If a constructor has data attributes {
int t;
int v;
void R {};

in int main(){
Constructor object ( );
t, v and then R will be called bc no specification

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

Constructor Overloading

A

Same constructor names, different data attributes

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

Defaulted Default constructor

A

Constructor not explicitly declared? The compiler will assume a defaulted default constructor. It won’t be there but it will be called. Almost like a ghost constructor.

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

Literals

A

Boolean - true, false
Pointer -nullptr

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

Declaration vs Definition

A

Declaration- introduces indentifier
Definition- introduces identifier and also discloses full information about it e.g memory allocation

17
Q

Declaration vs Definition

A

Declaration- introduces indentifier
Definition- introduces identifier and also discloses full information about it e.g memory allocation

18
Q

Enumerators

A

User-defined data type
E.g., enum