Easy Tutorial
For Competitive Exams

Java Programming Packages

1552.Which of these keywords is used to define packages in Java?
pkg
Pkg
package
Package
1553.Which of these is a mechanism for naming and visibility control of a class and its content?
Object
Packages
Interfaces
None of the Mentione
Explanation:
Packages are both naming and visibility control mechanism.
We can define a class inside a package which is not accessible by code outside the package.
1554.Which of this access specifies can be used for a class so that its members can be accessed by a different class in the same package?
Public
Protected
No Modifier
All of the mentioned
Explanation:
Either we can use public, protected or we can name the class without any specifier.
1555.Which of these access specifiers can be used for a class so that it’s members can be accessed by a different class in the different package?
Public
Protected
Private
No Modifier
1556.Which of the following is correct way of importing an entire package ‘pkg’?
import pkg.
Import pkg.
import pkg.*
Import pkg.*
1557.Which of the following is incorrect statement about packages?
Package defines a namespace in which classes are stored.
A package can contain other package within it.
Java uses file system directories to store packages.
A package can be renamed without renaming the directory in which the classes are store
1558.Which of the following package stores all the standard java classes?
lang
java
util
java.packages
1559.Math class belongs to the package
javmath
java.lang
java.util
none of these
1560.What class must be extended by all event classes?
javutil.EventListener
java.awt.AWTEvent
java.util.EventObject
java.awt.event.InputEvent
1561.What is the name of the Collection interface used to represent elements in a sequence?
Collection
Set
List
Map
1562.Which of the following statement is false?
Variables declared inside of interface declaration may be changed by implementing class
Interfaces are designed to support dynamic method resolution at run time
When an interface method is implemented it must be declared as public
Variables declaration are implicitly final
1563.Which of the following classes directly implement Set interface?
Vector
HashSet
LinkedList
HashTable
1564.TreeMap class is used to implement which one of the following collection interfaces?
Set
SortedSet
SortedMap
List
1565.Which of the following is the correct syntax for suggesting that the JVM performs garbage collection?
System.free()
System.setGarbageCollection()
Syste.out.gc()
System.gc()
1566.For which purpose packages are used in Java?
Categorizes data
Organizing java classes into namespaces
For faster compilation
None of these
1567.The first statement in java source file
import statement
package statement
main statement
try{} and catch{}
1568.A package is a collection of
classes
interfaces
editing tools
classes and interfaces
1569.Which of these keywords is used to define interfaces in Java?
interface
Interface
intf
Intf
1570.Which of these can be used to fully abstract a class from its implementation?
Objects
Packages
Interfaces
None of the Mentione
1571.Which of these access specifiers can be used for an interface?
Public
Protected
private
All of the mentioned
Share with Friends