wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Synchronization Problems Quiz

Total questions: 27

Worksheet time: 1hrs 1mins

Name
Class
Date
1.

What is the producer-consumer problem?

a)

A problem where producers create data and consumers use it.

b)

A problem where consumers create data and producers use it.

c)

A problem that involves only producers.

d)

A problem that involves only consumers.

2.

What is a semaphore?

a)

A signaling mechanism.

b)

A type of mutex.

c)

A data structure.

d)

A programming language.

3.

What is the purpose of a barrier in synchronization?

a)

To ensure all threads reach a certain point before continuing.

b)

To allow threads to run independently.

c)

To manage memory allocation.

d)

To prevent deadlocks.

4.

What is the dining philosophers problem?

a)

A problem that illustrates synchronization issues.

b)

A problem that involves only one philosopher.

c)

A problem that does not involve resources.

d)

A problem that is easily solvable.

5.

What is the readers-writers problem?

a)

A problem that deals with resource sharing between readers and writers.

b)

A problem that only involves readers.

c)

A problem that only involves writers.

d)

A problem that does not require synchronization.

6.

How do we know if A happened before B?

4 lines
7.

What is the simplest model of how computer programs run?

4 lines
8.

What happens when a computer is parallel?

4 lines
9.

What is a thread?

4 lines
10.

What is the issue with synchronization in parallel and multithread models?

4 lines
11.

How can you guarantee that tomorrow you will eat lunch before Bob?

4 lines
12.

What is message passing in the context of synchronization?

4 lines
13.

What does it mean for two events to be concurrent?

4 lines
14.

What is non-determinism in concurrent programs?

4 lines
15.

What are shared variables in the context of threads?

4 lines
16.

What value of x gets printed? What is the final value of x when all these statements have executed?

4 lines
17.

What path yields output 5 and final value 5?

4 lines
18.

What path yields output 7 and final value 7?

4 lines
19.

Is there a path that yields output 7 and final value 5? Can you prove it?

4 lines
20.

Assuming that the initial value of x is 0, what is its final value?

4 lines
21.

What is the minimum number of messages that is required?

4 lines
22.

Describe what semaphores are often used for.

4 lines
23.

Why are semaphores useful?

a)

They impose deliberate constraints that help programmers avoid errors.

b)

They are not needed to solve synchronization problems.

c)

They make solutions messy and hard to understand.

d)

They can only be implemented on specific systems.

24.

What is the simplest use for a semaphore?

a)

To signal between threads.

b)

To block threads indefinitely.

c)

To create deadlocks.

d)

To enforce mutual exclusion.

25.

Generalize the signal patterns so that it works both ways.

4 lines
26.

What is a mutex?

a)

A type of semaphore.

b)

A token that allows one thread to proceed.

c)

A method to create deadlocks.

d)

A way to block all threads.

27.

Add semaphore to enforce mutual exclusion to the shared variable count.

4 lines