Programming  Java  Package and Interface

1. Which of these keywords is used to define packages in Java?

pkg Pkg package Package

2. Which of these is a mechanism for naming and visibility control of a class and its content?

Object Packages Interfaces None of the Mentione

3. 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

4. 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

5. Which of the following is correct way of importing an entire package ‘pkg’?

import pkg. Import pkg. import pkg.* Import pkg.*

6. 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

7. Which of the following package stores all the standard java classes?

lang java util java.packages

8. Math class belongs to the package

javmath java.lang java.util none of these

9. What class must be extended by all event classes?

javutil.EventListener java.awt.AWTEvent java.util.EventObject java.awt.event.InputEvent

10. What is the name of the Collection interface used to represent elements in a sequence?

Collection Set List Map


*Click on the QNo to display a Question.

Total Ans



Aptitude Coaching - Free Live Session !!