Java Threads - MCQ and Answers for Java Exam - Java Optional Questions

Sports GK Questions and Answers 2024 (Latest Updated)

Awards & Honours GK Questions 2024 (Latest Updated)

Questions
1 Two threads cannot simultaneously enter into the methods of the same object if the methods are
A static
B synchronized
C private
D package

Answer: Option [B]

Two synchronized methods cannot invoke on the same object.

2 While using threads which of the following is incorrect?
A You invoke the Run method
B You implement Runnable interface
C You extend from Thread class
D You call the start method

Answer: Option [A]

Threads are instances of class java.lang and first you call start() method and after run() method is executed.

Advertisement
Article and Schedule Quiz Start Test!
DOWNLOAD CURRENT AFFAIRS PDF FROM APP
3 What is the name of the method used to schedule a thread for execution?
A init()
B start()
C run()
D resume()

Answer: Option [C]

At first start() method called and then run() method is executed to schedule a thread for execution.

4 What is the default priority of a thread in Java?
A 10
B 5
C 3
D 1

Answer: Option [B]

Java threads have a priority. The highest priority of a thread is 10 and lowest priority is 1. The default priority of a java thread is 5.

5 A thread becomes not runnable when
A its sleep method is invoked
B the program terminates
C a network connection is established
D an event occurs

Answer: Option [A]

A thread becomes not runnable when any of the following conditions satisfied:

(i) If sleep method is invoked

(ii) The thread calls the wait method to satisfy some specific conditions

(iv) The thread is blocking on I/O.

Random GK Questions

Chapters

Assam Direct Recruitment Test Series

Computer Science Topics