Grade 11 - Computer Science
Grade 11 - Computer Science
Grade 11
Topic: PYTHON BASICS
a. 1st_string
b. my_string_1
c. _
d. foo
A) Exponential
B) Parentheses
C) Division
D) Multiplication
E) Subtraction
F) Addition
a. B,A,D,C,F,E
b. A,B,D,C,F,E
c. A,B,C,D,E,F
d. B,A,D,C,E,F
a. float(‘nan’)
b. float(‘inf’)
c. float(’12+34′)
d. float(’56’+’78’)
4+2**5//10
a. 77
b. 0
c. 3
d. 7
Answer: (d) 7
a. bool
b. float
c. int
d. None
6. What is the output of the Python code given below, if the date of the system is
June 21st, 2017 (Wednesday)?
[] or {}
{} or []
a.
[] []
b.
[]
{}
c.
{}
{}
d.
{}
[]
Answer: (d)
{}
[]
d. Error
a = [‘mn’, ‘op’]
for i in a:
i.upper()
print(a)
a. [None, None]
b. [‘MN’, ‘OP’]
c. [‘mn’, ‘op’]
print(“mno. PQR”.capitalize())
a. Mno. Pqr
b. Mno. pqr
c. MNO. PQR
d. mno. pqr
a. –
b. +
c. *
Answer: (a) –
a. shuffle(list1)
b. list1.shuffle()
c. random.shuffleList(list1)
d. random.shuffle(list1)
12. In the following statements of Python, which ones will result into the output: 6?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
a. A[3][2]
b. A[2][3]
c. A[1][2]
d. A[2][1]
>>> m=6,7,8,9
>>> m
14. Which function removes a set’s first and the last element from a list?
a. pop
b. remove
c. dispose
d. discard
>>> x={1:”X”,2:”Y”,3:”Z”}
>>> del x
Answer: (d) the del would delete all the keys in dictionary
sum(1,2,3)
sum([2,4,6])
a. 6, 12
b. Error, Error
c. Error, 12
d. 6, Error
print(type(y))
find(‘letters’,X=’1′,Y=’2′)
a. Dictionary
b. An exception is thrown
c. String
d. Tuple
b. The memory space taken by the recursive functions is more than that of non-
recursive function
a = [‘mn’, ‘op’]
print(len(list(map(list, a))))))
a. 4
b. 2
c. Not specified
d. Error
20. Which of these functions can NOT be defined under the sys module?
a. sys.argv
b. sys.readline
c. sys.path
d. sys.platform
a. re.compile
b. re.findall
c. re.match
d. re.purge
b. set an attribute
d. delete an attribute
24. Find out the private data field among the following:
def __init__(self):
__m = 1
self.__n = 1
self.__o__ = 1
__p__= 1
a. __m
b. __n
c. __o__
d. __p__
a. accept
b. finally
c. try
d. except