Java
Java
Q1. Which one of these lists contains only Java programming language keywords?
Answer: Option B
Answer: Option D
A) method B) native
C) subclasses D) reference
Answer: Option B
Answer: Option A
Q5. Which one of the following will declare an array and initialize it with five numbers?
Answer: Option B
Answer: Option A
Q7. The Java interpreter is used for the execution of the source code?
a) True
b) False
Answer True
import myLibrary.*;
A. myLibrary.java B. ShowSomeClass.java
C. ShowSomeClass D. ShowSomeClass.class
Answer B
compiler).
Answer D
Q10Consider the following code snippet
String river = new String(“Columbia”);
System.out.println(river.length());
What is printed?
A. 6
B. 7
C. 8
D. Columbia
Answer C
Q11. A constructor
D. A and B
4.
E. A, B and C
Answer E
B. instance methods
C. constructors
Answer D
Answer D
Q14. Consider
public MyClass(){/*code*/}
// more code...
B. MyClass mc = MyClass();
C. MyClass mc = MyClass;
Answer A
Answer A
A. The operating system periodically deletes all of the java files available on the
system.
C. When all references to an object are gone, the memory used by the object is
automatically reclaimed.
D. The JVM checks the output of any Java program and deletes anything that
Answer C
Q17. You read the following statement in a Java program that compiles and
executes.
submarine.dive(depth);
Answer B
Q18. What output is displayed as the result of executing the following statement?
Ans : a.
Q22 Which of the following is used to interpret and execute Java Applet Classes
hosted by HTML
A) Appletviewer B) Java C) javac D) None
Answer A
Q23. HTML based Java Documentary help can be accessed using _________
Answer B
Answer C
Answer C)
Answer B
A) // B)/** C) /* */ D)
Answer A
C) java.io.Boolean D) java.lang.Boolean
Answer D
Q 30. We can construct Boolean Object from ________. Select appropriate option(s).
Answer A & C
Q31. Which one of these lists contains only Java programming language keywords?
Answer B
Answer A
Q 33 Which is a valid declarations of a String?
A) It can extend exactly one class and implement exactly one interface.
B) It can extend exactly one class and can implement multiple interfaces.
Answer C
Answer B
A) You must have a reference to an instance of the enclosing class in order to instantiate it.
Answer D
Q 40. Which collection class allows you to grow or shrink its size and provides indexed access to
its elements, but whose methods are not synchronized?
A) java.util.HashSet B) java.util.LinkedHashSet
C) java.util.List D) java.util.ArrayList
Q 44. Which method must be defined by a class implementing the java.lang.Runnable interface?
A) void run() B) public void run() C) public void start() D) void run(int priority)
Q 49. You want a class to have access to members of another class in the same package. Which
is the most restrictive access that accomplishes this objective?
Q 50. Which of the following class level (nonlocal) variable declarations will not compile?