What is a program?
A set of instructions a computer follows to perform a task.
What does input() return by default?
A string
What does == mean in Python?
It checks if two values are equal.
What is a while loop?
A loop that repeats while a condition is true
What is a function?
A block of code that performs a task
Name 3 hardware components
CPU, RAM, hard drive, monitor, keyboard, etc.
What does print("Hi", name) do?
Prints “Hi” followed by the value of the variable name
What is the output of if 5 > 3: followed by print("Yes")?
Yes
What does range(3) return?
[0, 1, 2]
What does return do?
Sends a value back to the caller
What’s the difference between RAM and secondary storage?
RAM is temporary memory; secondary storage is permanent
What does int(input("Age?")) do?
Prompts the user and converts the input to an integer
What’s the difference between = and ==?
= assigns a value; == compares values
What is an infinite loop?
A loop that never ends due to a condition that never becomes false
What’s the difference between a parameter and an argument?
A parameter is in the function definition; an argument is the value passed
What is an interpreter?
A program that translates and runs code line-by-line
What does print("5" + "3") output?
53 (string concatenation)
What does != mean?
Not equal to
What’s the difference between for and while loops?
for is count-controlled; while is condition-controlled
What is a value-returning function?
A function that returns a value using return
What is machine language?
Binary code that the CPU can execute directly
What is string concatenation?
Joining strings using +, e.g., "Hello" + "World" → "HelloWorld"
What is a Boolean expression?
An expression that evaluates to True or False
What does break do in a loop?
It exits the loop immediately
Why use main() in a module?
To organize code and prevent it from running on import