DELHI PUBLIC SCHOOL, BAREILLY
HALFYEARLY EXAMINATION (2019-20)
Name: _____________________ Subject: Comp. Sc.
Class/Section: XI Time : 3 Hours
Roll No.:__________________ M.M. : 70
General Instructions:
This question paper is consists of 26 questions. All questions are compulsory.
Marks are indicated against each of them. Use Python Programming Language to give
example.
Q1. What do you mean by packing and unpacking of a tuple? [1]
Q2. Write a statement in Python to covert a list into tuple. [1]
Q3. Python is a Free and Open Source Language. What do you understand by this feature? [2]
Q4. What are the Python Character Set? [2]
Q5. What are the three Key-attributes of a value variable in Python? Explain with example. [2]
Q6. What is an Exception? Explain with the help of an example in Python. [2]
Q7. Predict the output of the following code fragment (i) and find the error(s) in code (ii) and write
it again after correcting error(s). [2 * 2 = 4]
(i) for i in range(4): (ii) weather = ‘raining’
for j in range(5): If weather = ‘sunny’
if I + 1 == j or j + I == 4: Print(“wear sunblock”)
print(“ + “, end = ‘ ‘) elif weather = ‘snow’
else: print(“going skiing”)
print(“ – “, end = ‘ ‘) else: print(whether)
Q8. What is a String Slice in Python? How it is useful? [2]
Q9. Predict the output of the following Python statements : >>>String1 = “PYTHON” [2]
(i) print(String1[-1 : -3]) (iii) print(String1[-1 : ])
(ii) print(String1[ : -1]) (iv) print(String1[ : 3])
Q10. What is the difference between extend(), append() and insert() methods in the List? [2]
Q11. Predict the output of the following Python statements [2 x 1 = 2]
(i) list1 = [13, 18, 11, 16, 13, 18, 13] (ii) List_1 = [‘p’, ’r’, ’o’ ,’b’ ,’l’ ,’e’ ,’m’]
print(list1.index(18)) List_2 = List_1
print(list1.count(18)) List_1[2] = ’O’
list1.append(list1.count(13) print(List_1)
print(*list1) print(List_2)
Q12. How is clear() different from del<dict> statement in Dictionary? Give example. [2]
Q13. Predict the output of the following Python code fragments: [2 x 2 = 4]
(i) my_dict= {‘Python’:1,’Java’:2,’C++’:3} (ii) d = dict()
K = ’Python’ d[‘left’] = ‘<’
V = -1 d[‘right’] = ‘>’
if K in my_dict: print( d[‘left’], d[‘right’], d[‘right’], d[‘left’])
my_dict[K] = V
print(my_dict)
Q14. Throw some light on ‘History of Python Programming Language’. Also write its advantages and
disadvantages. [3]
Q15. Explain Tokens in details. [3]
Q16. Write a program in Python to accept a year from the user and check if it is a leap year or
not. Also Show output. [3]
Q17. Explain different types of Errors in Python programming? [3]
Q18. Write a program in Python to find the percentage of any student out of 5 subjects and print
the grade accordingly using nested if…else… statement. Also show output. [3]
PERCENTAGE GAINED GRADE SCORED
Per >= 90 GRADE A
Per>=80 and Per<=89 GRADE B
Per>=70 and Per<=79 GRADE C
Per>=60 and Per<=69 GRADE D
Per>=50 and Per<=59 GRADE E
Per<=49 Fail
Q19. Write a program in Python to print the table of any number input by the user and display the
table on the screen in the following form: [3]
2x1=2
2x2=4
----------
----------
2 x 10 = 20
Q20. Write a program in Python that reads a string and checks whether it is a palindrome (i.e.
String from left to right and right to left both are equal) string or not. [3]
Q21. Write a program in Python to print the string in the form of: [3]
P N
Y O
T H
H T
O Y
N P
Q22. How creating a list by initializing a list is different from making a true copy of list on Python?
Write a program in Python to show the difference. Also show output. [3]
Q23. What is the difference between append(), extend() and insert() function in the list. Write
small code of each in Python. [3]
Q24. Write a program in Python that creates a tuple string first 9 terms of Fibonacci series. [4]
Q25. Write a program in Python to accept a string from the user and print its each element along
with its backward and forward indexing. Also show output. [4]
Q26 Write a program in Python to create a dictionary containing names of competition winner
student as keys and number of their wins as values. [4]
*********************************************************