Area of Improvements
Review your assessments and practice — drill into each subject, then each attempt, then each question.
Back to summary
C Programming · Round 1
Question 10 of 10
Topic: Constants & literalsDifficulty: MediumBloom: Apply
Question
How does shared mutable state in C interact with concurrency?
Result
Knowledge
50%
Delivery
65%
Technical relevancy
55%
Technical term match
45%
Your recording
Your transcript
If two threads write to the same variable you get a race condition. You should use a mutex. Volatile makes it safe... I think. Or maybe atomic.
Better answer
Concurrent unsynchronised access to shared mutable state where at least one is a write is a data race — undefined behaviour in C11. Use mutexes (pthread_mutex_t) for critical sections, or _Atomic / <stdatomic.h> for lock-free single-word updates. volatile prevents compiler caching but does NOT provide atomicity or memory ordering between threads.
Coverage
Hit 2 of 5- Identifies data race as undefined behaviour
- Mentions mutex for critical sections
- Mentions <stdatomic.h> / _Atomic
- Correctly distinguishes volatile from atomic
- Mentions memory ordering / fences
Gaps
- Did not call data race undefined behaviour
- Skipped memory ordering / acquire-release semantics
Misconceptions
- Said volatile is sufficient for thread safety

