Q.1 The address of a variable temp of type float is
(A) *temp (B) &temp
(C) float& temp (D) float temp&
Ans: B
Q.2 What is the output of the following code
char symbol[3]={‘a’,‘b’,‘c’};
for (int index=0; index<3; index++)
cout << symbol [index];
(A) a b c (B) “abc”
(C) abc (D) ‘abc’
Ans: C
Q.3 The process of building new classes from existing one is called ______.
(A) Polymorphism (B) Structure
(C) Inheritance (D) Cascading
Ans: C
Q.4 If a class C is derived from class B, which is derived from class A, all through public inheritance, then a class C member function can access
(A) protected and public data only in C and B.
(B) protected and public data only in C.
(C) private data in A and B.
(D) protected data in A and B.
Ans: D
Q.5 If the variable count exceeds 100, a single statement that prints “Too many” is
(A) if (count<100) cout << “Too many”;
(B) if (count>100) cout >> “Too many”;
(C) if (count>100) cout << “Too many”;
(D) None of these.
Ans: C
Q.6 Usually a pure virtual function
(A) has complete function body.
(B) will never be called.
(C) will be called only to delete an object.
(D) is defined only in derived class.
Ans: D
Q.7 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.
Ans: B
Q.8 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.
Ans: A
Q.9 In C++, the range of signed integer type variable is ________
^=raised to
(A) 0 to 2^16 (B) -2^15 to 2^15
(C) -2^7 to 2&7 (D) 0 to 2^8
Ans: B
Q.10 If 2 y,5 x = = then y x ? equals________.
(where ? is a bitwise XOR operator)
(A) 00000111 (B) 10000010
(C) 10100000 (D) 11001000
Ans: A
Q.11 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
Ans: C
Q.12 Mechanism of deriving a class from another derived class is known as____
(A) Polymorphism (B) Single Inheritance
(C) Multilevel Inheritance (D) Message Passing
Ans: C
Q.13 RunTime Polymorphism is achieved by ______
(A) friend function (B) virtual function
(C) operator overloading (D) function overloading
Ans: B
Q.14 A function call mechanism that passes arguments to a function by passing a copy of the values
of the arguments is __________
(A) call by name (B) call by value
(C) call by reference (D) call by value result
Ans: B
Q.15 In C++, dynamic memory allocation is accomplished with the operator ____
(A) new (B) this
(C) malloc( ) (D) delete
Ans: A
C++ MCQ-12
- Details
- Category: C and C++ Programming Language
- Hits: 4028