ExamVeda
Login
Home
51
What will be output of the following program code?
public class Test implements Runnable{
      public void run(){
            System.out.print("go");
      }
    
      public static void main(String arg[]) {
            Thread t = new Thread(new Test());
            t.run();
            t.run();
            t.start();
      }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
52
Given the code. What will be the result?
public class Test implements Runnable{
      public static void main(String[] args) throws InterruptedException{
            Thread a = new Thread(new Test());
            a.start();
        
            System.out.print("Begin");
            a.join();
            System.out.print("End");
      }
    
      public void run(){
            System.out.print("Run");
      }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
53
Which of this method is used to avoid polling in Java?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
54
What will be the output of the following Java code?
class newthread implements Runnable
{
Thread t;
newthread()
    {
  t = new Thread(this,"My Thread");
  t.start();
}
public void run()
    {
  System.out.println(t);
}
}
class multithreaded_programing
{
    public static void main(String args[])
    {
        new newthread();        
    }
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
55
What will be the output of the following Java code?
class newthread extends Thread
{
Thread t;
newthread()
    {
  t = new Thread(this,"New Thread");
  t.start();
}
public void run()
    {
 System.out.println(t.isAlive());
}
}
class multithreaded_programing
{
    public static void main(String args[])
    {
        new newthread();        
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
56
What will be the output of the following Java code?
class newthread extends Thread
{
Thread t1,t2;
newthread()
    {
  t1 = new Thread(this,"Thread_1");
  t2 = new Thread(this,"Thread_2");
  t1.start();
  t2.start();
}
public void run()
    {
  t2.setPriority(Thread.MAX_PRIORITY);	
  System.out.print(t1.equals(t2));
    }    
}
class multithreaded_programing
{
    public static void main(String args[])
    {
        new newthread();        
    }
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
57
What is true about threading?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
58
What will be the output of the following Java program?
class newthread extends Thread
{
    Thread t;
    String name;
    newthread(String threadname)
    {
        name = threadname;
        t = new Thread(this,name);
        t.start();
    }
    public void run()
    {
    }
 
}
class multithreaded_programing
{
    public static void main(String args[])
    {
        newthread obj1 =    new newthread("one");
        newthread obj2 =    new newthread("two");
        try
        {
            obj1.t.wait();	
            System.out.print(obj1.t.isAlive());
        }
        catch(Exception e)
        {
        System.out.print("Main thread interrupted");
        }
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
59
What will be the output of the following Java code?
class newthread implements Runnable
{
Thread t;
newthread()
    {
  t = new Thread(this,"My Thread");
  t.start();
}
}
class multithreaded_programing
{
    public static void main(String args[])
    {
        new newthread();        
    }
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
60
What will be the output of the following Java code?
class newthread implements Runnable 
{
Thread t;
newthread() 
    {
  t = new Thread(this,"My Thread");
  t.start();
}
public void run()
    {
  System.out.println(t.getName());
}
}
class multithreaded_programing
{
    public static void main(String args[])
    {
        new newthread();        
    }
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board