Professional Documents
Culture Documents
SCHOOL
(Affiliated to C.B.S.E. New Delhi)
Sree Nandeeswarar Campus, Adambakkam, Chennai – 600 088
MCQ Test Series – 1 2023-2024
Computer Science
Maximum Marks:55 Time Allowed: 60 Minutes
Q.NO. Section-A
1 i) Name the module which will be needed to use the function max( ) : -
A. math B. random C. stat D. No module required
ii) Which command we can use to remove ?
string “hello” from list1, Given, list1=[“hello”]
A. list1.remove(“hello”) B. list1.pop(list1.index('hello'))
C. Both a & b D. None of these
2 i) Which of the following functions will return the key, value pairs of a dictionary?
A. keys() B. values() C. items() D. all of these
ii) A variable declared/defined outside a specific function is known as: -
A .Local variable B. Specific variable
C. Global Variable D. None of the above
3 i) The return type of the input() function is
A. String B. integer C. list D. tuple
ii) Choose correct answer
def fun1(num):
return num+5
print(fun1(5))
print(num)
A. print value 10 B. print value 5 C.Name Error D.25
4 i) Which of the following operator cannot be used with string data type?
A. + B. in C.* D./
i) Which of the following is not a function of tuple?
A. update() B. index( ) C.len( ) D.count( )
1
8 i) Which command can we use to insert 5 at the third position in list1?
A.list1.insert(3, 5) B.list1.insert(2, 5) C.list1.add(3, 5) D.list1.append(3, 5)
ii) Which of the following can be used to delete item(s) from a dictionary?
A. del statement B. get()
C. getitem() D. all of these
10 i) Find the invalid identifier from the following
A.none B. address C. Name D. pass
ii) Choose odd one out : -
A.except B.with C.Import D.else
11 i) Which of the following is the correct way to call a function?
A. my_func() B.def my_func() C. return my_func D.call my_func()
ii) What keyword would you use to add an alternative condition to an if statement?
A. else if B. elseif C. elif D.None of the above
12
i) Which line of code produces an error?
2
16 i) Write the output of the following:
def fun3(num1,num2):
for x in range(num1,num2):
if x%4==0:
print(x,end=' ')
fun3(10,20)
A. 10 12 16 20 B. 12 16 C. 12 16 20 D.16
ii) Write the output of the following:
a=(1, 2, 3, 2, 3, 4, 5)
print(min(a) + max(a) + A.count(2))
A. 13 B. 6 C.8 D.Error
17 i) What is printed by the following statements?
D1 = {"cat":17, "dog":6, "elephant":23, "bear":20}
print ("dog" in D1)
A. True B. False C. Error D. None
ii) Identify correct output
def fun3(a,b,c):
return a+1,b+2,c+3
t=fun3(10,20,30)
print(t)
A.11,22,33 B.11 22 33 C.(11, 22, 33) D.None
18 i) Which of the following creates a tuple?
A. tuple1=("a","b") B. tuple1[2]=("a","b") C. tuple1=(5)*2 D.None of the above
ii) What will be the result of the following code?
dict = {"Jo" : 1, "Ra" : 2}
dict.update({"Ph":2})
print (dict)
A. {"Jo":1,"Ra" :2, "Ph" : 2} B. {"Jo":1,"Ra":2} C. {"Jo":1,"Ph" :2} D. Error
x=2
whilex<9:
print(x, end='')
x=x+1
A.12345678 B.123456789 C.2345678 D.23456789
ii) Write the list comprehension for producing a list of numbers between 1 and 20 that are even numbers.
x = 'abcd'
for i in range(len(x)):
print(I,end=’ ‘)
A. a b c d B. 0 1 2 3 C. error D. 1 2 3 4
4
26 i) Which one of the following is the default extension of a Pythonfile?
A. .exe B. .p++ C. .py D. .p
Ii) Choose correct statement .
A. Default values overrides the values passed by the user
B. Default argument are declared before the positional argument
C. Values passed by user overrides the default values
D. All are correct
27 i) Which of the following symbol is used in Python for single line comment?
A. / B. /* C. // D. #
ii) Consider the following code and choose the correct answer .
def nameage(name=”kishan”, age=20):
return age,name
t=nameage(20,”kishan”)
print(t[1])
B. Kishan B. 20 C. (kishan, 20) D. (20,kishan)
28 i) What does strip() function do?
A. Removes the trailing or leading spaces, if any. B. Deletes the file
C.Remove the file object D. Removes all the spaces between words
ii) What will be the output of below Python code?
tuple1=(5,1,7,6,2)
tuple1.pop(2)
print(tuple1)
A. (5,1,6,2) B. (5,1,7,6) C. (5,1,7,6,2) D. Attribute error
29 i) 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 aren’t ordered
D. Dictionaries are mutable
ii) Dictionaries are ____ set of elements
A. Sorted B. ordered C. unordered D.random
30 i) Predict the output of the following code
def func1(list1):
for x in list1:
print(x.lower(),end='#')
func1(['New','Dehli'])
A. [New,Dehli] B. new#dehli# C. newdehli# D. New#Dehli#
ii) Identify correct output for the followingcode.
def fun4(a,b=100):
total=a+b
print(total)
fun4(50,20)
A.100 B. 120 C. 150 D. 70
31 What will be the output of the following code?
value = 63
def display(N):
global value
value = 36
if N%7==0:
value = value + N
else:
value = value - N
print(value, end="#")
display(20)
5
print(value)
import random
List=["12A","12B","12C","12D"]
for y in range(4):
x = random.randint(1,3)
print(List[x],end="#")
A. 12D#12B#12D#12D# B. 12C#12D#12B#12B#
C. 12D#12B#12B#12C# D. 12A#12B#12B#12C#
6
36 i) What is the output of the code shown below?
l1=[1,2,3]
l2=[4,5,6]
l3=[7,8,9]
for x, y, z in zip(l1, l2, l3):
print(x, y, z)
A) 1 4 7 B) (1 4 7) C) [(1, 4, 7), (2, 5, 8), (3, 6, 9)] D) Error
258 (2 5 8)
369 (3 6 9)
a = [0, 1, 2, 3]
for a[0] in a:
print(a[0],end=” ”)
A. 0 1 2 3 B. 0 1 2 2 C. 3 3 3 3 D.error
x=12
def f1(a,b=x):
print(a,b)
x=15
f1(4)
A. Error B. 12 4 C.4 12 D. 4 15
38 i) Evaluate the following expression and identify the correct answer.
16-(4+2) *5 + 2**3*4
A. 54 B. 46 C. 18 D. 32
ii) Evaluate the following expression and identify the correct answer.
7-23%2*12+6
A. 1 B.18 C.17 D.-5
39 What will be the output of the following code?
def my_func(var1=20, var2=15):
var1+=10
var2 = var2-10
return var1+var2
print(my_func(50),my_func())
A. 65 35 B. 33 65 C. (35,65) D. (33,65)
40 i) What is the output of the following piece of code?
a={1:"A",2:"B",3:"C"}
print(a.get(1,4))
A. 1 B. A C.4 D.Invalid syntax for get method
7
ii)
a={1:"A",2:"B",3:"C"}
b={4:"D",5:"E"}
a.update(b)
print(a)
A. {1: ‘A’, 2: ‘B’, 3: ‘C’} B. Method update() doesn’t exist for dictionaries
C. {1: ‘A’, 2: ‘B’, 3: ‘C’, 4: ‘D’, 5: ‘E’} D.{4: ‘D’, 5: ‘E’}
C. D.NONE
600 # 20.0
20.0 $ 30
930 # 30.0
20.0 $ 30.0
620.0 # 20.0
20.0 $ 30.0
>>>
46 Identify the list at the end of third pass of insertion sort for the given list of numbers which gets sorted in
ascending order.
L=[16,-16,86,0,24,14]
A) [-16, 0, 86, 16, 24, 14] B) [-16, 0, 14, 16, 24, 86]
C) [-16, 0, 16, 86, 24, 14] D) NONE
9
print(x,end='')
print(x, end=' ')
myfunc()
print(x,end='')
A.3 33 B.3 45 C.3 35 D.3 55
48 i) The time complexity of the bubble sort and insertion sort technique is ____
A)1 B) 2 since it has two loops
2
c) n D) NONE
50 i) Identify the list at the end of fourth pass of bubble sort for the given list of numbers which gets sorted in
ascending order.
L=[12,-13,4,6,24,100]
A) [-13, 12, 4, 6, 24, 100] B) [-13, 4, 12, 6, 24, 100]
C) [-13, 4, 6, 12, 24, 100] D) NONE
10
ii) Find and write the output of the following python code:
NAME="VaRiAbLe"
N=""
for x in range(len(NAME)):
if NAME[x].islower():
N=N+NAME[x].upper()
elif NAME[x].lower():
if x%2==0:
N=N+NAME[x].lower()
else:
N=N+NAME[x-1]
print(N)
A. vArIaBlE B. VaRiAbLe C. VARIABLE D. none
52 i) What possible output(s) are expected to be displayed on screen at the time of execution of the
program from the following Python code?Also specify the minimum values that can be assigned to
each
of the variables BEGIN and LAST.
import random
VALUES=[40,50,60,70,80];
BEGIN=random.randint(1,3)
LAST=random.randint(BEGIN,4)
for I in range(BEGIN,LAST+1):
print(VALUES[I],"-",end="")
A. 60 -70 -80 B. 60 -70 -80 – C. 60 _70 -80 – D.None
A. 45 B. 20 C. 45 20 D.NONE
20 45
53 i)
def C2F(c):
return c * 9/5 + 32
print (C2F(100))
print (C2F(0))
A. 212 B.314 C.567 D. None of the mentioned
32 24 98
ii)
def sum(*args):
"""This is the sample text"""
r=0
11
for i in args:
r+=i
return r
print (sum.__doc__)
print (sum(1, 2, 3))
print (sum(1, 2, 3, 4, 5))
A. 6 B. 6 C.123 D. None of the above
15 100 12345
54 i) What possible output(s) are expected to be displayed on screen at the time of execution of the
program from the following Python code?Also specify the minimum values that can be assigned to
each
of the variables Start and End.
import random
VAL=[60,50,40,30,20,10]
Start=random.randint(1,3)
End=random.randint(Start,4)
for I in range(Start,End+1):
print(VAL[I],"*",end="")
a. 30 *20 b. 20 30 * c. 20 *30 * d. 30 *20 *
ii)
def Mycode(Msg,C):
M=""
for i in range(len(Msg)):
if"B"<=Msg[i]<="H":
M=M+Msg[i].lower();
elif Msg[i]=="A" or Msg[i]=="a":
M=M+C;
elif i%2==0:
M=M+Msg[i].upper()
else:
M=M+Msg[i-1]
print(M)
text="LOADER";
Mycode(text,"#")
A. B.
L L
LL LL
LL# LL#
LL#d LL#d
LL#de LL#de
LL#deE
C. D.NONE
LL
LL#
LL#d
LL#de
LL#deE
12
55 i) Write the output:
def sample(**args):
try:
for i in args:
i=i*3
args[i]="new"
print(args,end='')
except:
print("\ncompleted")
sample(x=10,y=20,z=10)
def sample1(*s):
print(sum(s))
sample1(2,-3,4)
sample1(4,5)
sample1(56,3,-12)
13