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. Extern

  2. Auto

  3. Register

  4. Volatile

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

Volatile is not a storage class specifier. However, it is a qualifier which tells the compiler that  variables may be changed in ways not explicitly specified by the program.

Multiple choice
  1. size of operator

  2. scope resolution operator

  3. subscript operator

  4. none of the above

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

Scope is an enclosing context where values and expressions are associated. The scope resolution operator helps to identify and specifies the context to which an identifier refers. Hence, this is the correct answer.

Multiple choice
  1. C++ classes

  2. C classes

  3. C++ structures

  4. C structures

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

POD means plain old data and is used to describe C style structure which contains only data members.This term as used  in C++ structures,can contain data members as well as member functions. Hence, this is the incorrect answer.

Multiple choice
  1. Virtual functions

  2. Static functions

  3. Friend functions

  4. Constructors

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

Friend functions are non-member functions which can access all the private and protected members of the class. An example of a friend function is class abc{ private: int f,s; public: friend int sum(abc x);}; Here, sum function can access even private members of class and is defined below -:int sum(abc x){return x.f+x.s;}.

Multiple choice
  1. It must contain atleast one pure virtual function.

  2. Pointers to abstract class can be created.

  3. References to abstract classes can be created.

  4. Objects of abstract classes can be created.

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

It is not possible to create objects of abstract class as it contains pure virtual function which is not defined. This statement is false. Hence, it is the correct answer.

Multiple choice
  1. a program

  2. an object deck

  3. execution

  4. a single-line

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

A loader is a system utility that takes an object program from secondary storage and places it into the main memory. Its primary role is to ensure the program is correctly positioned and linked so that the CPU can begin processing it. Therefore, the ultimate goal of the loading process is the execution of the program.