Java Multithreading Test 1 | 25 Questions for Java Developers
Finish Quiz
0 of 25 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
Information
Java Multithreading Test 1 | 25 Questions for Java Developers. Java Multithreading Test Quiz 1 , Free Java Multithreading Quiz, online Test Quiz 1. Java Multithreading Test Quiz 1 Question and Answers 2019. Java online Test Quiz 1. Java Multithreading Quiz 1 Free Mock Test 2019. Java Multithreading Test Quiz 1 Question and Answers in PDF. The Java online mock test paper is free for all students. Java Multithreading Test is very useful for exam preparation and getting for Rank. Java Multithreading Test Quiz 1 Question and Answers in English. Java Multithreading Mock test for topic via Multithreading Mode. Here we are providing Java Multithreading Mock Test in English Now Test your self for “Java Multithreading Test in English” Exam by using below quiz…
This paper has 25 questions.
Time allowed is 30 minutes.
The Java Multithreading Mock Test is Very helpful for all students. Now Scroll down below n click on “Start Quiz” or “Start Test” and Test yourself.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 25 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- Answered
- Review
-
Question 1 of 25
1. Question
Assume the following method is properly synchronized and called from a thread A on an object B:
wait(2000);After calling this method, when will the thread A become a candidate to get another turn at the CPU?
Correct
Either of the two events (notification or wait time expiration) will make the thread become a candidate for running again.
Incorrect
Either of the two events (notification or wait time expiration) will make the thread become a candidate for running again.
-
Question 2 of 25
2. Question
Which three guarantee that a thread will leave the running state?
1. yield()
2. wait()
3. notify()
4. notifyAll()
5. sleep(1000)
6. aLiveThread.join()
7. Thread.killThread()Correct
Incorrect
-
Question 3 of 25
3. Question
Which cannot directly cause a thread to stop executing?
Correct
notify() wakes up a single thread that is waiting on this objects monitor.
Incorrect
notify() wakes up a single thread that is waiting on this objects monitor.
-
Question 4 of 25
4. Question
Which of the following will not directly cause a thread to stop?
Correct
notify() – wakes up a single thread that is waiting on this object´s monitor.
Incorrect
notify() – wakes up a single thread that is waiting on this object´s monitor.
-
Question 5 of 25
5. Question
Which two are valid constructors for Thread?
1. Thread(Runnable r, String name)
2. Thread()
3. Thread(int priority)
4. Thread(Runnable r, ThreadGroup g)
5. Thread(Runnable r, int priority)Correct
(1) and (2) are both valid constructors for Thread.
Incorrect
(1) and (2) are both valid constructors for Thread.
-
Question 6 of 25
6. Question
Which two of the following methods are defined in class Thread?
1. start()
2. wait()
3. notify()
4. run()
5. terminate()Correct
1 and 4 Only start() and run() are defined by the Thread class.
Incorrect
1 and 4 Only start() and run() are defined by the Thread class.
-
Question 7 of 25
7. Question
Which method must be defined by a class implementing the java.lang.Runnableinterface?
Correct
because in an interface all methods are abstract by default therefore they must be overridden by the implementing class. The Runnableinterface only contains 1 method, the void run() method therefore it must be implemented.
Incorrect
because in an interface all methods are abstract by default therefore they must be overridden by the implementing class. The Runnableinterface only contains 1 method, the void run() method therefore it must be implemented.
-
Question 8 of 25
8. Question
Which three are methods of the Object class?
1. notify();
2. notifyAll();
3. isInterrupted();
4. synchronized();
5. interrupt();
6. wait(long msecs);
7. sleep(long msecs);
8. yield();Correct
(1), (2), and (6) are correct. They are all related to the list of threads waiting on the specified object.
(3), (5), (7), and (8) are incorrect answers. The methods isInterrupted() andinterrupt() are instance methods of Thread.
The methods sleep() and yield() are static methods of Thread.
D is incorrect because synchronized is a keyword and the synchronized()construct is part of the Java language.Incorrect
(1), (2), and (6) are correct. They are all related to the list of threads waiting on the specified object.
(3), (5), (7), and (8) are incorrect answers. The methods isInterrupted() andinterrupt() are instance methods of Thread.
The methods sleep() and yield() are static methods of Thread.
D is incorrect because synchronized is a keyword and the synchronized()construct is part of the Java language. -
Question 9 of 25
9. Question
Which of the following will directly stop the execution of a Thread?
Correct
wait() causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.
Incorrect
wait() causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object.
-
Question 10 of 25
10. Question
Which class or interface defines the wait(), notify(),and notifyAll() methods?
Correct
The Object class defines these thread-specific methods.
Incorrect
The Object class defines these thread-specific methods.
-
Question 11 of 25
11. Question
public class MyRunnable implements Runnable
{
public void run()
{
// some code here
}
}
which of these will create and start this thread?Correct
Because the class implements Runnable, an instance of it has to be passed to the Thread constructor, and then the instance of the Thread has to be started.
Incorrect
Because the class implements Runnable, an instance of it has to be passed to the Thread constructor, and then the instance of the Thread has to be started.
-
Question 12 of 25
12. Question
class X implements Runnable
{
public static void main(String args[])
{
/* Missing code? */
}
public void run() {}
}
Which of the following line of code is suitable to start a thread ?Correct
Incorrect
-
Question 13 of 25
13. Question
What is the name of the method used to start a thread execution?
Correct
The start() method causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
Incorrect
The start() method causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
-
Question 14 of 25
14. Question
Which will contain the body of the thread?
Correct
The run() method to a thread is like the main() method to an application. Starting the thread causes the object´ run method to be called in that separately executing thread.
Incorrect
The run() method to a thread is like the main() method to an application. Starting the thread causes the object´ run method to be called in that separately executing thread.
-
Question 15 of 25
15. Question
Which method registers a thread in a thread scheduler?
Correct
The start() method causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
Incorrect
The start() method causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
-
Question 16 of 25
16. Question
What method in the Thread class do you call to make the current thread cease executing for a specified amount of time?
Correct
Incorrect
-
Question 17 of 25
17. Question
You designate a method as being synchronized by:
Correct
Incorrect
-
Question 18 of 25
18. Question
Can we make the user thread as daemon thread if thread is started?
Correct
if you do so, it will throw IllegalThreadStateException
Incorrect
if you do so, it will throw IllegalThreadStateException
-
Question 19 of 25
19. Question
A single sequence of code executing within a program is known as:
Correct
Incorrect
-
Question 20 of 25
20. Question
Is it possible to start a thread twice?
Correct
Incorrect
-
Question 21 of 25
21. Question
What method is declared in the Runnable interface and serves as the path of execution for all threads?
Correct
Incorrect
-
Question 22 of 25
22. Question
To start the execution of a thread after you create it, you must:
Correct
Incorrect
-
Question 23 of 25
23. Question
Which of the following statements about threads is true?
Correct
Incorrect
-
Question 24 of 25
24. Question
What is the primary drawback to using synchronized methods?
Correct
Incorrect
-
Question 25 of 25
25. Question
Can we call the run() method instead of start()?
Correct
but it will not work as a thread rather it will work as a normal object so there will not be context-switching between the threads.
Incorrect
but it will not work as a thread rather it will work as a normal object so there will not be context-switching between the threads.
This questions is very helpfull.