Computer Knowledge

Object-Oriented Programming

2,686 Questions

Object-oriented programming questions test core computer science concepts like classes, inheritance, polymorphism, and encapsulation. The focus includes Java program structures, method overloading, and memory allocation for objects. This topic is essential for technical sections in various recruitment tests.

Java class definitionsMethod overriding rulesPolymorphism conceptsGeneric type parametersMemory allocation in objects

Object-Oriented Programming Questions

Multiple choice
  1. Interface constant declarations of public, static and final are optional in any combination.

  2. An interface can have abstract method only; no concrete methods allowed.

  3. A class implementing an interface can itself be abstract.

  4. A class can implement any number of interfaces.

  5. All of the above

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

.

Multiple choice
  1. The function must have a different name.

  2. The function must be an inline function.

  3. The function must have the same name with different argument and different return type.

  4. The same function must be inherited by another class.

  5. The function must have no return type nor any arguments.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

This is the condition that must hold to say that a particular function is overloaded in C++.

Multiple choice
  1. void

  2. break

  3. exit

  4. virtual

  5. continue

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This keyword is used in C++ when two or more objects are derived from a common base class and to prevent multiple copies of the base class being present in an object derived from other derived classes.