Section A
1. …… is a logical instructions, which Python interpreter can read and execute.
(a) Expression
(b) Statement
(c) Comment
(d) Identation
Answer
D
2. Which comments start with # symbol?
(a) Double line
(b) Multi-line
(c) Single line
(d) All of these
Answer
C
3. Which data type contains only numeric value in Python?
(a) Numbers
(b) Strings
(c) Lists
(d) Tuples
Answer
A
4. Index of ……… refers to first element.
(a) 1
(b) − 1
(c) 0
(d) n+1
Answer
C
5. This function is used to calculate total occurrence of given elements of list.
(a) len()
(b) sum()
(c) count()
(d) extend()
Answer
C
6. Which of the following is a collection of Python objects separated by commas represent as (,)?
(a) List
(b) Tuple
(c) Dictionary
(d) String
Answer
B
7. ……… a tuple is a technique to access an individual element of that tuple.
(a) Comparing
(b) Accessing
(c) Concatenation
(d) Traversing
Answer
D
8. You can repeat the elements of the tuple using which operator?
(a) *
(b) +
(c) **
(d) %
Answer
A
9. …… are used to pass the value of a variable to a function.
(a) Arguments
(b) Parentheses
(c) Classes
(d) Objects
Answer
A
10. non-void functions are also known as
(a) non functions
(b) valid functions
(c) fruitful functions
(d) invalid functions
Answer
C
11. A variable declared in a block is local to that block and is known as
(a) global variable
(b) local variable
(c) multi variable
(d) single variable
Answer
B
12. What is the mean of L in LEGB rule for scope resolution?
(a) Local
(b) Last
(c) Least
(d) Library
Answer
A
13. In which file, no delimiters are used for line and no translations occur?
(a) Text file
(b) Binary file
(c) CSV file
(d) None of these
Answer
B
14. Which attribute is used to return access mode with that file was opened?
(a) mode.file
(b) mode.file.name
(c) file.mode
(d) file.mode.type
Answer
C
15. ……… method takes a string and writes it in the file.
(a) writelines()
(b) write()
(c) writerow()
(d) writer()
Answer
B
16. For readline(), a line is terminated by
(a) ‘\n’
(b) EOF
(c) Either (a) or (b)
(d) None of these
Answer
C
17. Which of the following is true regarding lists in Python?
(a) Lists are immutable.
(b) Size of the lists must be specified before its initialisation.
(c) Elements of lists are stored in contagious memory location.
(d) size(list1) command is used to find the size of lists.
Answer
C
18. Suppose list1 is [56, 89, 75, 65, 99], what is the output of list1 [− 2]?
(a) Error
(b) 75
(c) 99
(d) 65
Answer
D
19. Which one of the following is correct?
(a) In Python, a dictionary can have two same keys with different values.
(b) In Python, a dictionary can have two same values with different keys.
(c) In Python, a dictionary can have two same keys or same values but cannot have two
same keys-value pair.
(d) In Python, a dictionary can neither have two same keys nor two same values.
Answer
B
20. dl={“abc”:5,“def”:6,“ghi”:7}
print(d1[0])
What will be the output of above Python code?
(a) abc
(b) 5
(c) {“abc”:5}
(d) Error
Answer
D
21. Which of these about a dictionary is false?
(a) The values of a dictionary can be accessed using keys.
(b) The keys of a dictionary can be accessed using values.
(c) Dictionaries are not ordered.
(d) Dictionaries are mutable.
Answer
B
22. str1=“659.31”
print(“str1”)
What will be the output of above Python code?
(a) 1
(b) 6/4
(c) 1.5
(d) str1
Answer
D
23. Which of the following will result in an error?
str1=“python”
(a) print(str1[3])
(b) str1[1]=“xyz”
(c) print(str1[1:5])
(d) Both (b) and (c)
Answer
B
24. Which of the following is false?
(a) String is immutable.
(b) capitalize() function in string is used to return a string by converting the whole given string into uppercase.
(c) lower() function in string is used to return a string by converting the whole given string into lowercase.
(d) None of the above
Answer
B
25. What will be the following Python code return?
str1=“Stack of books”
print(len(str1))
(a) 13
(b) 14
(c) 15
(d) 16
Answer
B
Section B
26. What is the output of following code?
L = [34, 89]
print(L*3)
(a) Syntax error
(b) [34, 89, 34, 89, 34, 89]
(c) [102, 267]
(d) [37, 92]
Answer
B
27. Suppose the content of file ‘‘para.txt’’ is What will be the output of following code?
myfile = open(“para.txt”,“r”)
s = myfile.read(15)
print(s)
myfile.close()
(a) Hello…How are
(b) Hello…How are you?
(c) Hello…How are yo
(d) Hello…How are you? Hi
Answer
A
28. Identify the output of the following Python statement.
def test(a,b):
s = a+b*2
print(s)
test(12,5)
(a) 34
(b) 17
(c) 22
(d) 29
Answer
C
29. How many times will the given loop iterate?
i = 0
while(i<25):
print(“Python”)
i = i + 1
(a) 24
(b) 25
(c) 26
(d) None of these
Answer
B
30 Find the output of the following code.
i=1
while (i<15):
print(i)
i = i*2

Answer
C
31. Identify the output of the following Python statement.
list1=[4,3,7,9,15,0,3,2]
s = list1[2:5]
print(s)
(a) [7,9,15,0]
(b) [3,7,9,15]
(c) [7,9,15]
(d) [7,9,15,0,3]
Answer
C
32. Observe the following code and answer the question that follow.
File = open(“Mydata”, “a”)
_______#Blank
File. close()
Fill in the blank with statement to write “ABC” in the file “Mydata”.
(a) File.write()
(b) File.write(ABC)
(c) write(ABC)
(d) File.write(“ABC”)
Answer
D
33. Observe the code.
def insert():
import pickle
file1 = open(‘college.txt’.‘a’)
while True:
y = input(“Enter something”)
pickle.dump(y,file1)
ans = input(“Want to enter more data Y/N”)
if(ans.upper()= = ‘N’):
_______ #Line1
file1.close()
insert()
Above code is used to insert element or data into an existing text file.
Write appropriate jump statement from the following to insert the element and terminate the program whenever is need.
(a) jump
(b) continue
(c) goto
(d) break
Answer
D
34. What will be the output of the following Python code?
a = 3
b = 4
c = a**b+5
print(c)
(a) 17
(b) 86
(c) 14
(d) None of these
Answer
B
35. Evaluate the following expression, when a = 10, b = 5 and identify the correct answer.
x = a*3//4+b//4+4−a+5//6
(a) 12
(b) 4
(c) 2
(d) 6
Answer
C
36. Identify the output of following code.
List1=[1, 2, 3, 7, 9]
L=List1.pop(9)
print(L)
(a) Syntax error
(b) 9
(c) [1, 2, 3, 7]
(d) None of these
Answer
A
37. What possible output(s) are expected to be displayed on screen at the time of execution of the program from the following code?
import random
ar = [2, 3, 4, 5, 6, 7]
minn = random.randint (1, 3)
maxn = random.randint (2, 4)
for i in range (minn, maxn + 1):
print (ar [i], end = ‘#’)
(a) 3# 4# 5#
(b) 5# 6# 7#
(c) 1# 4# 7#
(d) 4# 5# 7#
Answer
A
38. What is the output of the following code?
def compute(a,b):
if a > b:
smaller = b
else:
smaller = a
for i in range (1, smaller+1):
if((a%i= = 0) and (b% i ==0)):
val = i
return val
compute(54,24)
(a) 216
(b) 108
(c) 6
(d) 3
Answer
C
39. What is the output of the following code snippet?
def test(a):
for i in a:
print(i)
test((3,4,5,3,7))
(a) 3

(b) 3, 4, 5, 3, 7
(c) 3 4 5 3 7
(d) None of these
Answer
A
40. Find the output of following code.
def display (num) :
num.append ([27])
return (num[1], num[2], num[3])
list1= [6, 12, 27]
n1, n2, n3 = display (list1)
print (list1)
(a) [6,12,27]
(b) [6,12, 27, [27]]
(c) [[27], 6, 12, 27]
(d) [6, 12, [27], 27]
Answer
B
41. What will be the output of the following Python code?
x = [‘ab’, ‘cd’]
for i in x:
i.upper()
print(x)
(a) [‘ab‘, ‘cd’]
(b) [‘AB’, ‘CD’]
(c) [None, None]
(d) None of the mentioned
Answer
A
42. Suppose the content of file ‘‘para.txt’’ is What will be the output of following code?
def count():
f = open (“para.txt”,“r”)
lines = 0
l = f.readlines()
for i in l:
if i[0] = = ‘H’:
lines+=1
print(lines)
(a) 4
(b) 2
(c) 3
(d) None of these
Answer
C
43. Suppose the content of file ‘‘para.txt’’ is What will be the output of following code?
file = open(“para.txt”, “r”)
a = file.read()
b = a.count(‘life’)
print(b)
file.close()
(a) 2
(b) 3
(c) 4
(d) 5
Answer
A
44. Observe the code and identify the output.
x = 5
def func2 ():
x = 3
global x
x = x + 1
print (x)
print (x)

Answer
D
45. The content of file ‘arihant.txt’ is as follows:
What will be the output of following code?
myfile = open(‘arihant.txt’,‘r’)
s = myfile.read(15)
print(s)
myfile.close()
(a) Welcome to Arihan
(b) Welcome to Arih
(c) Welcome to Arihant
(d) Welcome to Arihant!
Answer
B
46. Observe the code given below and find the output, if the content of file ‘‘student.txt’’ is What will be the output of following code?
f = open(‘student.txt’,‘r’)
s = f.readlines()
lcount = len(s)
print(lcount)
f.close()
(a) 4
(b) 3
(c) 2
(d) 5
Answer
D
47. Consider the following directory structure.

Identify the root directory.
(a) Hello
(b) ABC
(c) Mode.png
(d) None of these
Answer
B
48. Assume the content of text file ‘‘student. txt’’ is
What will be the datatype of s?
file = open(“student.txt”)
s = file.readlines()
file.close()
(a) list
(b) string
(c) tuple
(d) dictionary
Answer
A
49. What will be the output of following code?
sub = “PYTHON”
for i in sub:
print(i, ‘ ’, end = “ ”)
(a) P
(b) PYTHON
(c) P Y T H O N
(d) P, Y, T, H, O, N (49)
Answer
C
Section C
Case Study Based Questions:
Shreya write a program to check if elements of a list are same or not, it read from front or back.
a = [1, 2, 3, 3, 2, 1]
i = ______ #line 1
mid = (len (a))/2
same = True
while ______ #line 2
if a[i] ! = ______ : #line 3
print (“No”)
same = False
______ #line 4
______ #line 5
if same = = ______ : #line 6
print (“Yes”)
50. Which value will be assign to variable i in line 1 as marked ?
(a) 1
(b) 0
(c) True
(d) False
Answer
B
51. Choose the correct option to fill up the blank in line 2 as marked.
(a) i == mid:
(b) i > mid:
(c) i < mid:
(d) i < = mid:
Answer
C
52. Choose the correct option to fill up the blank in line 3 as marked.
(a) a[len(a)]
(b) a[len(a) − i]
(c) a[len(a) − 1]
(d) a[len(a)− i − 1]
Answer
D
53. Choose the correct option to fill up the blank in line 4 as marked.
(a) continue
(b) label
(c) goto
(d) break
Answer
D
54. Choose the correct option to fill up the blank in line 5 as marked.
(a) i = i + 1
(b) i = i − 1
(c) i = i * i
(d) i = i + mid
Answer
A
55. What value will be equal to ‘‘same’’ in if condition in line 6 as marked?
(a) False
(b) True
(c) 0
(d) 1
Answer
B