Java Packages - Java test

Java Packages - Java test


1) How many ways are there to access package from another package?

A) 3
B) 2
C) 1
D) 5
View Answer / Hide Answer

ANSWER: A) 3




2) If you import a package, subpackages will not be imported?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




3) The following ways specifies to load the class files in

By setting the classpath in the command prompt
By -classpath switch

A) Temporary
B) Permanent
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Temporary




4) In the following which package is used for analyzing code during run time?

A) java.lang.reflect
B) java.awt
C) java.io
D) java.applet
View Answer / Hide Answer

ANSWER: A) java.lang.reflect




5) Which is not a package class provides methods to get information about the specification and implementation of a package?

A) getName()
B) getImplementationTitle()
C) getImplementationVendor()
D) getImplementationVersion()
E) All of the Above
View Answer / Hide Answer

ANSWER: E) All of the Above




6) Which are containers for classes that are used to keep the class name space compartmentalized?

A) Packages
B) Applet
C) Browser
D) None of the above
View Answer / Hide Answer

ANSWER: A) Packages




7) Package does not provide access protection?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




8) Which of the package is used to enable interaction with garbage collector?

A) java.lang.ref
B) java.lang.reflect
C) java.lang
D) java.awt
View Answer / Hide Answer

ANSWER: A) java.lang.ref




9) A package is a group of similar types of?

A) Interfaces
B) Classes
C) Sub-packages
D) Both A & C
E) All Mentioned above.
View Answer / Hide Answer

ANSWER: E) All Mentioned above.




10) Which package is used for GUI?

A) java.lang
B) java.awt
C) java.lang.ref
D) java.io
View Answer / Hide Answer

ANSWER: B) java.awt




11) Which class members can be accessed from the classes in the same package as well as classes in other Packages that are subclasses of the declaring class?

A) Private
B) Public
C) Protected
D) None of the above
View Answer / Hide Answer

ANSWER: C) Protected




12) In which type of java package that contains wide range of classes and methods to perform different functionalities?

A) User Defined Package
B) Java System Packages
C) User System Packages
D) None of the above
View Answer / Hide Answer

ANSWER: B) Java System Packages




13) Which packages are also termed as Java API Packages?

A) Java System Packages
B) User Defined Package
C) Java Defined Packages
D) None of the above
View Answer / Hide Answer

ANSWER: A) Java System Packages




14) Which can be accessed or inherited without actual copy of code to each program?

A) Browser
B) Applet
C) Package
D) None of the above
View Answer / Hide Answer

ANSWER: C) Package




15) How many reserved keywords currently defined in the Java language?

A) 48
B) 49
C) 50
D) 47
View Answer / Hide Answer

ANSWER: B) 49




16) Which keyword is used to make the classes and interface of another package accessible to the current package?

A) Import
B) Implements
C) Instanceof
D) None of the above
View Answer / Hide Answer

ANSWER: A) Import




17) In which all standard classes of java are included with in a package is ?

A) java.lang
B) java.math
C) java.ref
D) java.util
View Answer / Hide Answer

ANSWER: A) java.lang




18) Which is used to separate the hierarchy of the class while declaring an import statement?

A) Package
B) Applet
C) Browser
D) Both A & B
View Answer / Hide Answer

ANSWER: A) Package




19) Which access specifiers can be used for a class so that it’s members can be accessed by a different class in the different package?

A) Private
B) Public
C) Protected
D) None of the above
View Answer / Hide Answer

ANSWER: B) Public




20) A package can be renamed without renaming the directory in which the classes are stored?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False




21) Which of the following is an advantage of static import?

A) Less coding is required if you have access any static member of a class oftenly
B) If you overuse the static import feature, it makes the program unreadable and unmaintainable
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) Less coding is required if you have access any static member of a class oftenly




22) The import allows the java programmer to access classes of a package without package qualification?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




23) Which provides accessibility to classes and interface?

A) import
B) Static import
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) import




24) In the java file, we must use the documentation comment /**... */ to post information for the?

A) Class
B) Constructor
C) Method
D) Fields
E) All Mentioned above
View Answer / Hide Answer

ANSWER: E) All Mentioned above




25) Packages are used for distributing a collection of reusable classes, usually in a format known as Java Archive (JAR) file?

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




26) Which prefixes are reserved for core Java packages and Java extensions, respectively?

A) "java"
B) "javax"
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B




27) A package is a collection of related Java entities such as ?

A) classes,interfaces,exceptions
B) errors and enums
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B




28) Classes in the same package cannot access each other's package-access members?

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False


Post your comment

    Discussion

  • RE: Java Packages - Java test -Tejas Kiran Rathi (06/18/16)
  • Java currently has 50 reserved keywords as per docs.oracle.com out of which const and goto are not currently used. But ans is 50 reserved Keywords.