12A CS 2023-24
12 COMPUTER SCIENCE – 2023-24
1 Mark Questions with Solution
1 State True or False:
Loop’s else statement is executed only if the loop terminates forcefully using break statement. False
If D=(1,2,3) What will be the data type of D?
a)List b)tuple c)set d)invalid type
2 What will be the output of the following statement:
6<10 or not (30>20) and 10>20 True
3 ____________ protocol provides access to command line interface on a remote computer
a) FTP b) PPP c) SMTP d) Telnet
4 Which of the following functions will return the value 4 if the argument passed to the function is
3.256
a.round() b.math.ceil() c.math.floor() d.abs()
5 Select the correct output of the code:
a = "HALF YEARLY EXAM 2023"
a = a.split(maxsplit=1)
b = str(a[1])
print (b.partition('EXAM'))
Options:
a. ['YEARLY ', 'EXAM', ' 2023']
b. ('HALF YEARLY ', 'EXAM', ' 2023')
c. ('YEARLY ', 'EXAM', ' 2023')
d. ('YEARLY ', ' 2023')
6 A_________can be skipped in the function call statements
a) named parameter b) default parameter
c) keyword parameters d) all of the above
7 Which command is used to change the structure of the table in a database?
a.DELETE b.UPDATE c.ALTER d.MODIFY
8 What will be the output of the following code:
Staff={"name":"john","salary":10000,"dept":"sales","age":34,}
print(Staff.keys())
a. dict_keys(['name', 'salary', 'dept', 'age'])
[1]
12A CS 2023-24
b. dict_keys(('name', 'salary', 'dept', 'age'))
c. ['name', 'salary', 'dept', 'age']
d. ('name', 'salary', 'dept', 'age')
9 State whether the following statement is True or False:
A ValueError occurs due to wrong indentation in a program. False
10 Consider the statements given below and then choose the correct output from the given options:
s= "CLASS XII 2023"
s1=s[-3::-2]
print('#'.join(s1))
Options:
a. #0 #I #S#L
b. #0 #I #S#L
c. 0##I##S#L
d. 0# #I# #S#L
11 Which of the following statements would give the output as :
(10,12,14,16)
Options:
a. print(tuple(x for x in range(10,20) if x%2==0 and x<17))
b. print((x for x in range(10,20) if x%2==0 and x<17))
c. print(tuple(for x in range(10,20) if x%2==0 and x<17))
d. print((for x in range(10,20) if x%2==0 and x<17))
12 State whether the following statement is True or False:
The degeneration of a signal over a distance on a network is called attenuation. True
13 What possible outputs(s) will be obtained when the following code is executed
import random
s="ALL THE BEST FOR BOARD EXAM"
number=random.randint(0,3)
n=26
while s[n]!= 'E':
print(s[n]+s[number]+'#',end='')
number=number+1
n=n-1
[2]
12A CS 2023-24
Options:
a. MA#AL#X #
b. ML#AL#X #
c. ML#AL#XT#
d. MA#AL#XT#
14 Which of the following functions/methods is a fruitful function in Python
a.print() b.seek() c.tell() d.lower()
15 Identify the module to which the following function load () belong to?
a) math b) random c) pickle d) sys
16 The measuring unit of bandwidth is ________
a.Baud b.Bps c Hertz . d.bps
17 The statement which is used to get the number of rows fetched by
execute() method of cursor:
a) cursor.rowcount b) cursor.rowscount()
c) cursor.allrows() d) cursor.countrows()
18 Which of the following is not a type conversion functions?
a) int() b) str() c) input() d) float()
19 Which of the following is considered as a DBMS?
a.Oracle b.Access c.SQL Server d.All of these
20 Fill in the blank:
______________is the service to store and maintain websites on the world wide web. Webhosting
21 pow( ) function belongs to which library ?
a) math b) string c) random d) maths
22 If Cardinality of relation is 5 that means the relation has
a.5 tuples b.5 attributes c.5 tables d.5 degree
23 The of a variable is the area of the program where it may be referenced
a) external b) global c) scope d) local
24 Assertion(A): The data type of a variable is taken according to the type of value assigned to it.
Reasoning( R): In Python, data type of the variable dynamic.
(a) Both A and R are true and R is the correct explanation for A
[3]
12A CS 2023-24
25 Assertion(A): Python supports multiple execution mode
Reasoning( R): The script mode allows the user to execute one statement at a time, while the
interactive mode allows to execute a file containing multiple statements.
(c) A is True but R is False
Given the following dictionaries 1
26 dict_fruit={"Kiwi":"Brown", "Cherry":"Red"}
dict_vegetable={"Tomato":"Red", "Brinjal":"Purple"}
Which statement will merge the contents of both dictionaries?
a) dict_fruit.update(dict_vegetable) b) dict_fruit + dict_vegetable
c) dict_fruit.add(dict_vegetable) d) dict_fruit.merge(dict_vegetable)
27 Select the correct output of the code: 1
for i in "QUITE":
print([i.lower()], end= "#")
(a) q#u#i#t#e# (b) [‘quite#’]
(c) ['q']#['u']#['i']#['t']#['e']# (d) [‘quite’] #
28. Network in which every computer is capable of playing the role of a client, or a server or 1
both at same time is called
a)local area network b)peer-to-peer network
c)dedicated server network d)wide area network
29 What will be the Output for the following code – 1
Language=["C", "C++", "JAVA", "Python", "VB", "BASIC", "FORTRAN"]
del Language[4]
Language.remove("JAVA")
Language.pop(3)
print(Language)
a) ['C', 'C++', 'VB', 'FORTRAN'] b) ['C', 'C++', 'Python', 'FORTRAN']
c) ['C', 'C++', 'BASIC', 'FORTRAN'] d) ['C', 'C++', 'Python', 'BASIC']
30 1
The method seek() returns_______________
a) an integer b) a file object c) a record d) None
31 1
What will be output of the following code:
d1={1:2,3:4,5:6}
d2=d1.popitem()
print(d2)
a) {1:2} b) {5:6} c) (1,2) d) (5,6)
[4]
12A CS 2023-24
32
____________ protocol provides access to command line interface on a remote
computer
a) FTP b) PPP c) SMTP d) Telnet
33 The correct syntax of seek() is: 1
(a) file_object.seek(offset [, reference_point])
(b) seek(offset [,reference_point])
(c) seek(offset, file_object)
(d) seek.file_object(offset)
Q34 and 35 are ASSERTION AND REASONING based questions. Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d)A is false but R is True
34 Assertion (A): If L is a list, then L+=range(5)is an invalid statement. 1
Reason (R): Only a list can be concatenated to a list.
(d)A is false but R is True
35 Assertion (A):- The number of actual parameters in a function call may not be equal to the 1
number of formal parameters of the function.
Reasoning (R):- During a function call, it is optional to pass the values to
default parameters.
(a) Both A and R are true and R is the correct explanation for A
36. State True or False: “In a Python program, if a break statement is given in a nested loop, it
terminates the execution of all loops in one go.”
Ans: False
37. Which of the following is not part of a DDL query?
a) DROP
b) DISTINCT
c) MODIFY
d) ADD
38. Identify the DDL Command from the following
a. Create b. Delete c. Select d. upper
Ans: Create
Page 5 of 10
12A CS 2023-24
39. What will be the output of the following statement:
print(3+2**3**2+99/11)
a. 524 b.524.0 c.0 d. Error
Ans: 524.0
40. Select the correct output of the code:
s="2020"
print("-".join(s))
a. -2020 b. 2-0-2-0 c.2020-d.
Ans. 2-0-2-0
41. Which switching technique follows the store and forward mechanism?
a)Circuit switching b) message switching c) packet switching d) All of these
42. In MYSQL database, if a table, Alpha has degree 4 and cardinality 3, and another table,
Beta has degree 3 and cardinality 5, what will be the degree and cardinality of the Cartesian
product of Alpha and Beta?
a. 4,3 b. 7,15 c. 3,4 d. 15,7
Ans: 15,7
43. Which of the following is a valid identifier in Python:
a) elseif b) for c) pass d) 2count
44. Sachin wants to transfer pictures from his mobile phone to his laptop. She uses Bluetooth
Technology to connect two devices. Which type of network will be formed in this case?
a. PAN b. LAN c. MAN d. WAN
Ans: PAN
45. Which of the following will delete key-value pair for key = “Apple” from a
dictionary D1?
a. delete D1("Apple")
b. del D1["Apple"]
c. del.D1["Apple"]
d. D1.del["Apple"]
Ans: del D1["Apple"]
46. What will the following expression be evaluated to in Python?
print ( round (100.0 / 4 + (3 + 2.55) , 1 ) )
a) 30.0 b) 30.55 c) 30.6 d) 31
47 Consider the statements given below and then choose the correct output
from the given options:
org="Chandryan"
print(org[-2:2:-2])
a. arn b. nra c. nay d. Error
Ans: arn
Page 6 of 10
12A CS 2023-24
48. Which of the following statement(s) would give an error during execution of
the following code?
tup = (2,3,4,50,80,79)
print(tup) #Statement 1
print(tup[3]+50) #Statement 2
tup[4]=80 #Statement 3
print(max(tup)) #Statement 4
Options:
a. Statement 1
b. Statement 2
c. Statement 3
d. Statement 4
Ans: Statement 3
49. What possible outputs(s) will be obtained when the following code is
import random
AR=[200,300,400,500,600,700]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print (AR[K],end=”#“)
(i) 100#400#700# (ii) 300#400#500# (iii) 500#600#700# (iv) 400#500#700#
Ans: 300#400#500#
50. Two routers with direct connection communicate using ______
a. HTTP b. PPP c.Pop3 4. None of these
Ans: PPP
51. Consider the code given below:
def fun():
___________________# Missing Statement
wish=wish+" High"
wish="Fly"
fun()
print(wish)
Which of the following statements should be given in the blank for #Missing Statement, to
get the output Fly High
a. global wish
b. global Fly
c. global High
d. Fly High
Ans: . global wish
52. Given the following Tuple: Tup= (10, 20, 30, 50)
Which of the following statements will result in an error?
a) print (Tup [0] ) b) Tup . insert (2, 3)
c) print (Tup [1 : 2] ) d) print (len (Tup) )
Page 7 of 10
12A CS 2023-24
53. State whether the following statement is True or False:
Open a file using with clause closes the file automatically if an exception occurs also.
Ans: True
54. Which of the following statements is FALSE about Primary Key
a. Any candidate key is eligible to become a primary key
b. Primary key in a relation is used for unique identification of tuples
c. NULL is allowed in primary key
d. A foreign key is an attribute whose value is derived from the primary key of another
relation
Ans: NULL is allowed in primary key
55. Registered Jack-45 is an _________pin connector
8
56. Which of the following command will add primary key in a table ?
a) Alter table stock added primary key(S_Id)
b) Alter table stock add primary(S_Id)
c) Alter table stock add primary key(S_Id)
d) Alter stock add primary key(S_Id)
57. CSV files are opened with __________argument to supress EOL translation
newline
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct
choice as
(a) Both A and R are true and R is the correct explanation for A
(b)Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d)A is false but R is True
58. State True or False:
Dictionaries will always have at least one key and value pair. False
59. Assertion(A): String is an immutable data type Reasoning(R): When an attempt is made to
update the value of an immutable variable, the old variable is destroyed and a new variable
is created by the same name in memory
Ans: A is True but R is False
60. Assertion(A): dump() method is used to write the objects in a binary file.
Reasoning(R) :dump() converts the object into a byte stream
Ans: Both A and R are true and R is the correct explanation for A
61. Which of the following is not a keyword?
a) Eval b) assert c) nonlocal d) pass
Page 8 of 10
12A CS 2023-24
62. What is the order of precedence in python?
(i) Parentheses ii) Exponential iii) Multiplication iv) Division v) Addition
vi) Subtraction
a) i,ii,iii,iv,v,vi
b) ii,i,iii,iv,v,vi
c) ii,i,iv,iii,v,vi
d) i,ii,iii,iv,vi,v
63. What will be the value of X in the following Python expression?
X = 2+9*((3*12)-8)/10
a) 30.0 b) 30.8 c) 28.4 d) 27.2
64. Which of the following can be used as valid variable identifier(s) in Python?
a) total b) 7Salute c) Que$tion d) global
65. Which of the following statement is correct for an AND operator?
a) Python only evaluates the second argument if the first one is False
b) Python only evaluates the second argument if the first one is True
c) Python only evaluates True if any one argument is True
d) Python only evaluates False if any one argument is False
66. Which point can be considered as difference between string and list?
a.Length c. Indexing and Slicing
b.Mutability d. Accessing individual elements
67. Which of the following statement is true for extend () list method?
a) adds element at last c) adds multiple elements at last
b) adds element at specified index d) adds elements at random index
68. The statement del l[1:3] do which of the following task?
a) delete elements 2 to 4 elements from the list
b) delete 2nd and 3rd element from the list
c)deletes 1st and 3rd element from the list
d)deletes 1st, 2nd and 3rd element from the list
69. If l=[11,22,33,44], then output of print(len(l)) will be
a)4 b)3 c) 8 d) 6
70. The step argument in range() function .
a) indicates the beginning of the sequence
b) indicates the end of the sequence
c) indicates the difference between every two consecutive numbers in the
sequence
d) generates numbers up to a specified value
Page 9 of 10
12A CS 2023-24
71. Consider the following code
L=[‘a’,’b’,’c’,’d’]
L.pop(-1)
print(L)
What would be the output?
a)’d’ b)[‘a’,’b’,’c’,’d’] c)[‘a’,’b’,’c’] d)error
72. What is the output when the following code is executed?
>>>name=[‘Aadi’,’Beena’,’Charlie’,’David’]
>>>print(name[-1][-1])
a)’d’ b)’D’ c)’i’ d)Charlie
73. T=(“See You”)
What is the data type of T?
a)tuple b)string c)List d)set
74. Assertion(A):After adding element in a list, its memory location remains same
Reason(R):List is a mutable data type
a)Both A and R are True and R is the correct explanation for A
b) Both A and R are True and R is not the correct explanation for A
c)A is True but R is False
d)A is False but R is True
75. Assertion(A):An identifier may be combination of letters and numbers.
Reason(R):No special symbols are permitted in an identifier name
a)Both A and R are True and R is the correct explanation for A
b) Both A and R are True and R is not the correct explanation for A
c)A is True but R is False
d)A is False but R is True
75 MCQ’s HY Final Revision
All the Best
Page 10 of 10