Session 2

Session 2

University

5 Qs

quiz-placeholder

Similar activities

Tutorium1

Tutorium1

University

10 Qs

Java Prelab-IV

Java Prelab-IV

University

10 Qs

SORC 05-10-2022

SORC 05-10-2022

University

10 Qs

Multi-Threading

Multi-Threading

University

7 Qs

rehu

rehu

University

6 Qs

Chapter 10

Chapter 10

University

10 Qs

Threads, Processes, and Programs

Threads, Processes, and Programs

University

8 Qs

Thread Priorities

Thread Priorities

University

10 Qs

Session 2

Session 2

Assessment

Quiz

Computers

University

Medium

Created by

Rafael Wampfler

Used 95+ times

FREE Resource

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How do you get a new thread to execute its run method?

This automatically happens when you create the thread.

Call .start() on the thread.

Call .run() on the thread.

Call .start() on the thread, then call .run().

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

When is the JVM terminated (i.e., when does a Java programm "end")?

When the main thread finishes executing.

When all non-daemon (user) threads finish executing.

Whenn ALL threads finish executing, including daemon (non-user) threads.

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

What is the problem with the following code?

There is no problem.

The nested class MyThread needs to be static.

The class is defined above the main method.

The nested class MyThread can't be public.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

How are instructions of different threads interleaved?

The thread first created finishes executing, then the second thread, etc.

The threads execute one instruction each, taking turns in order of creation.

Randomly, but no thread executes two instructions in a row if others "wait".

Randomly, there are no guarantees.

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

Will this compile and run without a problem?

No, the threads are not joined.

Yes.