Questions Related to technology

Multiple choice technology
  1. Compilation fails.

  2. An exception is thrown at runtime.

  3. The code executes and prints "running".

  4. The code executes and prints "runningrunning".

  5. The code executes and prints "runningrunningrunning".

Reveal answer Fill a bubble to check yourself
E Correct answer
Multiple choice technology
  1. declare reset() using the synchronized keyword

  2. declare getName() using the synchronized keyword

  3. declare getCount() using the synchronized keyword

  4. declare the constructor using the synchronized keyword

  5. declare increment() using the synchronized keyword

Reveal answer Fill a bubble to check yourself
A,C,E Correct answer
Multiple choice technology
  1. This code may throw an InterruptedException

  2. This code may throw an IllegalStateException

  3. This code may throw a TimeoutException after ten minutes

  4. This code will not compile unless "obj.wait()" is replaced with "((Thread) obj).wait()".

  5. Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally

  6. A call to notify() or notifyAll() from another thread may cause this method to complete normally

Reveal answer Fill a bubble to check yourself
B Correct answer
Multiple choice technology
  1. Compilation fails.

  2. An exception is thrown at runtime.

  3. The code executes and prints "StartedComplete"

  4. The code executes and prints "StartedComplete0123".

  5. The code executes and prints "Started0123Complete".

Reveal answer Fill a bubble to check yourself
E Correct answer
Multiple choice technology
  1. harrier

  2. shepherd

  3. retriever

  4. Compilation fails

  5. retriever harrier

  6. An exception is thrown at runtime

Reveal answer Fill a bubble to check yourself
D Correct answer
Multiple choice technology
  1. A, B, C,

  2. B, C, A,

  3. Compilation fails.

  4. The code runs with no output

  5. An exception is thrown at runtime.

Reveal answer Fill a bubble to check yourself
B Correct answer