0% found this document useful (0 votes)
19 views2 pages

AIPythonCl23072025012705 0

This document is a worksheet for Class IX students on Python programming, containing multiple-choice questions, true/false statements, and coding exercises. It covers topics such as loops, conditional statements, and differences between data structures like tuples and lists. Students are required to answer questions, write code snippets, and identify errors in provided code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

AIPythonCl23072025012705 0

This document is a worksheet for Class IX students on Python programming, containing multiple-choice questions, true/false statements, and coding exercises. It covers topics such as loops, conditional statements, and differences between data structures like tuples and lists. Students are required to answer questions, write code snippets, and identify errors in provided code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Artificial Intelligence-417

Class IX Session 2025-26


Worksheet-Python
Name __________________________ Section/Roll No._______

Select the correct answer.


1. Identify the correct output for the code snippet below:
t = (1, 2, 3)
print(t[1])
a) 1 b) 2 c) 3 d) Error
2. What is the correct syntax for an if statement in Python?
a) if x == 5 then: b) if (x == 5): c) if x == 5: d) if x = 5:

3. Which of the following range functions will generate numbers from 5 to 9?


a) range(5, 10) b) range(5, 9) c) range(5, 10, 1) d) Both a and c

4. Which loop is used when the number of iterations is not known in advance in Python?
a) for loop b) infinite loop c) while loop d) do-while loop

5. Which loop allows iteration over a sequence such as a list, tuple, or string in Python?
a) while loop b) for loop c) switch loop d) repeat loop

6. What will be the output of the following code?


for i in range(1, 5):
if i == 3:
break
print(i)
a) 1 2 b) 1 2 3 c) 1 2 3 4 d) Error

7. True /False
a) for loops are used for definite iteration.
b) while loops are used for indefinite iteration.
c) A break statement can terminate a loop.
d) Python does not support nested loops.

8. Match the following

Section A Section B
1. += a. Comparison Operator
2. // b. Logical Operator
3. = = c. Integer Division Operator
4. and d. Raised to power Operator
5. ** e. Assignment Operator
9. Write a Python program to calculate the sum of the first 5 positive integers using a while loop.
____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

10. Write any two differences between a tuple and a list in Python

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

11. Find error in the given code & correct it.


a = int(input("Enter percentage: "))
if a >= 90
print("Grade A")
elif a <90 and >80:
print("Grade B")
elif a<80 and a> 70:
print(Grade C)
otherwise
print("Fail")

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

12. Python program that prints "Hello" five times using a while loop

____________________________________________________________________________________

____________________________________________________________________________________

____________________________________________________________________________________

You might also like