Class 12 Computer Science Section A

Objective Question and Answers 

Question 1.

State True or False
“A dictionary is ordered by index”.
Answer:
False

Question 2.
The module required to use the mode function is
(a) math
(b) statistics
(c) random
(d) Pandas
Answer:
(b) statistics

Question 3.
The output of print(math.ceil(17.34)) is
(a) 18
(b) 17
(c) 10
(d) 20
Answer:
(a) 18

Question 4.
Which function is used to generate a sequence of numbers overtime?
(a) range()
(b) len()
(c) limit()
(d) lim()
Answer:
(a) range()

Question 5.
Which of the following symbol is used in Python for comments?
(a) $
(b) @
(c) //
(d) #
Answer:
(d) #

Question 6.
State True or False
Digits are one of the parts of the Python character set.
Answer:
True

Question 7.
Which of the following are the most obvious kind of constants? 
(a) Keywords
(b) Literals
(c) Variables
(d) Identifiers
Answer:
(b) Literals

Question 8.
Which of the following operator cannot be used with string data type?
(a) +
(b) in
(c) *
(d) /
Answer:
(d)/

Question 9.
What is the output of the following code?

>>> a = 10
>>> b = 2
>>> print(a + 10 * 2 + b)

(a) 32
(b) 22
(c) 40
(d) 80
Answer:
(a) 32

Question 10.
What is the output of the following code?
num = 4 + float (7)/int (2.0)
print (“num =”, num)
(a) num 7.5
(b) 7.5
(c) num : 7.5
(d) Error
Answer:
(a) num=7.5

Question 11.
Given : s=”ComputerExam”. What will be the output of print(s[2]+s[8]+s[1:5])?
(a) mEOMUU
(b) mEompu
(c) mEomPU
(d) MEompu
Answer:
(b) mEompu

Question 12.
Given a list Lst= [65,182,90,420,20,10]. What will be the correct statement to take out the 3rd element from the list?
(a) Lst.pop(2)
(b) L.find(2)
(c) L.pop(-1)
(d) L.del(90)
Answer:
(a) Lst.pop(2)

Question 13.
What will be the output of the following Python code?
V = 25
def Fun (Ch) :
V=50
print (V. end=Ch)
V *= 2
print (V, end=Ch)
print (V, end=”*”) ;
Fun (“!”)
print (V)
(a) 25*50!100!25
(b) 50* 100!100!100
(c) 25*50!100!100
(d) Error
Answer:
(a) 25*50!100!25

Question 14.
In the following code, which lines will give error? (Assume the lines are numbered starting from 1.)
mul=3
value=10
for i in range (1, 6, 1): .
    if (value % mul = 0):
        print (value * multiply)
    else
        print (value + multiply)
(a) 4, 5
(b) 4,5,6
(c) 4,5,6,7
(d) No errors
Answer:
(c) 4,5,6,7

Question 15.
Which of the following will be the output of the statement given below?
print([12,34,56,78,90] . pop( ))
(a) 78
(b) 90
(c) 12
(d) 12,34,56,78,90
Answer:
(b) 90

Question 16.
State True or False
Integer is a mutable data type in Python.
Answer:
False

Question 17.
Which of the following operator performs an integer division?
(a) *
(b) //
(c) /
(d)**
Answer:
(b) //

Question 18.
Which of the following Python function displays the memory id of a variable?
(a) type()
(b) str()
(c) getid()
(d) id()
Answer:
(d) id()

Question 19.
Identify the output of the following Python statement.
b = 1
for a in range(1, 10, 2):
b += a + 2
print(b)
(a) 31
(b) 33
(c) 36
(d) 39
Answer:
(c) 36

Question 20.
Given s=”AISSE@2023”. What will be the output of
print (s [-1: : -1 ]) ?
(a) ‘3202@ESSIA’
(b) 3
(c) AISSE
(d) ESSIA
Answer:
(a) ‘3202@ESSIA’

Question 21.
Predict the output of the following program:

a = 5
b = a = 15
c = (a < 15)
print ("a = ”, a)
print (“b = ”, b)
print (“c = ”, c)

(a) a= 15
b=15
c=False
(b) a=15
b=10
c=True
(c) a=15
b=None
c=False
(d) None of these
Answer:
(a) a= 15
b=15
c=False

Question 22.
The Python function that adds a list at the end of another list is
(a) join()
(b) add()
(c) append()
(d) extend()
Answer:
(d) extend()

Question 23.
What will be the output of the following code snippet?
print(2**3 + (5 + 6)**(1 + 1))
(a) 129
(b) 8
(c) 121
(d) None of the above
Answer:
(a) 129

Question 24.
Which of the following declarations is incorrect in python language?
(a) xyzp=5,000,000
(b) x y z p=5000 6000 7000 8000
(c) x,y,z,p=5000, 6000, 7000, 8000
(d) x_y_z_p=5,000,000
Answer:
(b) 
x y z p=5000 6000 7000 8000


Question 25.
Which of the following statements is correct for variable names in Python language?
(a) All variable names must begin with an underscore.
(b) Unlimited length
(c) The variable name length is a maximum of 2.
(d) All of the above


Directions In the question numbers 26 and 27, a statement of Assertion (A) is followed by a statement of Reason (R). Choose the correct option.

Question 26.
Assertion (A) To use the randint() function, the random module needs to be included in the program.
Reason (R) Some functions are present in modules and to use them the respective module needs to be imported.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
Answer:
(a) Both A and R are true and R is the correct explanation of A.

Question 27.
Assertion (A) A Python function that accepts parameters can be called without any parameters.
Reason (R) Functions can carry default values that are used, whenever values are not received from calling function.
(a) Both A and R are true and R is the correct explanation of A.
(b) Both A and R are true but R is not the correct explanation of A.
(c) A is true but R is false.
(d) A is false but R is true.
Answer:
(a) Both A and R are true and R is the correct explanation of A.