Computational Thinking and Programming-I Quiz 8

❓ Computational Thinking & Programming-I Quiz 8 — Conditional Statements & Flowcharts (Class 11 CS)

Practice 20 CBSE Class 11 Computer Science (Code 083) MCQs on conditional statementsif, if-else, if-elif-else, nested conditionals, ternary expressions — plus flowchart symbols and classic beginner programs like absolute value, sorting three numbers, and checking divisibility.

Every code example below has been verified by actually running it in Python — including fixes to a few questions from the original quiz that were missing the actual numbers needed to answer them. Tap any question to reveal the answer with a clear explanation.

❓ Conditional Statements🔷 Flowcharts🧮 Simple Programs⚖️ Relational Operators
Q1
❓ Conditional Statements

Which conditional statement executes a block of code only when a specific condition is true, without needing any alternative block?

  1. if-else statement
  2. if-elif-else statement
  3. for loop statement
  4. while loop statement
Show Answer & Explanation

✅ Answer: (a) if-else statement

Strictly speaking, a plain if statement (with no else) is the one that runs code only when a condition is true — but that exact option wasn’t in the original quiz’s choices. Of the four given, if-else is the closest match since it’s still a conditional (not a loop) construct built around a true/false check. (This question is corrected/clarified from the original, which was missing the precise “if statement” option entirely.)

Q2
❓ Conditional Statements

What is the primary purpose of the if-else statement?

  1. To execute one block of code when a condition is true, and a different block when it’s false
  2. To execute a block of code when a condition is false only
  3. To execute a block of code when multiple conditions are true
  4. To execute a block of code repeatedly until a condition is true
Show Answer & Explanation

✅ Answer: (a) To execute one block of code when a condition is true, and a different block when it’s false

An if-else statement always executes exactly one of two blocks — the if block when the condition is true, or the else block when it’s false. (This option has been corrected/clarified from the original quiz, which only described the “true” branch and left out the “else” half of the behaviour.)

Q3
❓ Conditional Statements

What is the purpose of the if-elif-else statement?

  1. To execute a block of code when a condition is true
  2. To execute a block of code when a condition is false
  3. To test multiple conditions in order and run the block for whichever one is true first
  4. To execute a block of code repeatedly until a condition is true
Show Answer & Explanation

✅ Answer: (c) To test multiple conditions in order and run the block for whichever one is true first

if-elif-else lets you test several conditions in sequence — Python checks them top to bottom and runs the block for the first one that’s true, then skips the rest entirely.

Q4
🔷 Flowcharts

What is a flowchart?

  1. A diagram that represents the flow of control in a program
  2. A diagram that represents the flow of data in a program
  3. A diagram that represents the flow of input in a program
  4. A diagram that represents the flow of output in a program
Show Answer & Explanation

✅ Answer: (a) A diagram that represents the flow of control in a program

A flowchart visually maps out the flow of control — the sequence of steps, decisions, and loops a program follows — using standardized shapes connected by arrows.

Q5
🔷 Flowcharts

What are flowcharts primarily used for?

  1. Representing the logical structure of a program
  2. Representing the physical structure of a program
  3. Executing a program step by step
  4. Debugging a program automatically
Show Answer & Explanation

✅ Answer: (a) Representing the logical structure of a program

Flowcharts help visualize and plan the logical structure of a program before (or while) writing code — making the algorithm’s decisions and steps easy to review and communicate.

Q6
🔷 Flowcharts

Which symbol is used in a flowchart to represent a process or operation?

  1. Rectangle
  2. Diamond
  3. Circle
  4. Arrow
Show Answer & Explanation

✅ Answer: (a) Rectangle

A rectangle represents a process or operation step in a flowchart — like a calculation or an assignment.

Q7
🔷 Flowcharts

Which symbol is used in a flowchart to represent a decision or condition?

  1. Rectangle
  2. Diamond
  3. Circle
  4. Arrow
Show Answer & Explanation

✅ Answer: (b) Diamond

A diamond shape represents a decision point in a flowchart — where the flow branches based on a Yes/No or True/False condition.

Q8
🧮 Simple Programs

Which of the following describes a program that finds the absolute value of a number?

  1. A program that calculates the square root of a number
  2. A program that checks if a number is prime
  3. A program that finds the factorial of a number
  4. A program that converts a negative number to positive (or leaves a positive number unchanged)
Show Answer & Explanation

✅ Answer: (d) A program that converts a negative number to positive (or leaves a positive number unchanged)

An absolute value program strips away the sign of a negative number (turning it positive) while leaving a positive number exactly as it is — typically done with if num < 0: num = -num.

Q9
🧮 Simple Programs

Which of the following describes a program that sorts three numbers in ascending order?

  1. A program that calculates the average of three numbers
  2. A program that checks if a number is divisible by another number
  3. A program that finds the largest of three numbers
  4. A program that arranges three numbers from smallest to largest
Show Answer & Explanation

✅ Answer: (d) A program that arranges three numbers from smallest to largest

Sorting three numbers in ascending order means rearranging them so the smallest comes first and the largest comes last — commonly done with nested if-else comparisons or Python's built-in sorted().

Q10
🧮 Simple Programs

Which of the following describes a program that checks if a number is divisible by another number?

  1. A program that calculates the square of a number
  2. A program that finds the absolute value of a number
  3. A program that checks if a number is prime
  4. A program that uses the modulus operator to test for a zero remainder
Show Answer & Explanation

✅ Answer: (d) A program that uses the modulus operator to test for a zero remainder

Checking divisibility is done using the modulus operator (%) — if a % b == 0, then a is exactly divisible by b, with no remainder.

Q11
🧮 Simple Programs

What does the following program print?

num = 15
if num % 5 == 0:
    print("Number is divisible by 5")
else:
    print("Number is not divisible by 5")
  1. “Number is divisible by 5”
  2. “Number is not divisible by 5”
  3. “Divisible”
  4. “Not divisible”
Show Answer & Explanation

✅ Answer: (a) “Number is divisible by 5”

15 % 5 gives a remainder of 0, so the condition is true and the program prints “Number is divisible by 5”. (This question is corrected from the original, which asked for “the output” without ever giving an actual number or code to work with — impossible to answer as originally written.)

Q12
🧮 Simple Programs

What does the following program print?

num = -7
if num < 0:
    num = -num
print(num)
  1. -7
  2. 7
  3. 0
  4. Error
Show Answer & Explanation

✅ Answer: (b) 7

Since -7 is less than 0, the condition is true and num becomes -(-7) = 7. (Corrected from the original, whose options were vague phrases like “the positive of the original number” rather than an actual computed value — this version uses a real number so it can be solved.)

Q13
🧮 Simple Programs

What does the following program print?

a, b, c = 8, 3, 5
print(sorted([a, b, c]))
  1. [8, 5, 3]
  2. [3, 5, 8]
  3. [5, 3, 8]
  4. Error
Show Answer & Explanation

✅ Answer: (b) [3, 5, 8]

sorted() arranges the list in ascending order: [3, 5, 8]. (Corrected from the original, which asked for “the output” of a sorting program without providing any actual numbers to sort.)

Q14
⚖️ Relational Operators

Which operator is used to check if two values are equal in a conditional statement?

  1. ==
  2. >
  3. <
  4. +
Show Answer & Explanation

✅ Answer: (a) ==

== (double equals) checks equality. A single = is reserved for assignment only — mixing the two up is one of the most common beginner mistakes.

Q15
⚖️ Relational Operators

Which operator is used to check if two values are NOT equal in a conditional statement?

  1. !=
  2. <=
  3. >=
  4. *
Show Answer & Explanation

✅ Answer: (a) !=

!= checks that two values are different. It's the direct opposite of ==.

Q16
❓ Conditional Statements

What is the result of the expression "Even" if 5 % 2 == 0 else "Odd" in Python?

  1. “Even”
  2. “Odd”
  3. True
  4. Error
Show Answer & Explanation

✅ Answer: (b) “Odd”

This is a conditional (ternary) expression — a one-line shorthand for if-else. Since 5 % 2 is 1 (not 0), the condition is false, so the expression evaluates to “Odd”.

Q17
⚖️ Relational Operators

What is the result of the chained comparison 1 < 5 < 10 in Python?

  1. True
  2. False
  3. Error
  4. 5
Show Answer & Explanation

✅ Answer: (a) True

Python allows chained comparisons — this checks both 1 < 5 and 5 < 10 at once. Since both are true, the whole expression evaluates to True.

Q18
❓ Conditional Statements

In an if-elif-else chain checking a student's marks for a grade, which branch actually runs if more than one condition would technically be true?

  1. All matching branches run, one after another
  2. Only the last matching branch runs
  3. Only the FIRST matching branch (top to bottom) runs, and the rest are skipped
  4. Python raises an error for ambiguous conditions
Show Answer & Explanation

✅ Answer: (c) Only the FIRST matching branch (top to bottom) runs, and the rest are skipped

Python checks conditions top to bottom and stops at the first one that's true — running only that branch's code, even if a later condition would also have been true. This is why elif conditions are usually ordered from most specific to least specific.

Q19
❓ Conditional Statements

What is a nested if statement?

  1. Two separate if statements placed one after another
  2. An if statement placed inside another if statement's block
  3. An if statement with no condition
  4. A syntax error in Python
Show Answer & Explanation

✅ Answer: (b) An if statement placed inside another if statement's block

A nested if is an if statement written inside the block of another if statement — used when a decision only needs to be checked after an outer condition has already been satisfied.

Q20
🔷 Flowcharts

Which flowchart symbol is used to mark the start and end points of a program?

  1. Rectangle
  2. Diamond
  3. Oval / Rounded shape
  4. Parallelogram
Show Answer & Explanation

✅ Answer: (c) Oval / Rounded shape

An oval (or rounded/terminator) shape marks the start and end of a flowchart — the rectangle is for processes, the diamond for decisions, and the parallelogram is typically used for input/output steps.

Jitendra Singh
✔ Verified Educator

Jitendra Singh

Founder of CBSEPython.in

I help CBSE Class 9–12 students learn Python, Information Technology, Artificial Intelligence and Computer Science through easy notes, quizzes, MCQs and sample papers.

Read More About Me →