Skip to main content

Object Oriented Programming MCQs with Answers

Practice important Object Oriented Programming MCQs with answers and explanations.

Multiple Choice Questions

Q121: In C++, which keyword is used to define a class?
  • A: class
  • B: structure
  • C: object
  • D: type
View Answer
A

Q122: Member functions operate on the data _______ in a class.
  • A: class
  • B: package
  • C: object
  • D: parameter
View Answer
A

Q123: In C++, you can define member functions _______ the class definition or inside it.
  • A: both inside and outside
  • B: only inside
  • C: only outside
  • D: none of the above
View Answer
A

Q124: Which keyword is used to request the compiler to make a function inline?
  • A: inline
  • B: implicit
  • C: explicit
  • D: static
View Answer
A

Q125: The compiler-generated default constructor is known as _______.
  • A: explicit
  • B: constructor
  • C: implicit
  • D: none of the above
View Answer
C

Q126: If a class has a parameterless constructor, it is called a _______ constructor.
  • A: default
  • B: explicit
  • C: implicit
  • D: parameterized
View Answer
A

Q127: A copy constructor is used for _______ an object.
  • A: creating a new object with the state of an existing one
  • B: modifying an existing object
  • C: overloading a function
  • D: none of the above
View Answer
A

Q128: What is the purpose of the 'inline' keyword in C++?
  • A: To make functions faster by avoiding function call overhead
  • B: To increase function visibility
  • C: To decrease function size
  • D: To provide default values for function parameters
View Answer
A

Q129: In which case does the default copy constructor not work properly?
  • A: When the class involves dynamic memory allocation
  • B: When the class has no constructors
  • C: When the class is empty
  • D: When the class uses only static members
View Answer
A

Q130: When creating a `Student` object with the constructor `Student(int aRollNo)`, which data member is initialized?
  • A: rollNo
  • B: name
  • C: GPA
  • D: none of the above
View Answer
A

Test Your Knowledge

Take a timed quiz on Object Oriented Programming

🚀 Start Quiz Now