Questions and Already Solved
Solutions 2025/2026 Updated.
File class is under package?
Select one:
a. java.io
b. There is no such kind of class
c. java.util
d. java.lang - Answer a
The process of writing objects to a byte stream called ___________
Select one:
a. Abstraction
b. Serialization
c. IO handling
d. Deserialization - Answer b
InputStream class is an ________
Select one:
a. abstract class
b. interface
c. class
d. base class - Answer a
In which stream, a data unit is a physical byte.
Select one:
a. Character stream
b. Object stream
c. Binary low-level stream
d. Binary high-level stream - Answer c
The constructor FileOutputStream(String filename, boolean flag) creates an OutputStream that
can be used to write bytes to a file
,Select one:
a. FALSE
b. TRUE - Answer b
Which of the following stream is used for Object Serialization?
Select one:
a. ObjectOutputStream
b. ObjectReader.
c. DataInputStream
d. DataOutputStream
e. ObjectWriter - Answer a
________ class reads bytes from a file
Select one:
a. FileInput
b. FileOutputStream
c. FileInputStream
d. InputStream - Answer c
The classes Reader and Writer are derived from the class ____.
Select one:
a. Object
b. Inputs
c. Outputs
d. Streams - Answer a
A method having _____ access specification can be viewed from any package or any class
Select one:
a. private
b. public
c. protected
d. default
e. package - Answer b
, How many interfaces can a class implement?
Select one:
a. 1
b. 2
c. There is no limit to the number of interfaces that can be implemented by a single class.
d. 0 - Answer c
In object-oriented programming, the process by which one object acquires the properties of
another object is called
Select one:
a. Encapsulation
b. Inheritance
c. Overloading
d. Polymorphism
e. Overriding - Answer b
To prevent any method from overriding, we declare the method as,
Select one:
a. static
b. const
c. final
d. none of the above.
e. abstract - Answer c
If a class implements an interface, it must ____.
Select one:
a. rename all the methods in the interface
b. provide definitions for each of the methods of the interface
c. override all constants from the interface
d. override all variables from the interface - Answer b
Is the following inteface valid?
public interface TestInterface {