33.
What will be the output of the following program code?
public class Test implements Runnable{
        public static void main(String[] args){
                Thread t = new Thread(this);
                t.start();
        }

        public void run(){
                System.out.println("test");
        }
}

34.
Which of the following constructor of class Thread is valid one?

35.
Analyze the following code:
public abstract class Test implements Runnable{
        public void doSomething() { };
}

36.
Analyze the following code:
public class Test implements Runnable{
        public static void main(String[] args){
                Test t = new Test();
                t.start();
        }

        public void run() { }
}

37.
Analyze the following code:
public class Test implements Runnable{
        public static void main(String[] args){
                Test t = new Test();
        }

        public Test(){
                Thread t = new Thread(this);
                t.start();
        }

        public void run(){
                System.out.println("test");
        }
}

38.
What will be the output?
class One extends Thread{
	public void run(){
		for(int i=0; i<2; i++){
			System.out.print(i);
		}
	}
}

public class Test{
	public static void main(String args[]){
		Test t = new Test();
		t.call(new One());
	}
	
	public void call(One o){
		o.start();
	}
}

39.
What will happen when you attempt to compile and run the following code?
public class Test extends Thread{
      public static void main(String argv[]){
            Test t = new Test();
            t.run();
            t.start();
      }
      public void run(){
            System.out.println("run-test");
      }
}

40.
What will happen after compiling and running following code?
class A implements Runnable{
      public void run(){
            System.out.println("run-a");
      }
}

public class Test{
      public static void main(String... args){
            A a = new A();
            Thread t = new Thread(a);
            t.start();
            t.start();
      }
}

Read More Section(Threads)

Each Section contains maximum 100 MCQs question on Threads. To get more questions visit other sections.