Академический Документы
Профессиональный Документы
Культура Документы
Answer : B
Answer : A
class Animal {
void draw() {
System.out.print("Animal ");
}
}
a1.draw();
a2.draw();
a3.draw();
a4.draw();
}
}
Answer : B
static {
System.out.print("Static ");
}
Foo() {
System.out.print("Constructor ");
}
Answer : A
A. Hello
B. Hello World
C. World
D. Compilation Error
Answer : A
6. In the code segment below, what will be the value of the variable i at
completion?
i = 0;
j = 0;
for(j=1;j<10;j++) {
i = i+1;
}
A. 7
B. 8
C. 9
D. None of the above
Answer : C
SecurityManager sm = System.getSecurityManager();
if(sm != null) {
sm.checkRead("filename.txt");
}
Answer : D
8. For what value of X in the code below, will ALL the elements of the array
“values” be printed?
int values[] = {1,2,3,4,5,6,7,8};
for(int i=0;i< X;)
System.out.println(values[++i]);
A. 7
B. 8
C. 9
D. No value of X will print ALL the elements of the array.
Answer : D
while (x << 2) {
x++;
}
Answer : A
Answer : D
Instructions : For questions 11 to 25, select the correct choice from the options
provided.
11. Consider a situation where two threads are sharing the same instance
variable. Each thread keeps its own, private copy of such a shared variable.
The real (or master) copy of the variable is updated at various times, such
as when a synchronized method is entered. To ensure that the master copy
reflects the current state at all times, which modifier would you use for the
shared variable?
A. Transient
B. Volatile
C. Static
D. Final
Answer : B
A. One
B. Zero
C. As many as there are synchronized blocks
D. As many as there are threads accessing the object
Answer : A
Answer : B
A. 389
B. 9080
C. 1099
D. None of the above
Answer : C
Answer : C
16. The Java platform security imposes restrictions on applets without
explicit permissions to do which of the following?
A. Display images
B. Accept user input
C. Write to system files
D. Initialize data in the browser
Answer : C
Answer : C
A. paint()
B. repaint()
C. draw()
D. update()
Answer : A
19. When two or more objects are added as listeners of the same event,
which listener is invoked first?
Answer : C
Answer : D
21. Which of the following is the highest class in the event delegation class
hierarchy?
A. java.util.EventListener
B. java.util.EventObject
C. java.awt.AWTEvent
D. java.awt.event.AWTEvent
Answer : B
A. java.lang.System
B. java.io.PrintWriter
C. java.io.OutputStreamWriter
D. java.io.PrintStream
Answer : D
23. Which of the following are true about the File class?
A. File object can be used to access the files and directories on the local file
system
B. When a File object is created, a corresponding file or a directory is created in
the local file system.
C. When a File object is garbage collected the corresponding file or directory in
the file system is deleted.
D. All of the above
Answer : A
24. Which of the following are true about the garbage collector in java?
A. 1 and 2
B. 2 and 3
C. 2, 3 and 4
D. 1 and 3
Answer : D
A. 1 and 2 only
B. 1, 2 and 3
C. 1 and 3 only
D. 1 and 4 only
Answer : A
Instructions : For questions 26 to 30, select whether the given statement is true or
false.
A. True
B. False
Answer : A
A. True
B. False
Answer : B
A. True
B. False
Answer : A
A. True
B. False
Answer: A