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

Styled Python Test Paper

The document is a Python basic test paper consisting of multiple choice, short answer, and long answer questions. It covers topics such as user input, data types, functions, and string manipulation. Answers and example programs are provided for each question.
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)
8 views3 pages

Styled Python Test Paper

The document is a Python basic test paper consisting of multiple choice, short answer, and long answer questions. It covers topics such as user input, data types, functions, and string manipulation. Answers and example programs are provided for each question.
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

Python Basic Test Paper (With Answers)

SECTION A — Multiple Choice Questions


1. Which function is used to take input from the user?

Answer: input()

2. Output of print(3 // 2)

Answer: 1

3. Which data type is immutable?

Answer: Tuple

4. Correct syntax of a function?

Answer: def myfun():

5. Output of len("Python")

Answer: 6
SECTION B — Short Answer Questions
6. Write a Python program to check even or odd.

num = int(input("Enter number: "))


if num % 2 == 0:
print("Even")
else:
print("Odd")

7. Output of x = 'Hello'; print(x[1:4])

Answer: ell

8. Difference between List and Tuple

List is mutable; Tuple is immutable.

9. Program to print 1 to 5.

for i in range(1, 6):


print(i)

10. Output of list append operation.

[1, 2, 3, 4]
SECTION C — Long Answer Questions
11. Function to find the square of a number.

def square(n):
return n * n

12. Program to find largest of three numbers.

a = int(input())
b = int(input())
c = int(input())

if a >= b and a >= c:


print(a, "is largest")
elif b >= a and b >= c:
print(b, "is largest")
else:
print(c, "is largest")

13. Program to count vowels in a string.

s = input("Enter a string: ")


count = 0
vowels = "aeiouAEIOU"

for ch in s:
if ch in vowels:
count += 1

print("Vowels:", count)

14. Explain break and continue with examples.

break → exits loop


continue → skips current iteration

15. Program to reverse a string.

s = input("Enter string: ")


print(s[::-1])

You might also like