IT Trainer Questions


Q:

void waitForSignal() {

Object obj = new Object();

synchronized (Thread.currentThread()) {

obj.wait();

obj.notify();

}

}

Which statement is true?

A) This code can throw an InterruptedException. B) This code can throw an IllegalMonitorStateException.
C) This code can throw a TimeoutException after ten minutes D) All the above
 
Answer & Explanation Answer: B) This code can throw an IllegalMonitorStateException.

Explanation:

It will throw  IllegalMonitorStateException.

Report Error

View Answer Workspace Report Error Discuss

Filed Under: Java - Technology
Job Role: IT Trainer

2 3380
Q:

Inside an interface when should the variables be initialized?

A) Globally B) Whenever required
C) Inside a function D) During the time of declaration
 
Answer & Explanation Answer: D) During the time of declaration

Explanation:

They should be initialized during the time of declaration itself otherwise it is a compilation eror

Report Error

View Answer Workspace Report Error Discuss

Filed Under: Java - Technology
Job Role: IT Trainer

0 1834
Q:

X implements Y extends Z

A) X can be class Y,Z are interfaces B) X is an interface Y,Z are classes
C) X,Y are classes Z is an interface D) Complilation error
 
Answer & Explanation Answer: D) Complilation error

Explanation:

It is a compilation error it should be X extends Y implements Z

Report Error

View Answer Workspace Report Error Discuss

Filed Under: Java - Technology
Job Role: IT Trainer

0 1796
Q:

Which of the following method declarations are allowed inside interface?

A) public void m1() B) private void m1()
C) protected void m1() D) abstract public void m1()
 
Answer & Explanation Answer: D) abstract public void m1()

Explanation:

Inside an interface every method will be by default abstract and public

Report Error

View Answer Workspace Report Error Discuss

Filed Under: Java - Technology
Job Role: IT Trainer

0 1561
Q:

There are 100 students in 3 sections A, B and C of a class. The average marks of all the three sections was 84. The average of B and C was 87.5 and the average marks of students in A section was :

A) 20 B) 35
C) 54 D) 40
 
Answer & Explanation Answer: A) 20

Explanation:

Numbers of students in section A = x
∴ Numbers of students in section B and C = (100 – x)
∴ x 70 + (100 – x) 87.5 = 84 100
=> 70x + 87.5 100 – 87.5x = 8400
=> 8750 – 17.5x = 8400
=> 17.5x = 8750 – 8400 => x = 20.

Report Error

View Answer Workspace Report Error Discuss

14 1510