Quiz: Input and Output | Operators
Quiz: Input and Output | Operators checks how well you can apply printf with multiple specifiers and scanf with & for integers (and related ideas) in C.
Introduction
Quiz: Input and Output | Operators checks how well you can apply printf with multiple specifiers and scanf with & for integers (and related ideas) in C. Try each prompt in a scratch file before moving on.
Understanding the topic
Challenge 1 In your own words — or with a tiny program — show that you understand: printf with multiple specifiers.
Challenge 2 In your own words — or with a tiny program — show that you understand: scanf with & for integers.
Challenge 3 In your own words — or with a tiny program — show that you understand: Result of 10 % 3 and 10 / 3.
Challenge 4 In your own words — or with a tiny program — show that you understand: Logical expression (5 > 3 && 2 < 1).
- Challenge 1 — In your own words — or with a tiny program — show that you understand: printf with multiple specifiers.
- Challenge 2 — In your own words — or with a tiny program — show that you understand: scanf with & for integers.
- Challenge 3 — In your own words — or with a tiny program — show that you understand: Result of 10 % 3 and 10 / 3.
- Challenge 4 — In your own words — or with a tiny program — show that you understand: Logical expression (5 > 3 && 2 < 1).
Step-by-step explanation
- Challenge 1 — In your own words — or with a tiny program — show that you understand: printf with multiple specifiers.
- Challenge 2 — In your own words — or with a tiny program — show that you understand: scanf with & for integers.
- Challenge 3 — In your own words — or with a tiny program — show that you understand: Result of 10 % 3 and 10 / 3.
- Challenge 4 — In your own words — or with a tiny program — show that you understand: Logical expression (5 > 3 && 2 < 1).
Execution workflow
Challenge 1
In your own words — or with a tiny program — show that you understand: printf with multiple specifiers.
Best practices
- Enable warnings: gcc -Wall -Wextra -std=c11 source.c -o app
- Give every variable a defined value before it is read.
- Stay inside array bounds — C will not stop you from over-running a buffer.
Common mistakes
- Reading uninitialized storage — behavior is undefined.
- Dismissing compiler warnings instead of fixing root causes.
- Ignoring NULL returns from malloc, fopen, and similar APIs.
Hands-on exercise
Practice problems:
- Build or explain: printf with multiple specifiers
- Build or explain: scanf with & for integers
- Build or explain: Result of 10 % 3 and 10 / 3
- Build or explain: Logical expression (5 > 3 && 2 < 1)
Summary
Quiz: Input and Output | Operators in C — Self-check on printf/scanf and operator behavior.