gs gs128 Java Multithreading - Java Threads - Quiz No.1
gs gs128 Java Quiz
This quiz belongs to book/course code gs gs128 Java of gs organization. We have 136 quizzes available related to the book/course Java. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Java Multithreading. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
Question 1: Which of these keywords are used to implement synchronization?
synchronize
syn
synch
synchronized
Question 2: Which of this method is used to avoid polling in Java?
wait()
notify()
notifyAll()
all of the mentioned
Question 4: Which of these method wakes up the first thread that called wait()?
wake()
notify()
start()
notifyAll()
Question 5: Which of these method wakes up all the threads?
wakeAll()
notify()
start()
notifyAll()
Question 6: What is synchronization in reference to a thread?
It’s a process of handling situations when two or more threads need access to a shared resource
It’s a process by which many thread are able to access same shared resource simultaneously
It’s a process by which a method is able to access many different threads simultaneously
It’s a method that allow too many threads to access any information the require
Question 9: 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"); } } }
true
false
Main thread interrupted
None of the mentioned