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

  2. TripleDES

  3. DES

  4. Cryptographic hashes

  5. ProtectedMemory

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

This .NET cryptographic class defines a wrapper object to access the cryptographic service provider version of the triple data encryption standard algorithm.

Multiple choice
  1. Stream-oriented design

  2. Cryptographic configuration

  3. Cryptographic hashes

  4. Cryptographic signing

  5. Message integrity check

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

The common language runtime uses a stream-oriented design for implementing symmetric algorithms and hash algorithms.

Multiple choice
  1. Maintainability is easier.

  2. Encapslation is easily achieved.

  3. Better accesibility restrictions

  4. Inner class members are hidden from outer class.

  5. Inheritance is easily achieved.

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

Inner class is not inherited from the outer class.This is the disadvantage of inner class. 

Multiple choice
  1. An abstract class can be instantiated and must have a main method.

  2. An abstract class cannot be instantiated but has a main method.

  3. An abstract class cannot be instantiated and does not have a main method.

  4. An abstract class must be instantiated and does not have a main method.

  5. An abstract class also contains abstract methods.

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

An abstract class is one that cannot be instantiated. All other functionality of the class still exists and its fields, methods and constructors are all accessed in the same manner. You just cannot create an instance of the abstract class.

Multiple choice
  1. Constructor cannot be declared as final.

  2. Constructor returns the value.

  3. Constructor is just like a method invoked at the time of object creation.

  4. Constructor cannot be inherited.

  5. Constructor cannot be overloaded.

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

Constructor is just a method and it can be overloaded.

Multiple choice
  1. Abstraction, inheritance, encapsulation, polymorphism

  2. Atomicity, polymorphism, interface

  3. Abstraction, inheritance, isolation

  4. Inheritance, encapsulation, durabilty

  5. Portability, consistency, durability

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

The features of Java are described as follows: Abstraction: Hiding unnecessary details from the user. Inheritance: Maintaining a hierarchy and reusability of code. Encapsulation: Protecting the data of a class by providing access only through methods. Polymorphism: Using same name for performing different functions. For example,function overloading.

Multiple choice
  1. Calling one constructor from other constructor is possible.

  2. The default value of the Boolean type is false.

  3. The garbage collector invokes an object's finalize() method, when it detects that the object has become unreachable.

  4. The dot operator(.) is used to access the instance variables and methods of class objects. It is also used to access classes and sub-packages from a package.

  5. All of the above

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

All of the above statements are true