Page 1 :
1. Which of this method can be used to make the main thread to be executed last among all the threads?, a) stop(), b) sleep(), c) join(), d) call(), 2. Which of this method is used to find out that a thread is still running or not?, a) run(), b) Alive(), c) isAlive(), d) checkRun(), 3. What is the default value of priority variable MIN_PRIORITY AND MAX_PRIORITY?, a) 0 & 256, b) 0 & 1, c) 1 & 10, d) 1 & 256, 4. Which of these method waits for the thread to terminate?, a) sleep(), b) isAlive(), c) join(), d) stop(), 5. Which of these method is used to explicitly set the priority of a thread?, a) set(), b) make(), c) setPriority(), d) makePriority(), 6. What is synchronization in reference to a thread?, a) It’s a process of handling situations when two or more threads need access to a shared resource, b) It’s a process by which many thread are able to access same shared resource simultaneously, c) It’s a process by which a method is able to access many different threads simultaneously, d) It’s a method that allow too many threads to access any information require, 7. What will be the output of the following Java code?, class newthread extends Thread, {, newthread(), {, super("My Thread");, start();, }, public void run(), {, System.out.println(this);, }, }, class multithreaded_programing, {, public static void main(String args[]), {, new newthread();, }, }, a) My Thread, b) Thread[My Thread,5,main], c) Compilation Error, d) Runtime Error, 8. What will be the output of the following Java code?, class newthread extends Thread, {, Thread t;, newthread(), {, t = new Thread(this,"My Thread");, t.start();, }, public void run(), {, try, {, t.join(), System.out.println(t.getName());, }, catch(Exception e), {, System.out.print("Exception");, }, }, }, class multithreaded_programing, {, public static void main(String args[]), {, new newthread();, }, }, a) My Thread, b) Thread[My Thread,5,main], c) Exception, d) Runtime Error, 9. 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();, }, }, 0, b) 1, c) true, d) false, 10. 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();, }, }, true, b) false, c) truetrue, d) falsefalse, 11. Which of these method is used to implement Runnable interface?, a) stop(), b) run(), c) runThread(), d) stopThread(), 12. Which of these method is used to begin the execution of a thread?, a) run(), b) start(), c) runThread(), d) startThread(), 13. Which of these statement is incorrect?, a) A thread can be formed by implementing Runnable interface only, b) A thread can be formed by a class that extends Thread class, c) start() method is used to begin execution of the thread, d) run() method is used to begin execution of a thread before start() method in special cases, 14. 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();, }, }, a) My Thread, b) Thread[My Thread,5,main], c) Compilation Error, d) Runtime Error, 15. 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();, }, }, a) My Thread, b) Thread[My Thread,5,main], c) Compilation Error, d) Runtime Error, 16. 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();, }, }, a) My Thread, b) Thread[My Thread,5,main], c) Compilation Error, d) Runtime Error, 17. What will be the output of the following Java code?, class newthread implements Runnable, {, Thread t;, newthread(), {, t = new Thread(this,"New Thread");, t.start();, }, public void run(), {, t.setPriority(Thread.MAX_PRIORITY);, System.out.println(t);, }, }, class multithreaded_programing, {, public static void main(String args[]), {, new newthread();, }, }, a) Thread[New Thread,0,main], b) Thread[New Thread,1,main], c) Thread[New Thread,5,main], d) Thread[New Thread,10,main], 18. What will be the output of the following Java code?, class newthread implements Runnable, {, Thread t;, 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();, }, }, a) true, b) false, c) truetrue, d) falsefalse, 1. Which of these method of Thread class is used to find out the priority given to a thread?, a) get(), b) ThreadPriority(), c) getPriority(), d) getThreadPriority(), 2. Which of these method of Thread class is used to Suspend a thread for a period of time?, a) sleep(), b) terminate(), c) suspend(), d) stop(), 3. Which function of pre defined class Thread is used to check weather current thread being checked is still running?, a) isAlive(), b) Join(), c) isRunning(), d) Alive(), 4. What will be the output of the following Java code?, class multithreaded_programing, {, public static void main(String args[]), {, Thread t = Thread.currentThread();, t.setName("New Thread");, System.out.println(t);, }, }, a) Thread[5,main], b) Thread[New Thread,5], c) Thread[main,5,main], d) Thread[New Thread,5,main], 5. What is the priority of the thread in output in the following Java program?, advertisement, class multithreaded_programing, {, public static void main(String args[]), {, Thread t = Thread.currentThread();, t.setName("New Thread");, System.out.println(t.getName());, }, }, a) main, b) Thread, c) New Thread, d) Thread[New Thread,5,main], 6. What is the name of the thread in output in the following Java program?, class multithreaded_programing, {, public static void main(String args[]), {, Thread t = Thread.currentThread();, System.out.println(t.getPriority());, }, }, a) 0, b) 1, c) 4, d) 5, 7. What is the name of the thread in output in the following Java program?, class multithreaded_programing, {, public static void main(String args[]), {, Thread t = Thread.currentThread();, System.out.println(t.isAlive());, }, }, a) 0, b) 1, c) true, d) false