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. copy constructor

  2. parameterized constructor

  3. dynamic constructor

  4. none of these

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

A constructor with arguments is called as parameterized constructor.

Multiple choice
  1. 5

  2. 4

  3. 3

  4. 2

  5. 1

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

This is correct choice because the constructor of the Font class takes Three parameters:- First:- first parameter is of String type which specifies the name of the Font. Second:- second parameter is of type int which specifies the style of the font like Font.BOLD. Third:- third parameter is of type int which specifies the size of the font. ExampleFont f1 = new Font(“Serif”, Font.BOLD, 32); So, this option is true.