Welcome to the Sample Question Paper-1 for Class 12 Computer Science.
1) State True or False:-
"In python, A line begins with symbol # is executed first"
Ans:- False
2) Which of the following is un-ordered sequence.
Ans:- (b) Dictionary
3) Consider the given expression, and say which of the following will be the correct ouput of the given expression is evaluated?
73<40 or 16>13 and not 5==5 or 15>5
Ans:- (a) True
4) In a relational model, tables are called _____, that stores data for different columns.
Ans:- (c) Relation
5) Choose the correct output for the following
Mystr="Vikasit Bharat"
print(Mystr[:3] + "#" + Mystr[-3:-6:-1])
Ans:- (d) Vik#rah
6) Which is invalid statement -
Ans:- (d) print("hello" + 3)
7) What will be the output of the following command.
print(6+10/10+8)
Ans:- (d) 15.0
8) The execution of below code will result?
def abc():
a=10
print(a, end="#")
Ans:- (d) NameError
9) Which is not a valid built in function of Dictionary?
Ans:- (d) index()
10) Which output is not possible if below code is executed?
import random
S="Viksit Bharat Buildathon"
for x in S.split():
i=random.randint(0,1)
print(x[i], end="#")
Ans:- (d) V#i#B#
11) Cardinality of a SQL table means
Ans:- (a) Total rows of table
12) What will be the output of below code
def valchange(n):
n=n-10
print(n, end="#")
n=100
valchange(n)
print(n)
Ans:- (c) 90#100
13) What will be the output of the following given code?
Mesg="command"
MyList=Mesg.split("m")
print(MyList)
Ans:- (a) ['co', '', 'and']
14) What will be the output of the below code
try:
a=int("ten")
except:
print("wrong code", end"$")
else:
print("correct code", end="$")
finally:
print("ok")
Ans:- (a) Wrong code$ok
15) In SQL, which command add a new record at last
Ans:- (b) insert
16) Which of the following is not a DDL command
Ans:- (b) update
17) What is standard rate of data transfer in Network
Ans:- (b) bits per second(bps)
18) Expand the term WWW _______
Ans:- World Wide Web
19) Correct name is WiFi is
Ans:- (b) Wireless Fidelity
20) Assertion (A): In Python, a stack can be implemented using a list. Reason (R): A stack works on the principle of First In First Out(FIFO)
Ans:- (c) A is True but R is False
21) Assertion (A): In Python-Mysql connectivity, we need to import python.mysql.connector module Reason (R): This connector module is needed for exchanging data between python and Mysql
Ans:- (a) Both A and R are true and R is the correct explanation of A.
22) Predict the output of the following command
(i)type((10))
(ii)type([10])
Ans:-(i) < class 'int'>
(ii) < class 'list'>
OR
How many times the following loop will run
Course="AI Vidaset 1.0"
for I in Course:
if I.isalpha():
pass
else:
break
Ans:-
The loop will run 7 times.
23) Identify the error in the following code and rewrite it, underlining the correction made.
def test():
for x in range(5):
if x%2==0:
print(x)
else:
return
Ans:-
def test():
for x in range(5):
if x % 2 == 0:
print(x)
else:
continue
24) (A) Write python code for the following statement
(i) Print the last character of a string stored into a variable MyString
(ii) Print the first occurrence of character 'e' stored into a string variable named MyName
#question (i)
MyString = "Vikasit Bharat"
print(MyString[-1])
#question (ii)
MyName = "The Developer"
try:
index_of_e = MyName.index('e')
print(MyName[index_of_e])
except ValueError:
print("Character 'e' not found in MyName.")
OUTPUT:- (i)Ek Bharat Shresth Bharat (ii)Ek bharat shresth bharat