MCQs on Object Oriented C++ Programming
MCQs on Object Oriented C++ Programming
MCQ related to Object Oriented programming using C++ for general use and also for job preparation of Public Service Commission
MCQ related to Object Oriented programming using C++ for general use and also for job preparation of Public Service Commission
Q No.1 of 10
Which of the follwing comments about inline comments are true?
Option 1
|
A function is declared inline by typing the keyword inline before the return value of the function.
|
Option 2
|
A function is declared inline by typing the keyword inline after the return value of the function
|
Option 3
|
Inline functions are essentially same as implementing a function as macro.
|
Option 4
|
None of these
|
Q No.2 of 10
Which of the following decides if a function that is declared inline is indeed going to be treated inline in the executable code?
Option 1
|
Compiler
|
Option 2
|
linker
|
Option 3
|
Loader
|
Option 4
|
preprocessor
|
Q No.3 of 10
Which of the following type of functions is an ideal candidate for being declared inline?
Option 1
|
A function that is small and is not called frequently
|
Option 2
|
A function that is small and is called frequently.
|
Option 3
|
A function that is not small and is not called frequently
|
Option 4
|
A function that is not small and is called frequently.
|
Q No.4 of 10
One of the disadvantages of pass-by reference is that the called function may inadvertently corrupt the caller’s data. This can be avoided by
Option 1
|
Passing pointers
|
Option 2
|
Declaring the formal parameters consant
|
Option 3
|
Declaring the actual parameters constant
|
Option 4
|
All of the above
|
Q No.5 of 10
At what point of time a variable comes into existence in memory is determined by its
Option 1
|
Scope
|
Option 2
|
Storage class
|
Option 3
|
Data type
|
Option 4
|
All of the above
|
Q No.6 of 10
Which of the following specifiers need not be honored by the compiler?
Option 1
|
Register & inline
|
Option 2
|
Static
|
Option 3
|
Extern
|
Option 4
|
None of these
|
Q No.7 of 10
Which of the following cannot be declared static?
Option 1
|
Class and Object
|
Option 2
|
Functions
|
Option 3
|
Member variables
|
Option 4
|
All of these
|
Q No.8 of 10
The order is which operands are evaluated in an expression is predictable if the operator is
Option 1
|
*
|
Option 2
|
+
|
Option 3
|
%
|
Option 4
|
&&
|
Q No.9 of 10
The following program fragment
int i =10;
void main ( )
{
int i=20;
{
int i=30;
cout << i<< : : i ;
}
}
Option 1
|
Prints 3010 |
Option 2
|
Print 3020 |
Option 3
|
Will result in a run time error |
Option 4
|
None of the above |
Q No.10 of 10
A function abc is defined as
void abc (int x=0 , int y=0)
{
cout << x << y;
}
Which of the following function calls is /are illegal? (Assume h, g are declared as integers)
Option 1
|
abc ( ) ; |
Option 2
|
abc (h); |
Option 3
|
abc (h,h); |
Option 4
|
None of these |