image not found

Oops! That page can't be found.


Directions to Solve

In questions below, each passage consist of six sentences. The first and sixth sentence are given in the begining. The middle four sentences in each have been removed and jumbled up. These are labelled as P, Q, R and S. Find out the proper order for the four sentences.

Q1:
S1: The path of Venus lies inside the path of the Earth.
P : When at its farthest from the Earth, Venus is 160 million away
Q : With such a wide range between its greatest and leat distances it is natural that at sometimes Venus appears much brighter than at others.
R : No other body ever comes so near the Earth, with the exception of the Moon and occasional comet or asteroid.
S : When Venus is at its nearest to the earth it is only 26 million miles away.
S6: When at its brightest, it is easily seen with the naked eye in broad daylight.
The Proper sequence should be:

A SRPQ

B QPRS

C PSQR

D SQRP

Q2: There is a error in the below program. Which statement will you add to remove it?
#include<stdio.h>

int main()
{
    int a;
    a = f(10, 3.14);
    printf("%d\n", a);
    return 0;
}
float f(int aa, float bb)
{
    return ((float)aa + bb);
}

A Add prototype: float f(aa, bb)

B Add prototype: float f(float, int)

C Add prototype: float f(bb, aa)

D Add prototype: float f(int, float)

Q3: Which cannot directly cause a thread to stop executing?

A Calling notify() method on an object.

B Calling the wait() method on an object.

C Calling read() method on an InputStream object.

D Calling the SetPriority() method on a Thread object.

Q4:
Which two of the following methods are defined in class Thread?
  1. start()
  2. wait()
  3. notify()
  4. run()
  5. terminate()

A 1 and 4

B 3 and 4

C 2 and 4

D 2 and 3

Q5:
Which three guarantee that a thread will leave the running state?
  1. yield()
  2. wait()
  3. notify()
  4. notifyAll()
  5. sleep(1000)
  6. aLiveThread.join()
  7. Thread.killThread()

A 1, 2 and 4

B 2, 5 and 6

C 3, 4 and 7

D 4, 5 and 7

Q6: Which of the following will directly stop the execution of a Thread?

A notifyall()

B exits synchronized code

C notify()

D wait()

Q7: Which method must be defined by a class implementing the java.lang.Runnable interface?

A void run(int priority)

B public void run()

C public void start()

D void run()

Q8: Which will contain the body of the thread?

A stop();

B main();

C start();

D run();

Q9: Which method registers a thread in a thread scheduler?

A register();

B run();

C start();

D construct();

Q10: Assume the following method is properly synchronized and called from a thread A on an object B: wait(2000); After calling this method, when will the thread A become a candidate to get another turn at the CPU?

A Two seconds after lock B is released.

B Two seconds after thread A is notified.

C After the lock on B is released, or after two seconds.

D After thread A is notified, or after two seconds.