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. A class is a user defined data-type.

  2. A class provides mechanism to hold data and function at one place.

  3. It incorporates security in programming.

  4. The member of a class can be accessed by any function.

  5. A class is a logical concept. In real world, objects exist physically.

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

All the above four, except this option, are correct about a class.

Multiple choice
  1. a1 is the data member of class A.

  2. a is the data member of class A.

  3. Display is the data member in class A.

  4. Both a and d together are data members in class A.

  5. None of these

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

In OOPS, the variables which we use in a class are known as data members.

Multiple choice
  1. class B, class C:public A

  2. class B:public A class C:public A

  3. class B:public C class C:public A

  4. Multiple inheritance is not supported in C++.

  5. class A:public B class B:public A

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

This is the correct syntax. 

Multiple choice
  1. carries out, the details of an object for

  2. hides, the details of an object from

  3. reveals, the details of an object to

  4. extends, the details of an object beyond

  5. None of these

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

In object-oriented programming, encapsulation means an object hides its internal implementation details from outside code. The programmer only interacts with the object through its public interface (methods), not directly with its internal data or logic.

Multiple choice
  1. CngPropertyCollection

  2. CngKeyBlobFormat

  3. CngUIPolicy

  4. CngKey

  5. ProtectedMemory

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

This encryption-decryption class of .Net technology encapsulates optional configuration parameters for the user interface that CNG displays when you access a protected key.

Multiple choice
  1. AsymmetricKeyExchangeDeformatter

  2. AsymmetricSignatureDeformatter

  3. AsymmetricSignatureFormatter

  4. DSASignatureFormatter

  5. ProtectedMemory

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

This encryption-decryption class represents the abstract base class from which all implementations of asymmetric signature deformatters derive.