Packages and Interfaces - Objective Type Questions with Answers on Core Java

Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Questions
1 Math class belongs to the package
A java.math
B java.lang
C java.util
D none of these

Answer: Option [B]

java.lang package contain math class. This class contain basic methods to perform mathematical operations.

2 What class must be extended by all event classes?
A java.util.EventListener
B java.awt.AWTEvent
C java.util.EventObject
D java.awt.event.InputEvent

Answer: Option [C]

java.awt, java.awt.event and java.beans uses the class java.util.EventObject

Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP
3 What is the name of the Collection interface used to represent elements in a sequence?
A Collection
B Set
C List
D Map

Answer: Option [C]

The List is a collection interface which permits duplicates and represent elements in a particular order.

4 Which of the following statement is false?
A Variables declared inside of interface declaration may be changed by implementing class
B Interfaces are designed to support dynamic method resolution at run time
C When an interface method is implemented it must be declared as public
D Variables declaration are implicitly final

Answer: Option [A]

Java interface variables are static and final. They cannot be changed.

5 Which of the following classes directly implement Set interface?
A Vector
B HashSet
C LinkedList
D HashTable

Answer: Option [B]

Random GK Questions

Chapters

Assam Direct Recruitment Test Series

Computer Science Topics