1.
The
output of the following code is
a
= 5;
a
<< 1;
printf(“%d”,
a);
(A)
5
(B)
6
(C)
2
(D)
3
Answer: A
2. main
( ) is an example of
(A) library function
(B) user defined function
(C) header
(D) statement
Answer: A
Explanation:
main() is a special function used by C system
to tell the computer where the program starts.
3.
Which
of the statements is true in a protected derivation of a derived class from a
base class?
(A)
Private members of the base class become protected members of the derived class
(B)
Protected members of the base class become public members of the derived class
(C)
Public members of the base class become protected members of the derived class
(D)
Protected derivation does not affect private and protected members of the
derived
class.
Answer: C
4.
A
library function exit() causes an exit from
(A)
the loop in which it occurs
(B)
the block in which it occurs
(C)
the function in which it occurs
(D)
the program in which it occurs
Answer: D
5.
RunTime
polymorphism is achieved by .................
(A)
friend function
(B)
virtual function
(C)
operator overloading
(D)
function overloading
Answer: B
6.
Declaration
of a pointer reserves memory space
(A)
for the object.
(B)
for the pointer.
(C)
both for the object and the pointer.
(D)
none of these.
Answer: B
7.
An
array element is accessed using
(A)
a FIFO approach
(B)
an index number
(C)
the operator
(D)
a member name
Answer: B
8.
If
there is a pointer p to object of a base class and it contains the address of
an object of a derived class and both classes contain a virtual member function
abc(), then the statement p->abc(); will cause the version of abc() in the .................
class to be executed.
(A)
Base Class
(B)
Derived class
(C)
Produces compile time error
(D)
produces runtime error
Answer: B
9.
A
pure virtual function is a virtual function that
(A)
has no body
(B)
returns nothing
(C)
is used in base class
(D)
both (A) and (C)
Answer: D
10.
A
static function
(A)
should be called when an object is destroyed.
(B)
is closely connected with and individual object of a class.
(C)
can be called using the class name and function name.
(D)
is used when a dummy object must be created.
Answer: C
0 Comments