Search Header Logo

Java Thread and I/O Quiz

Authored by Aswini G

Computers

University

Used 1+ times

Java Thread and I/O Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct way to create a thread in Java?

Extending the Thread class

Implementing Runnable interface

Both a and b

None of the above

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method must be overridden when implementing the Runnable interface?

start()

stop()

run()

init()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is used to start a thread execution?

run()

start()

execute()

initialize()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the synchronized keyword?

To speed up thread execution

To prevent thread execution

To control access to critical sections

To terminate threads

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following are ways to synchronize a block of code?

synchronized method

synchronized statement

synchronized object

Both a and b

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a critical section?

Part of the code where memory is freed

Part of code accessed by multiple threads

A section used only once

None of the above

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is used for inter-thread communication?

notify()

wait()

notifyAll()

All of the above

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers