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 accountancy accounting software - tally concept of entity and relationship designing and creating simple tables, forms, and queries objective in dbms

Every component that is created using access is a subject and several such similar objects constitute a class.

  1. True

  2. False

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

MS access is one of the popularly used Database Management System (DBMS) to create, store and manage database. Every component that is created using access is an object and several such similar objects constitute a class. Access is functionally available with the seven object classes.

Multiple choice
  1. Final

  2. Concrete

  3. Abstract

  4. Polymorphic

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

Abstract classes in Java are incomplete and cannot be instantiated directly using the 'new' keyword.

Multiple choice
  1. Boo f = new Boo(24) { };

  2. Boo f = new Bar() { };

  3. Bar f = new Boo(String s) { };

  4. Boo f = new Boo.Bar(String s) { };

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

An anonymous inner class is created by extending a class or implementing an interface. Option B creates an anonymous subclass of Bar.

Multiple choice
  1. Runnable r = new Runnable() { };

  2. Runnable r = new Runnable(public void run() { });

  3. Runnable r = new Runnable { public void run(){}};

  4. System.out.println(new Runnable() {public void run() { }});

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

Option D is a valid way to instantiate an anonymous inner class that implements the Runnable interface and then pass it to a method.

Multiple choice
  1. Extend exactly one class and implement exactly one interface

  2. Extend exactly one class and implement multiple interfaces

  3. Extend exactly one class or implement exactly one interface

  4. implement multiple interface

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

An anonymous inner class can either extend one class OR implement one interface, but not both simultaneously.

Multiple choice
  1. Classes that wraps functionality of an existing class.

  2. Classes that allow primitive types to be accessed as objects

  3. Both of the above.

  4. None of the above.

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

Wrapper classes (like Integer, Double, Boolean) provide a way to use primitive data types as objects.

Multiple choice
  1. defines different methods of same type.

  2. the ability of an object to take on many forms.

  3. A summary of a Class.

  4. It refers to the ability to make a class abstract in OOP.

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

Abstraction in OOP refers to hiding complex implementation details and showing only the necessary features of an object, often achieved via abstract classes or interfaces.