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

  2. AsymmetricSignatureFormatter

  3. DSASignatureFormatter

  4. AsymmetricKeyExchangeFormatter

  5. RandomNumberGenerator

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

This .NET cryptographic class represents the abstract the base class from which all implementations of asymmetric signature formatters derive.

Multiple choice
  1. Yes

  2. No

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

Constructors are NOT inherited in Java - each class must define its own constructors. A child class can CALL the parent constructor using super(), but it does not inherit it. The child class must have its own constructor, even if it only calls super().

Multiple choice
  1. employee.super();

  2. super();

  3. manager.super();

  4. no method will require

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

To invoke a parent class constructor from a child class constructor, use super() as the first statement. Option A (employee.super()) and C (manager.super()) are invalid syntax. The super() keyword alone calls the parent constructor - it's a language keyword, not a method on any object.

Multiple choice
  1. final

  2. static

  3. both (1) and (2)

  4. none of the above

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

Static variables are created when the class is loaded and persist as long as the class remains loaded. They're shared across all instances. Final variables are constants but can be instance or static. Only static has the class-lifetime behavior described in the question.