What is the primary purpose of a conditional statement in programming?
A.
To perform complex mathematical calculations.
B.
To store large amounts of data in a variable.
C.
To make decisions and run different code blocks based on certain conditions.
D.
To repeat the same line of code exactly 10 times.
Which keyword is most commonly used to start a basic conditional statement?
A.
while
B.
if
C.
return
D.
function
In a conditional statement, a "boolean expression" must evaluate to one of which two values?
A.
Positive or Negative.
B.
Integer or String.
C.
True or False.
D.
Start or Stop.
Which part of an if-else structure executes if the initial condition is false?
A.
The if block.
B.
The else block.
C.
The switch block.
D.
The entire program stops.
What is "nesting" in the context of conditional statements?
A.
Placing one if statement inside another if statement.
B.
Combining two variables into a single string.
C.
Deleting old code that is no longer needed.
D.
Using a loop to skip a condition.
In many programming languages (like C or Python), which operator is used specifically to check if two values are exactly equal?
A.
=
B.
!=
C.
==
D.
>=
What happens if you forget a break statement at the end of a case in a switch block?
A.
The computer will crash immediately.
B.
The program will skip the next case.
C.
The code will "fall through" and execute the following case(s) even if they don't match.
D.
The default case will always run first.
If there are 5 conditions to be checked including the last option, how many else if statements need to be written?
A.
3
B.
4
C.
5
D.
6
Which component of the switch is similar to else in an if else statement?
A.
expression
B.
case
C.
value
D.
default