0% found this document useful (0 votes)
5 views4 pages

Python Flow Control Statements Quiz

Uploaded by

iam5747462
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views4 pages

Python Flow Control Statements Quiz

Uploaded by

iam5747462
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

### Question Paper: Flow Control Statements in Python

#### Section A: Multiple Choice Questions (MCQs)

1. What will the following code output?

```python

age = 20

if age >= 18:

print("Eligible")

```

a) Eligible

b) Not Eligible

c) Error

d) None of the above

2. Which operator is used to check multiple conditions where at least one condition must be true?

a) and

b) or

c) not

d) both a and b

3. What is the output of the following code?

```python

marks = 70

if marks >= 90:

print("Grade: A")

elif marks >= 75:


print("Grade: B")

else:

print("Grade: C")

```

a) Grade: A

b) Grade: B

c) Grade: C

d) Error

4. Which statement is used to exit a loop prematurely?

a) continue

b) pass

c) break

d) stop

#### Section B: Fill in the Blanks

1. The `if-else` statement executes one block of code if the condition is True, and another block if

the condition is ___.

2. In Python, the logical operator for "and" is written as ___.

3. The `___` statement is used as a placeholder in Python.

4. To skip the current iteration of a loop and continue with the next iteration, the `___` statement is

used.

#### Section C: Short Answer Questions

1. Write the syntax of a nested `if` statement with an example.

2. Explain the difference between `break` and `continue` statements in loops.

3. Describe the use of `and` and `or` operators in `if` statements with examples.
4. Write a Python program to check if a number is positive, negative, or zero using an `if-elif-else`

statement.

#### Section D: Programming Questions

1. Write a Python program to print the following pattern using nested loops:

```

**

***

****

*****

```

2. Write a Python program using a `for` loop to calculate the sum of all even numbers from 1 to 50.

3. Write a Python program to determine whether a person is eligible for a loan based on the

following conditions:

- Age must be greater than or equal to 18.

- Income must be greater than 20,000.

4. Write a Python program to implement the following logic:

- Input a number from the user.

- If the number is divisible by 3, print "Fizz".

- If the number is divisible by 5, print "Buzz".

- If the number is divisible by both 3 and 5, print "FizzBuzz".

- Otherwise, print the number.

#### Section E: Descriptive Questions


1. Compare Python's `if` statements with similar conditional statements in C or Java. Which one do

you prefer and why?

2. Explain the importance of indentation in Python's flow control statements.

3. Discuss the use of `pass` statement with a relevant example.

4. How does Python's readability with plain English operators (`and`, `or`) benefit programmers?

You might also like