C & C++ Programming Multiple Choice Questions - Set 43

1.       In C++, the range of signed integer type variable is ..................
(A) 0 to 216
(B) -215 to 215 − 1
(C) -27 to 27 − 1
(D) 0 to 28
Answer: B
2.       If x = 5, y = 2 then x á´§ y equals ...............
(where á´§ is a bitwise XOR operator)
(A) 00000111
(B) 10000010
(C) 10100000
(D) 11001000
Answer: A
3.       If an array is declared as
int a[4] = {3, 0, 1, 2}, then values assigned to a[0] & a[4] will be ..................
(A) 3, 2
(B) 0, 2
(C) 3, 0
(D) 0, 4
Answer: C
4.       Mechanism of deriving a class from another derived class is known as .............
(A) Polymorphism
(B) Single Inheritance
(C) Multilevel Inheritance
(D) Message Passing
Answer: C
5.       If a base class destructor is not virtual, then
(A) It can not have a function body.
(B) It can not be called.
(C) It can not be called when accessed from pointer.
(D) Destructor in derived class can not be called when accessed through a pointer to the base class.
Answer: D

6.       Maximum number of template arguments in a function template is
(A) one
(B) two
(C) three
(D) many
Answer: D
7.       In access control in a protected derivation, visibility modes will change as follows:
(A) private, public and protected become protected
(B) only public becomes protected.
(C) public and protected become protected.
(D) only private becomes protected.
Answer: C
8.       To perform stream I/O with disk files in C++, you should
(A) open and close files as in procedural languages.
(B) use classes derived from ios.
(C) use C language library functions to read and write data.
(D) include the IOSTREAM.H header file.
Answer: B
9.       Overloading the function operator
(A) requires a class with an overloaded operator.
(B) requires a class with an overloaded [ ] operator.
(C) allows you to create objects that act syntactically like functions.
(D) usually make use of a constructor that takes arguments.
Answer: A
10.    The break statement causes an exit
(A) from the innermost loop only.
(B) only from the innermost switch.
(C) from all loops & switches.
(D) from the innermost loop or switch.
Answer: D


Post a Comment

0 Comments