Question 1 of 25
Hints left: 3
Q1
Which of these method is used to implement Runnable interface?
Q2
What is the priority of the thread in the following Java Program? class multithreaded_programing { public static void main(String args[]) { Thread t = Thread.currentThread(); System.out.println(t); } }
Q3
Which of these method of Thread class is used to find out the priority given to a thread?
Q4
What is multithreaded programming?
Q5
What is synchronization in reference to a thread?
Q6
What should not be done to avoid deadlock?
Q7
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); } }
Q8
What is the priority of the thread in output in the following Java program? class multithreaded_programing { public static void main(String args[]) { Thread t = Thread.currentThread(); t.setName("New Thread"); System.out.println(t.getName()); } }
Q9
Which of these are types of multitasking?
Q10
What is the name of the thread in the following Java Program? class multithreaded_programing { public static void main(String args[]) { Thread t = Thread.currentThread(); System.out.println(t); } }
Q11
Which class is used to read data from the keyboard in Java?
Q12
How can you close a file after reading or writing in Java?
Q13
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 { System.out.print(obj1.t.equals(obj2.t)); } catch(Exception e) { System.out.print("Main thread interrupted"); } } }
Q14
What is the purpose of the `System.out.println()` method in Java?
Q15
What does not prevent JVM from terminating?
Q16
Which of these method waits for the thread to terminate?
Q17
Which method is used to write data to a file in Java?
Q18
What will be the output of the following Java code? class multithreaded_programing { public static void main(String args[]) { Thread t = Thread.currentThread(); System.out.println(t); } }
Q19
What is the default value of priority variable MIN_PRIORITY AND MAX_PRIORITY?
Q20
Which of these statements is incorrect?
Q21
Which of these method is used to explicitly set the priority of a thread?
Q22
Which of these method of Thread class is used to Suspend a thread for a period of time?
Q23
Which function of pre defined class Thread is used to check weather current thread being checked is still running?
Q24
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(); } }
Q25
What is synchronization in reference to a thread?