Top 80+ Solved Object Oriented Programming (OOP) MCQ Questions Answer

From 46 to 60 of 94

Q. What will be the output of the following program?

a. compilation error: display() cannot be accessed in application

b. compilation error:test class object cannot be accessed in function demo

c. compilation error: variable x is private in test

d. both a and b

  • c. compilation error: variable x is private in test

Q. Which of the following feature is not supported by C++?

a. exception handling

b. reflection

c. operator overloading

d. namespace

  • b. reflection

Q. The operators that cannot be overloaded is

a. *

b. -

c. ::

d. ()

  • c. ::

Q. Which of the following is FALSE about references in C++

a. a reference must be initialized when declared

b. once a reference is created, it cannot be later made to reference another object; it cannot be reset

c. references cannot be null

d. references cannot refer to constant value

  • d. references cannot refer to constant value

Q. What will be the output of following program?#include <iostream> using namespace std;class Test{public:Test() { cout <<"Hello from Test() "; }} a;int main(){cout <<"Main Started "; return 0;}

a. main started

b. main started hello from test()

c. hello from test() main started

d. compiler error: global objects are not allowed

  • c. hello from test() main started

Q. Which of the following is true about inline functions and macros.

a. inline functions do type checking for parameters, macros don't

b. macros cannot have return statement, inline functions can

c. macros are processed by pre-processor and inline functions are processed in later stages of compilation.

d. all of the above

  • d. all of the above

Q. Which type is best suited to represent the logical values?

a. integer

b. boolean

c. character

d. all of the mentioned

  • b. boolean

Q. The following is the C++ style comment

a. //

b. /*..*/

c. –

d. none of above

  • a. //

Q. Which of the following statements is false?

a. every c++ program must have a main().

b. in c++, white spaces and carriage returns are ignored by the compiler.

c. c++ statements terminate with semicolon.

d. main() terminates with semicolon.

  • d. main() terminates with semicolon.

Q. Functions can returns

a. arrays

b. references

c. objects

d. all of above

  • d. all of above

Q. Which of the following control expressions are valid for an if statement?

a. an integer expression

b. a boolean expression

c. either a or b

d. neither a nor b

  • c. either a or b
Subscribe Now

Get All Updates & News