Object Oriented Programming Set 3
On This Page
This set of Object Oriented Programming OOP Multiple Choice Questions & Answers (MCQs) focuses on Object Oriented Programming Set 3
Q1 | Empty parentheses following a function name in a function prototype indicate that the function does not require any parameters to perform its task.
- true
- false
Q2 | C++ programmers concentrate on creating , which contain data members and the member functions that manipulate those data members and provide services to clients.
- structures
- classes
- objects
- function
Q3 | Which of the following is FALSE about references in C++
- a reference must be initialized when declared
- once a reference is created, it cannot be later made to reference another object; it cannot be reset
- references cannot be null
- references cannot refer to constant value
Q4 | What will be the output of following program?#include using namespace std;class Test{public:Test() { cout <<"Hello from Test() "; }} a;int main(){cout <<"Main Started "; return 0;}
- main started
- main started hello from test()
- hello from test() main started
- compiler error: global objects are not allowed
Q5 | Which of the following is true about constructors.They cannot be virtual. They cannot be private.They are automatically called by new operator
- all 1, 2, and 3
- only 1 and 3
- only 1 and 2
- only 2 and 3
Q6 | Which of the following operators are overloaded by default by the compiler?1) Comparison Operator ( == )2) Assignment Operator ( = )
- both 1 and 2
- only 1
- only 2
- none of the two
Q7 | Which of the following is true about inline functions and macros.
- inline functions do type checking for parameters, macros don't
- macros cannot have return statement, inline functions can
- macros are processed by pre-processor and inline functions are processed in later stages of compilation.
- all of the above
Q8 | In C++, const qualifier can be applied toMember functions of a classFunction argumentsTo a class data member which is declared as staticReference variables
- only 1, 2 and 3
- only 1, 2 and 4
- all
- only 1, 3 and 4
Q9 | Which type is best suited to represent the logical values?
- integer
- boolean
- character
- all of the mentioned
Q10 | The following is the C++ style comment
- //
- /*..*/
- –
- none of above
Q11 | Which of the following statements is false?
- every c++ program must have a main().
- in c++, white spaces and carriage returns are ignored by the compiler.
- c++ statements terminate with semicolon.
- main() terminates with semicolon.
Q12 | Functions can returns
- arrays
- references
- objects
- all of above
Q13 | Which of the following control expressions are valid for an if statement?
- an integer expression
- a boolean expression
- either a or b
- neither a nor b
Q14 | What will be the values of x, m and n after execution of the following statements? Int x, m, n;m=10; n=15;x= ++m + n++;
- x=25, m=10, n=15
- x=27, m=10, n=15
- x=26, m=11, n=16
- x=27, m=11, n=16
Q15 | Which of the following approach is adapted by C++?
- top-down
- bottom-up
- right-left
- left-right
Q16 | Which of the following is the correct class of the object cout?
- iostream
- istream
- ostream
- ifstream
Q17 | Which of the following functions are performed by a constructor?
- construct a new class
- construct a new object
- construct a new function
- initialize objects
Q18 | Which of the following ways are legal to access a class data member using this pointer?
- this->x
- this.x
- *this.x
- *this-x
Q19 | Which operator is having right to left associativity in the following?
- array subscripting
- function call
- addition and subtraction
- type cast
Q20 | Which operator is having the highest precedence?
- postfix
- unary
- shift
- equality
Q21 | #include using namespace std; int main(){int a;a = 5 + 3 * 5;cout <
- 35
- 20
- 25
- 30
Q22 | In procedural programming the focus in on …...........
- data
- structure
- function
- pointers
Q23 | In object oriented programming the focus is on ….......
- data
- structure
- function
- pointers
Q24 | Which of the following feature of procedure oriented program is false?
- makes use of bottom up approach
- functions share global data
- the most fundamental unit of program is function
- all of these
Q25 | Which of the following feature of object oriented program is false?
- data and functions can be added easily
- data can be hidden from outside world
- object can communicate with each other
- the focus is on procedures