0% found this document useful (0 votes)
2 views3 pages

Python Test

The document outlines a Python programming test comprising three sections: Objective questions worth 10 marks, Short Answer questions worth 20 marks, and Long Answer questions worth 20 marks. The test assesses various Python concepts, including data types, control structures, and basic programming tasks. The total maximum marks for the test are 50, with a passing mark set at 25.

Uploaded by

Naveen Singh
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)
2 views3 pages

Python Test

The document outlines a Python programming test comprising three sections: Objective questions worth 10 marks, Short Answer questions worth 20 marks, and Long Answer questions worth 20 marks. The test assesses various Python concepts, including data types, control structures, and basic programming tasks. The total maximum marks for the test are 50, with a passing mark set at 25.

Uploaded by

Naveen Singh
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/ 3

Python Programming Test

Maximum Marks: 50
Pass Marks: 25
Time: 1.5 Hours

Section A – Objective (1 mark each = 10 Marks)


1. Which of the following is immutable in Python?
a) List b) Tuple c) Dictionary d) Set

2. What is the output of: print(10 // 3)?


a) 3.33 b) 3 c) 3.0 d) Error

3. Which operator is used for exponentiation in Python?


a) ^ b) ** c) pow() d) %

4. What will the following code output?


x = [1,2,3]
y=x
y.append(4)
print(x)
a) [1,2,3] b) [1,2,3,4] c) Error d) [4]

5. Which keyword is used to skip the current iteration in a loop?


a) break b) continue c) pass d) skip

6. Which data type is returned by input() function in Python?


a) int b) float c) str d) bool

7. What is the output?


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

8. Which of the following is NOT a valid identifier in Python?


a) my_var b) _value c) 2data d) data2

9. What will this code print?


a=5
if a > 10:
print('Big')
else:
print('Small')
a) Big b) Small c) Error d) Nothing

10. Which statement is true about pass keyword?


a) Exits loop immediately b) Does nothing c) Skips iteration d) Raises error

Section B – Short Answer (2 Marks each = 20 Marks)


11. Write a program to check whether a number is even or odd using if-else.

12. Write a Python program to find the largest of three numbers using nested if-else.

13. Write a program to print numbers from 1 to 10 using a for loop.

14. Write a program using while loop to print multiplication table of 5.

15. Write a program that uses continue to print odd numbers between 1 and 10.

16. Write a program that asks the user for marks and prints 'Pass' if marks ≥ 40 else 'Fail'.

17. Write a program to calculate the sum of first 50 natural numbers using loop.

18. Write a program that prints the following pattern (Inverted Pyramid):
*****
***
*

19. Write a program that prints the following pattern (Diamond):


*
***
*****
***
*

Section C – Long Answer (5 Marks each = 20 Marks)


21. Write a program to check whether a given number is prime or not.

22. Write a program to reverse a number using while loop.

23. Write a Python program to print the following pattern (Right-Angled Triangle with
Numbers):
1
12
123
1234

24. Write a menu-driven program using if-elif-else where user can choose:
1 → Addition
2 → Subtraction
3 → Multiplication
4 → Division

You might also like