Which of the following functions below can be used Allocate space for array in memory? | CPP MCQs

A.     calloc()
B.     malloc()
C.     Realloc()
D.     both a and b

Ans: A

Under which of the following circumstances, synchronization takes place? | CPP MCQs

A.     When the file is closed
B.     When the buffer is empty
C.     Explicitly, with manipulators
D.     both a and c

Ans: D


Which of the following is not a valid conditional inclusions in preprocessor directives. | CPP MCQs

A.     #ifdef
B.     #ifundef
C.     #endif
D.     #elif

Ans: B


Which of the following is not a standard exception built in C++. | CPP MCQs

A.     std::bad_creat
B.     std::bad_alloc
C.     std::bad_cast
D.     std::bad_typeid

Ans: A


If a member needs to have unique value for all the objects of that same class, declare the member as | CPP MCQs

A.     Global variable outside class
B.     Local variable inside constructor
C.     Static variable inside class
D.     Dynamic variable inside class

Ans: B

class derived: public base1, public base2 { } is an example of | CPP MCQs

A.     Polymorphic inheritance
B.     Multilevel inheritance
C.     Hierarchical inheritance
D.     Multiple inheritance

Ans: D


Write the output of below code the following: | CPP MCQs

class Example
{
public: int a,b,c;
Example(){a=b=c=1;} //Constructor 1
Example(int a){a = a; b = c = 1;} //Constructor 2
Example(int a,int b){a = a; b = b; c = 1;} //Constructor 3
Example(int a,int b,int c){ a = a; b = b; c = c;} //Constructor 4
}
In the above example of constructor overloading, the following statement will call which constructor
Example obj = new Example (1,2,3.3);
A.     Constructor 2
B.     Constructor 4
C.     Constrcutor 1
D.     Type mismatch error

Ans: B

Blogger news