Top 80+ Solved Object Oriented Programming (OOP) MCQ Questions Answer
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
Q. Which of the following feature is not supported by C++?
a. exception handling
b. reflection
c. operator overloading
d. namespace
Q. C++ programmers concentrate on creating , which contain data members and the member functions that manipulate those data members and provide services to clients.
a. structures
b. classes
c. objects
d. function
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
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
Q. Which of the following operators are overloaded by default by the compiler?1) Comparison Operator ( == )2) Assignment Operator ( = )
a. both 1 and 2
b. only 1
c. only 2
d. none of the two
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
Q. Which type is best suited to represent the logical values?
a. integer
b. boolean
c. character
d. all of the mentioned
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.
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