Packages and Interfaces - Core Java MCQ Questions and Answers - Exam Quiz

(6) TreeMap class is used to implement which one of the following collection interfaces?
[A] Set
[B] SortedSet
[C] SortedMap
[D] List

Comment

Answer: Option [B]

TreeMap class is used to implement SortedMap.

(7) Which of the following is the correct syntax for suggesting that the JVM performs garbage collection?
[A] System.free()
[B] System.setGarbageCollection()
[C] Syste.out.gc()
[D] System.gc()

Comment

Answer: Option [D]

System.gc() is a program that runs for garbage collection. But it not reliable.

DOWNLOAD CURRENT AFFAIRS PDF FROM APP

Article and Schedule Quiz Start Test!
(8) For which purpose packages are used in Java?
[A] Categorizes data
[B] Organizing java classes into namespaces
[C] For faster compilation
[D] None of these

Comment

Answer: Option [B]

Java packages resolves the name conflicts among different classes.

(9) The first statement in java source file
[A] import statement
[B] package statement
[C] main statement
[D] try{} and catch{}

Comment

Answer: Option [B]
(10) A package is a collection of
[A] classes
[B] interfaces
[C] editing tools
[D] classes and interfaces

Comment

Answer: Option [D]

A package is a collection of classes, methods and interfaces.

Take Mock Tests

Missiles Mock Test Start Test!
SSC MTS Mock Test Start Test
IBPS CLERK MOCK TEST Start Test
SSC MTS 2022 JULY 26 Shift 1 (ENGLISH) Start Test!
SSC GD Previous Year Paper 2021 Nov 17 Shift - I (Hindi) Start Test!
SSC CGL Tier - 1 PYP 2022 April 21 Shift- 1 (ENGLISH) Start Test!
MPSC PAPER I MOCK TEST 1 (ENGLISH) Start Test!
IB Security Assistant Mock test 1 (english) Start Test!
UP POLICE CONSTABLE MOCK TEST 1 Start Test!
DELHI POLICE CONSTABLE MOCK TEST 1 (HINDI) Start Test!

Chapters