0% found this document useful (0 votes)
42 views

Object Oriented Programming Oop Set 3

The document contains 75 multiple choice questions about object oriented programming concepts in C++. The questions cover topics such as classes, objects, constructors, inheritance, polymorphism, operator overloading, function overloading, encapsulation etc. The answers to each question are also provided.

Uploaded by

Alehegn Zurbet
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Object Oriented Programming Oop Set 3

The document contains 75 multiple choice questions about object oriented programming concepts in C++. The questions cover topics such as classes, objects, constructors, inheritance, polymorphism, operator overloading, function overloading, encapsulation etc. The answers to each question are also provided.

Uploaded by

Alehegn Zurbet
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Object Oriented Programming (OOP) MCQs

[set-3]

51. Empty parentheses following a function name in a function prototype indicate


that the function does not require any parameters to perform its task.
A. true
B. false
Answer: A

52. C++ programmers concentrate on creating , which contain data members and
the member functions that manipulate those data members and provide services to
clients.
o m
A. structures
. c
B. classes
te
C. objects
a
D. function
Answer: B
q M
53. Which of the following isM
c
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
Answer: D

54. 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
Answer: C

55. Which of the following is true about constructors.


?They cannot be virtual.
? They cannot be private.
?They are automatically called by new operator
A. all 1, 2, and 3
B. only 1 and 3
C. only 1 and 2
D. only 2 and 3
Answer: B

56. 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
Answer: C

57. 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
Answer: D

58. In C++, const qualifier can be applied to


?Member functions of a class

View all MCQ's at McqMate.com


?Function arguments
?To a class data member which is declared as static
?Reference variables
A. only 1, 2 and 3
B. only 1, 2 and 4
C. all
D. only 1, 3 and 4
Answer: C

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


A. integer
B. boolean
C. character
D. all of the mentioned
Answer: B

60. The following is the C++ style comment


A. //
B. /*..*/
C. –
D. none of above
Answer: A

61. 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.
Answer: D

62. Functions can returns


A. arrays
B. references
C. objects
D. all of above
Answer: D

View all MCQ's at McqMate.com


63. 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
Answer: C

64. 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++;
A. x=25, m=10, n=15
B. x=27, m=10, n=15
C. x=26, m=11, n=16
D. x=27, m=11, n=16
Answer: C

65. Which of the following approach is adapted by C++?


A. top-down
B. bottom-up
C. right-left
D. left-right
Answer: B

66. Which of the following is the correct class of the object cout?
A. iostream
B. istream
C. ostream
D. ifstream
Answer: C

67. 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: D

View all MCQ's at McqMate.com


68. Which of the following ways are legal to access a class data member using this
pointer?
A. this->x
B. this.x
C. *this.x
D. *this-x
Answer: A

69. Which operator is having right to left associativity in the following?


A. array subscripting
B. function call
C. addition and subtraction
D. type cast
Answer: D

70. Which operator is having the highest precedence?


A. postfix
B. unary
C. shift
D. equality
Answer: A

71. #include <iostream>


using namespace std;
int main()
{
int a;
a = 5 + 3 * 5;
cout <<a; return 0;
}
A. 35
B. 20
C. 25
D. 30
Answer: B

72. In procedural programming the focus in on …...........

View all MCQ's at McqMate.com


A. data
B. structure
C. function
D. pointers
Answer: C

73. In object oriented programming the focus is on ….......


A. data
B. structure
C. function
D. pointers
Answer: A

74. Which of the following feature of procedure oriented program is false?


A. makes use of bottom up approach
B. functions share global data
C. the most fundamental unit of program is function
D. all of these
Answer: A

75. Which of the following feature of object oriented program is false?


A. data and functions can be added easily
B. data can be hidden from outside world
C. object can communicate with each other
D. the focus is on procedures
Answer: D

View all MCQ's at McqMate.com

You might also like