What data type is used to store whole numbers (e.g., 10, –3)?
int / integer
What is the output type of (int) 3.9?
nt (value becomes 3)
What keyword begins a conditional statement?
if
What data type stores multiple values of the same type?
Array
True or False: Strings are arrays of characters.
True
What data type stores true/false values?
boolean / bool
True or False: You can cast a string directly into a boolean.
False
What keyword runs only when the “if” condition is false?
else
What is the index of the first element in an array?
0
What is the length of the string "code"?
4
What data type stores single characters like ‘A’ or ‘#’?
char / character
What comparison operator means “equal to”?
==
What keyword allows you to check another condition after an if-statement?
else if / elif
for i in range(3):
print(i*i)
0, 1, 4
What data type results from concatenating two strings?
String
Which data type stores decimal numbers with double precision?
double
What operator means “not equal to”?
!=
In if (x > 10), what must be true for the code to execute?
x must be greater than 10
Given the list [2, 7, 11, 15], find two numbers that sum to 9.
2 and 7
What is the index of the letter “g” in "program"?
Index 3 (0-based)
What data type is used for text?
string
What logical operator means AND?
&& or and
What is it called when you put an if-statement inside another if-statement?
Nested conditionals
What prints from this code?
if 5 > 3:
print("Yes")
Yes
What prints?
x = 8
if x > 10:
print("High")
elif x > 5:
print("Medium")
else:
print("Low")
Medium