Que 1.) Which of the following is correct way of importing an entire package ‘pkg’?
A) import pkg.
B) Import pkg.
C) import pkg.*
D) Important pkg.*
Que 2.) Which of the following is incorrect statement about packages?
A) Package defines a namespace in which class are stored.
B) A package can contain other package within it.
C) Java uses file system directories to store packages.
D) A package can be renamed without renaming the directory in which the classes are stored.
Que 3.) Which of the following package stores all the standared java classes ?
A) lang
B) java
C) util
D) java.packages
Que 4.) Which of these access specifiers can be used for a class so that it’s member can be accessed by a different class in different package ?
A) Public
B) Protected
C) Private
D) No Modifier
Que 5.) Which of these package is used for analyzing code during run-time?
A) java.applet
B) java.awt
C) java.io
D) java.lang.reflect Reflection is the ability of a software to analyze itself.This is provided by java.lang.reflect package.
Que 6.) You want subclasses in any package to have access to members of a superclass.Which is the most restrictive access that accomplishes this objective?
A) private
B) transient
C) public
D) protected
Que.7) Outcome of test() will be :
void test() { int[] a={2,1}; short i = 0; System.out.println(a[i]); }
A) 2
B) Runtime error
C) Compile error
D) 1
Que.8) Which of the following inheritance type is not allowed in java ?
A) Multilevel
B) Multiple
C) Hierarchical
D) All are allowed
Que.9) What is true regarding method overriding ?
A) Also called Dynamic Polymorphism
B) if method is inherited only then it can be overridden
C) final method can’t be overridden
D) All of above
Que.10) What is output of following program ?
public class Collections { public static void main(String[] args) { List list=new ArrayList(); list.add("X"); list.add("Y"); list.add(new int[10]); System.out.println(list); } }
A) [X,Y,10]
B) [X,Y]
C) Compile time error
D) Runtime error
Answers :->
You must be logged in to post a comment.