MCQOPTIONS
Saved Bookmarks
This section includes 226 Mcqs, each offering curated multiple-choice questions to sharpen your Engineering knowledge and support exam preparation. Choose a topic below to get started.
| 101. |
Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { int x, y; public: void SetValue(int &xx, int &yy) { x = xx++; y = yy; cout<< xx << " " << yy; } }; int main() { int x = 10; int &y = x; IndiaBix objBix; objBix.SetValue(x , y); return 0; } |
| A. | The program will print the output 10 10. |
| B. | The program will print the output 10 11. |
| C. | The program will print the output 11 10. |
| D. | The program will print the output 11 11. |
| E. | It will result in a compile time error. |
| Answer» E. It will result in a compile time error. | |
| 102. |
Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 10, y = 20; int *ptr = &x; int &ref = y; *ptr++; ref++; cout<< x << " " << y; return 0; } |
| A. | The program will print the output 10 20. |
| B. | The program will print the output 10 21. |
| C. | The program will print the output 11 20. |
| D. | The program will print the output 11 21. |
| E. | It will result in a compile time error. |
| Answer» C. The program will print the output 11 20. | |
| 103. |
Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { int x, y; public: IndiaBix(int &xx, int &yy) { x = xx; y = yy; Display(); } void Display() { cout<< x << " " << y; } }; int main() { int x1 = 10; int &p = x1; int y1 = 20; int &q = y1; IndiaBix objBix(p, q); return 0; } |
| A. | It will result in a compile time error. |
| B. | The program will print the output 10 20. |
| C. | The program will print two garbage values. |
| D. | The program will print the address of variable x1 and y1. |
| Answer» C. The program will print two garbage values. | |
| 104. |
Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { int x, y; public: void SetValue(int &a, int &b) { a = 100; x = a; y = b; Display(); } void Display() { cout<< x << " " << y; } }; int main() { int x = 10; IndiaBix objBix; objBix.SetValue(x, x); return 0; } |
| A. | The program will print the output 100 10. |
| B. | The program will print the output 100 100. |
| C. | The program will print the output 100 garbage. |
| D. | The program will print two garbage values. |
| E. | It will result in a compile time error. |
| Answer» C. The program will print the output 100 garbage. | |
| 105. |
Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { int x, y; public: void SetValue(int &xx, int &yy) { x = xx ++; y = yy; Display(); } void Display() { cout<< x << " " << y; } }; int main() { int x = 10; int &y = x; IndiaBix objBix; objBix.SetValue(x , y); return 0; } |
| A. | The program will print the output 10 10. |
| B. | The program will print the output 10 11. |
| C. | The program will print the output 11 11. |
| D. | The program will print the output 11 10. |
| E. | It will result in a compile time error. |
| Answer» C. The program will print the output 11 11. | |
| 106. |
What will be the output of the following program? #include<iostream.h> class BixTest { public: BixTest(int &x, int &y) { x++; y++; } }; int main() { int a = 10, b = 20; BixTest objBT(a, b); cout<< a << " " << b; return 0; } |
| A. | 10 20 |
| B. | 11 21 |
| C. | Garbage Garbage |
| D. | It will result in a compile time error. |
| Answer» C. Garbage Garbage | |
| 107. |
Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 0; int &y = x; y = 5; while(x <= 5) { cout<< y++ << " "; x++; } cout<< x; return 0; } |
| A. | The program will print the output 5 6 7 8 9 10. |
| B. | The program will print the output 5 6 7 8 9 10 7. |
| C. | The program will print the output 5 7. |
| D. | It will result in a compile time error. |
| Answer» D. It will result in a compile time error. | |
| 108. |
Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int m = 2, n = 6; int &x = m; int &y = n; m = x++; x = m++; n = y++; y = n++; cout<< m << " " << n; return 0; } |
| A. | The program will print output 2 6. |
| B. | The program will print output 3 7. |
| C. | The program will print output 4 8. |
| D. | The program will print output 5 9. |
| E. | The program will print output 6 10. |
| Answer» D. The program will print output 5 9. | |
| 109. |
Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int m = 2, n = 6; int &x = m++; int &y = n++; m = x++; x = m++; n = y++; y = n++; cout<< m << " " << n; return 0; } |
| A. | The program will print output 3 7. |
| B. | The program will print output 4 8. |
| C. | The program will print output 5 9. |
| D. | The program will print output 6 10. |
| E. | It will result in a compile time error. |
| Answer» F. | |
| 110. |
Which of the following statement is correct about the program given below? #include<iostream.h> enum xyz { a, b, c }; int main() { int x = a, y = b, z = c; int &p = x, &q = y, &r = z; p = ++x; q = ++y; r = ++c; cout<< p << q << r; return 0; } |
| A. | The program will print the output 1 2 3. |
| B. | The program will print the output 2 3 4. |
| C. | The program will print the output 0 1 2. |
| D. | It will result in a compile time error. |
| Answer» E. | |
| 111. |
Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int arr[] = {1, 2 ,3, 4, 5}; int &zarr = arr; for(int i = 0; i <= 4; i++) { arr[i] += arr[i]; } for(i = 0; i <= 4; i++) cout<< zarr[i]; return 0; } |
| A. | The program will print the output 1 2 3 4 5. |
| B. | The program will print the output 2 4 6 8 10. |
| C. | The program will print the output 1 1 1 1 1. |
| D. | It will result in a compile time error. |
| Answer» E. | |
| 112. |
Which of the following statement is correct about the program given below? #include<iostream.h> struct Bix { short n; }; int main() { Bix b; Bix& rb = b; b.n = 5; cout << b.n << " " << rb.n << " "; rb.n = 8; cout << b.n << " " << rb.n; return 0; } |
| A. | It will result in a compile time error. |
| B. | The program will print the output 5 5 5 8. |
| C. | The program will print the output 5 5 8 8. |
| D. | The program will print the output 5 5 5 5. |
| Answer» D. The program will print the output 5 5 5 5. | |
| 113. |
What will be the output of the following program? #include <iostream.h> enum xyz { a, b, c }; int main() { int x = a, y = b, z = c; int &p = x, &q = y, &r = z; p = z; p = ++q; q = ++p; z = ++q + p++; cout<< p << " " << q << " " << z; return 0; } |
| A. | 2 3 6 |
| B. | 4 4 7 |
| C. | 4 5 8 |
| D. | 3 4 6 |
| Answer» C. 4 5 8 | |
| 114. |
Which of the following statement is correct about the program given below? #include<iostream.h> int BixFunction(int m) { m *= m; return((10)*(m /= m)); } int main() { int c = 9, *d = &c, e; int &z = e; e = BixFunction(c-- % 3 ? ++*d :(*d *= *d)); z = z + e / 10; cout<< c << " " << e; return 0; } |
| A. | It will result in a compile time error. |
| B. | The program will print the output 64 9. |
| C. | The program will print the output 64 10. |
| D. | The program will print the output 64 11. |
| Answer» E. | |
| 115. |
Which of the following statements is correct? Pointer to a reference and reference to a pointer both are valid. When we use reference, we are actually referring to a referent. |
| A. | Only 1 is correct. |
| B. | Only 2 is correct. |
| C. | Both 1 and 2 are correct. |
| D. | Both 1 and 2 are incorrect. |
| Answer» D. Both 1 and 2 are incorrect. | |
| 116. |
A reference is declared using the _____ symbol. |
| A. | <i class="cpp-code">&&</i> |
| B. | <i class="cpp-code">&</i> |
| C. | <i class="cpp-code">||</i> |
| D. | <i class="cpp-code">!</i> |
| Answer» C. <i class="cpp-code">||</i> | |
| 117. |
Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 80; int y& = x; x++; cout << x << " " << --y; return 0; } |
| A. | The program will print the output 80 80. |
| B. | The program will print the output 81 80. |
| C. | The program will print the output 81 81. |
| D. | It will result in a compile time error. |
| Answer» E. | |
| 118. |
Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 80; int &y = x; x++; cout << x << " " << --y; return 0; } |
| A. | The program will print the output 80 80. |
| B. | The program will print the output 81 80. |
| C. | The program will print the output 81 81. |
| D. | It will result in a compile time error. |
| Answer» B. The program will print the output 81 80. | |
| 119. |
Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 10; int &y = x; x++; cout<< x << " " << y++; return 0; } |
| A. | The program will print the output 11 12. |
| B. | The program will print the output 12 11. |
| C. | The program will print the output 12 13. |
| D. | It will result in a compile time error. |
| Answer» C. The program will print the output 12 13. | |
| 120. |
Which of the following statement is correct about the program given below? #include<iostream.h> int main() { int x = 10; int &y = x; x = 25; y = 50; cout<< x << " " << --y; return 0; } |
| A. | The program will print the output 25 49. |
| B. | It will result in a compile time error. |
| C. | The program will print the output 50 50. |
| D. | The program will print the output 49 49. |
| Answer» E. | |
| 121. |
Which of the following statement is correct about the program given below? #include<iostream.h> enum bix { a=1, b, c }; int main() { int x = c; int &y = x; int &z = x; y = b; cout<< z--; return 0; } |
| A. | It will result in a compile time error. |
| B. | The program will print the output 1. |
| C. | The program will print the output 2. |
| D. | The program will print the output 3. |
| Answer» D. The program will print the output 3. | |
| 122. |
When are the Global objects destroyed? |
| A. | When the control comes out of the block in which they are being used. |
| B. | When the program terminates. |
| C. | When the control comes out of the function in which they are being used. |
| D. | As soon as local objects die. |
| Answer» C. When the control comes out of the function in which they are being used. | |
| 123. |
Which constructor function is designed to copy objects of the same class type? |
| A. | Create constructor |
| B. | Object constructor |
| C. | Dynamic constructor |
| D. | Copy constructor |
| Answer» E. | |
| 124. |
Copy constructor must receive its arguments by __________ . |
| A. | either pass-by-value or pass-by-reference |
| B. | only pass-by-value |
| C. | only pass-by-reference |
| D. | only pass by address |
| Answer» D. only pass by address | |
| 125. |
Which of the following statements is correct? A reference is not a constant pointer. A referenced is automatically de-referenced. |
| A. | Only 1 is correct. |
| B. | Only 2 is correct. |
| C. | Both 1 and 2 are correct. |
| D. | Both 1 and 2 are incorrect. |
| Answer» C. Both 1 and 2 are correct. | |
| 126. |
Which of the following statements is correct? An array of references is acceptable. We can also create a reference to a reference. |
| A. | Only 1 is correct. |
| B. | Only 2 is correct. |
| C. | Both 1 and 2 are correct. |
| D. | Both 1 and 2 are incorrect. |
| Answer» E. | |
| 127. |
Which of the following statements is correct? Once the variable and the reference are linked they are tied together. Once the reference of a variable is declared another reference of that variable is not allowed. |
| A. | Only 1 is correct. |
| B. | Only 2 is correct. |
| C. | Both 1 and 2 are correct. |
| D. | Both 1 and 2 are incorrect. |
| Answer» B. Only 2 is correct. | |
| 128. |
Which of the following statements is correct? We can return a global variable by reference. We cannot return a local variable by reference. |
| A. | Only 1 is correct. |
| B. | Only 2 is correct. |
| C. | Both 1 and 2 are correct. |
| D. | Both 1 and 2 are incorrect. |
| Answer» C. Both 1 and 2 are correct. | |
| 129. |
Reference is like a _____. |
| A. | Pointer |
| B. | Structure |
| C. | Macro |
| D. | Enum |
| Answer» B. Structure | |
| 130. |
What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor? |
| A. | Compile-time error. |
| B. | Preprocessing error. |
| C. | Runtime error. |
| D. | Runtime exception. |
| Answer» B. Preprocessing error. | |
| 131. |
Can a class have virtual destructor? |
| A. | Yes |
| B. | No |
| Answer» B. No | |
| 132. |
A constructor that accepts __________ parameters is called the default constructor. |
| A. | one |
| B. | two |
| C. | no |
| D. | three |
| Answer» D. three | |
| 133. |
Destructor has the same name as the constructor and it is preceded by ______ . |
| A. | ! |
| B. | ? |
| C. | ~ |
| D. | $ |
| Answer» D. $ | |
| 134. |
For automatic objects, constructors and destructors are called each time the objects |
| A. | enter and leave scope |
| B. | inherit parent class |
| C. | are constructed |
| D. | are destroyed |
| Answer» B. inherit parent class | |
| 135. |
Functions can be declared to return a reference type. There are reasons to make such a declaration/Which of the following reasons are correct? The information being returned is a large enough object that returning a reference is more efficient than returning a copy. The type of the function must be a R-value. |
| A. | Only 1 is correct. |
| B. | Only 2 is correct. |
| C. | Both 1 and 2 are correct. |
| D. | Both 1 and 2 are incorrect. |
| Answer» D. Both 1 and 2 are incorrect. | |
| 136. |
Which of the following statements is correct? Change a reference changes the referent. We can create an array of references. |
| A. | Only 1 is correct. |
| B. | Only 2 is correct. |
| C. | Both 1 and 2 are correct. |
| D. | Both 1 and 2 are incorrect. |
| Answer» B. Only 2 is correct. | |
| 137. |
Which of the following statement is correct about the references? |
| A. | A reference must always be initialized within functions. |
| B. | A reference must always be initialized outside all functions. |
| C. | A reference must always be initialized. |
| D. | Both A and C. |
| Answer» D. Both A and C. | |
| 138. |
Which of the following statements is correct? Once a reference variable has been defined to refer to a particular variable it can refer to any other variable. A reference is not a constant pointer. |
| A. | Only 1 is correct. |
| B. | Only 2 is correct. |
| C. | Both 1 and 2 are correct. |
| D. | Both 1 and 2 are incorrect. |
| Answer» E. | |
| 139. |
Which of the following type of class allows only one object of it to be created? |
| A. | Virtual class |
| B. | Abstract class |
| C. | Singleton class |
| D. | Friend class |
| Answer» D. Friend class | |
| 140. |
Which of the following is not the member of class? |
| A. | Static function |
| B. | Friend function |
| C. | Const function |
| D. | Virtual function |
| Answer» C. Const function | |
| 141. |
Which of the following is not a type of constructor? |
| A. | Copy constructor |
| B. | Friend constructor |
| C. | Default constructor |
| D. | Parameterized constructor |
| Answer» C. Default constructor | |
| 142. |
Which of the following concepts means determining at runtime what method to invoke? |
| A. | Data hiding |
| B. | Dynamic Typing |
| C. | Dynamic binding |
| D. | Dynamic loading |
| Answer» D. Dynamic loading | |
| 143. |
Which of the following is the correct class of the object cout? |
| A. | <i class="cpp-code">iostream</i> |
| B. | <i class="cpp-code">istream</i> |
| C. | <i class="cpp-code">ostream</i> |
| D. | <i class="cpp-code">ifstream</i> |
| Answer» D. <i class="cpp-code">ifstream</i> | |
| 144. |
Which of the following cannot be used with the keyword virtual? |
| A. | class |
| B. | member functions |
| C. | constructor |
| D. | destructor |
| Answer» D. destructor | |
| 145. |
Which of the following functions are performed by a constructor? |
| A. | Construct a new class |
| B. | Construct a new object |
| C. | Construct a new function |
| D. | Initialize objects |
| Answer» E. | |
| 146. |
Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object. |
| A. | Inheritance |
| B. | Polymorphism |
| C. | Abstraction |
| D. | Encapsulation |
| Answer» C. Abstraction | |
| 147. |
Which of the following concepts means adding new components to a program as it runs? |
| A. | Data hiding |
| B. | Dynamic typing |
| C. | Dynamic binding |
| D. | Dynamic loading |
| Answer» E. | |
| 148. |
Which of the following operator is overloaded for object cout? |
| A. | <i class="cpp-code">>></i> |
| B. | <i class="cpp-code"><<</i> |
| C. | <i class="cpp-code">+</i> |
| D. | <i class="cpp-code">=</i> |
| Answer» C. <i class="cpp-code">+</i> | |
| 149. |
Which of the following is correct about class and structure? |
| A. | class can have member functions while structure cannot. |
| B. | class data members are public by default while that of structure are private. |
| C. | Pointer to structure or classes cannot be declared. |
| D. | class data members are private by default while that of structure are public by default. |
| Answer» E. | |
| 150. |
Which of the following concepts means wrapping up of data and functions together? |
| A. | Abstraction |
| B. | Encapsulation |
| C. | Inheritance |
| D. | Polymorphism |
| Answer» C. Inheritance | |