Python practice -6

Class XII Python Programming Test (Paper 6)

Time Allowed: 3 hours

Maximum Marks: 70

Section A (1 mark each)

Question 1: What is the result of `2**3` in Python?

a) 5

b) 6

c) 8

d) 10

Question 2: Which of the following is not a valid Python variable name?

a) _var

b) var1

c) 1var

d) var_name

Question 3: What is the result of ’12’ < ‘2’ in Python?

a) True

b) False

c) Error

d) None of the above

Question 4: Which data type is immutable in Python?

a) List

b) Dictionary

c) Set

d) Tuple

Question 5: What is the output of the following code?

print('Hi', 'there', sep=',')

a) Hi,there

b) Hi there

c) Hi, there

d) Hi @ there

Section B (2 marks each)

Question 6: Write a Python program to reverse a given tuple.

Question 7: Write a Python program to find the length of a given string without using the `len()` function.

Question 8: Explain the use of the `break` statement in Python loops with an example.

Question 9: Write a Python program to print the table of a given number.

Question 10: Explain the difference between the `append()` and `extend()` methods in Python lists with an example.

Section C (3 marks each)

Question 11: Write a Python function that accepts two lists and returns their intersection as a list.

Question 12: Write a Python program to calculate the sum of the digits of a given number.

Question 13: Explain the use of the `pass` statement in Python with an example.

Question 14: Write a Python program to sort the values in a dictionary based on the key.

Question 15: Write a Python function that takes a string as input and returns a dictionary containing the count of each character in the string.

Section D (5 marks each)

Question 16: Write a Python program that accepts a list of numbers and creates a dictionary with the number as the key and its square as the value.

Question 17: Write a Python program that reads a CSV file and stores the data into a list of dictionaries.

Question 18: Write a Python program to check if a given string is a palindrome.

Question 19: Write a Python program that reads a list of words and prints the longest word along with its length.

Question 20: Write a Python program to implement a stack using lists.

Section E (10 marks)

Question 21: Write a Python program that simulates an address book. The address book should be able to add, view, update, and delete contacts, and should also handle basic input validation and display appropriate messages

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top