Online GK Series

This site is dedicated to the aspirants of competitive exams SSC, UPSC, Railways, Postal Assistants, Bank, GATE and NET

Connect with Universities & Study Abroad Experts Instantly Connect Now

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

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

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]


Useful Computer Science EBooks