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. (i) and (ii)

  2. (i) and (iv)

  3. (i), (ii) and (iv)

  4. (i), (iii) and (iv)

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

Abstraction, encapsulation, and polymorphism are core pillars of OOP. Inheritance is also essential, and polymorphism is typically realized through inheritance.

Multiple choice
  1. 9

  2. 6

  3. 5

  4. 8

  5. 7

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

There are five subclasses of OutputStream class are the. These are: 1.) FileOutputStream :- for writing bytes into file. 2.) ObjectOutputStream:- for writing objects and primitive data types to output stream. 3.) ByteArrayOutputStream:- For output stream that writes byte into array. 4.) pipedOutputStream :- for writing into a piped stream. 5.) FilterOutputStream :- for filtering output into an existing stream. So this is the correct answer.

Multiple choice
  1. 9

  2. 7

  3. 8

  4. 6

  5. 5

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

This is the correct answer. there are 7 subclasses of InputStream class.hese are :-1.) FileInputStream :- for reading bytes from a file.2.) ObjectInputStream :- for readin objects and primitive data types from input stream.3.) SequenceInputStream :- for readin from a sequence of streams.4.) ByteArrayInputStream :- for Stream that reads a byte array.5.) pipedInputStream :- for reading from a piped stream.6.) FilterInputStream :- for filtering input from Existing Stream.7.) StringBufferInputStream:- for readin from a string. These are the 7 subclasses. So this is the correct answer.

Multiple choice
  1. 4

  2. 3

  3. 2

  4. 1

  5. None of these

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

This is the correct answer. Byte stream can be defined by using two class hierarchies. These two classes are : 1.) InputStream 2.) OutputStream. So this is the correct answer.

Multiple choice
  1. 9

  2. 8

  3. 7

  4. 6

  5. 5

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

There are 6 subclasses of reader Class in Java. These are: 1.) BufferedReader :- for buffering other readers. 2.) ChararrayReader :- For reading from char array. 3.) FilterReader :- For readin filter streams. 4.) InputStreamReader :- For reading a character stream. 5.) PipedReader :- for reading from pipe. 6.) StringReader :- for reading from a string. So this is the correct answer.

Multiple choice
  1. 7

  2. 6

  3. 8

  4. 9

  5. 5

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

There are 7 subclasses of Writer class in Java. These are: 1.) OutputStreamWrite :- for writing a character stream. 2.) BufferedWriter:- for buffering other writers. 3.) PrintWriter :- for writing formatted data. 4.) PipedWriter:- for writing to a pipe. 5.) CharArrayWriter:- for writing to a char array. 6.) StringWriter:- for writing to a string. 7.) FilterWriter:- for writing filtered streams  So this is the correct answer.