Cs CT Question Paper
Cs CT Question Paper
Cs CT Question Paper
Write the module that need to be imported to execute the function dump():
5 1
a)random b)csv c)mysql.connector d)pickle
Given the list L=[-1,4,6,-5] ,write the output of print(L[-1:-3])
6
a)[4,6,-5] b)[] c)[6,-5] d)error
What will be the output of following:
x,y=10,5
7 x,y=y,x 1
print(x,y)
a) 10,5 b)5 10 c) 5,10 d)10 5
A function can return ------number of values
8 1
a)0 b)None c)Many d)2
The default file open mode is-----------mode
9 1
a)r b)r+ c)w d)a
Which of the following is/are mutable data type?
10 1
a)int b)string c)list d)tuple
Which operator in SQL is used to compare a value to a specified list of
11 values 1
a)BETWEEN b)= c)IN d)ALL
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 253
Which of the following is not an aggregate function?
12 1
a)MIN() b)SUM() c)UPPER() d)COUNT()
Which keyword is used to eliminate duplicate values in an SQL select query?
13 1
a)unique b)distinct c)key d)all
Which of the following network device is a broadcasting device
14 1
a)switch b)hub c)gateway d)router
What is the degree of the following relation?
slno dateofadmn class
15 1 2022-06-05 V 1
2 2022-08-23 VIII
a)3 b)5 c)2 d)1
If all devices are connected to a central hub, then topology is called
16 1
a)tree topology b)bus topology c)star topology d)mesh topology
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
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 254
b) a=5
print(a+4<10)
22 What is scope? What is the scope resolving rule in python? 2
(a)Expand the following terms:
23 i)MAN ii)HTML 2
b)What is URL ?
Write output for the following code.
def encrypt(str):
str1=""
for i in str:
if i.isupper():
str1+=i.lower()
else:
str1+="*"
return str1
s=encrypt("HeLLo")
print(s)
24 2
or
Go through the python code shown below and find out the possible
output(s) from the suggested options i to iv. Also specify maximum and
minimum value that can be assigned to the variable j.
import random
i=random.random()
j=random.randint(0,6)
print(int(i),”:”,j+int(i))
(i)0:0 (ii)0:6 (iii)1:7 (iv)1:6
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 255
CUSTOMER
CCode CName VCode
Hemant
1 Sahu 101
2 Raj Lal 108
Feroza
3 Shah 105
4 Ketan Dhal 104
a)What will be the output of following statement?
select VehicleName,Capacity from Cabhub c, Customer s where
c.Vcode=s.Vcode and c.capacity<4;
b)Write the output of the queries (i) to (iv) based on the table CABHUB
i) select count(VCode),Color from CABHUB group by Color;
ii) select distinct capacity from Cabhub;
iii) select min(Charges),max(charges) from CABHUB;
iv) select VehicleName,Make from CABHUB order by VehicleName
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 256
L05 21
Write a function SUMNOS() that accept a list L of numbers and find sum of
all even numbers and sum of all odd numbers.
If L=[1,2,3,4],
29 3
Output :
sum of even nos:6
Sum of odd numbers:4
A stack S contains Name of countries.Write a function POP(A), to remove
Name from stack. Function should handle underflow condition and should
return removed element.
30 OR 3
Write a function PUSH(STACK,Name) to add new name to the STACK data
structure . Also display all the names having at least 4 characters from the
stack.
SECTION D
“Learn Together” is an educational NGO. It is setting up its new campus at
Jabalpur for its web based activities. The campus has 4 compounds as shown
in the diagram below:
Z
Y
Building
Building
W
X
Building Building
31 5
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 257
Z Building to W Building 35 m
Y Building 15
Z Building 5
W Bulding 20
a) Suggest the most suitable place (i.e. building) to house the server of
this organisation with a suitable reason.
(i) Repeater
(ii) Hub/Switch
RollNo – integer
Name – string
Marks – integer
Address –String
Phone-integer
Note the following to establish connectivity between Python and MYSQL:
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 258
Username is root
Password is root
The table exists in a MYSQL database named school.
The details (RollNo, Name, Marks,Address,Phoneno) are to be
accepted from the user.
Write the following missing statements to complete the code:
Statement 1 – to establish connection to the database
Statement 2 – to execute the command that inserts the record in the table
Student. Statement 3- to add the record permanently in the database
OR
a)Predict the output of the following
def student(firstname, lastname ='Mark', standard ='Fifth'):
print(firstname, lastname, 'studies in', standard, 'Standard')
student("John")
student('George','Jose','Seventh')
b) The code given below reads the following record from the table named
student and displays only those records whose address is ‘Delhi’ RollNo –
integer Name – string , Marks – integer ,Address-string,Phone-integer
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 259
Statement 3- to read the complete result of the query (records who are from
“Delhi”) into the object named r, from the table student in the database
What are the characteristics of csv file ? Write a Program in Python that
defines and calls the following user defined functions:
When do we use csv file?. Write a Program in Python that defines and calls
the following user defined functions:
SECTION E
Advaith,a manager has stored the details of departments in a table called
DEPARTMENT.
DEPTNO DNAME LOC
----- -------------- --------
34 10 ACCOUNTING NEW YORK 1+1+2
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 260
He wants to add one more record to this table and has written the following
code and unable to insert that record.
INSERT INTO DEPARTMENT VALUES(43,”HRD”);
i. Help him to correct the code for adding the record
ii. How can he restrict Null values in the table
iii. Write a commands to :
a. show the names of department starting with “R”.
b.update LOC as “New York” for DEPTNO 30.
OR(Option for part iii only)
iii.Write a commands to :
a.insert the following record into the table:DEPTNO-47,DNAME-
Accounting,LOC-Paris
b.delete the records of location(LOC) “Boston”
Manju has created a program using two functions for storing his friends’
exam roll numbers and marks in a binary file “STUDENT.DAT” and to display
total mark.But he forgot some lines of code. As a programmer, help him to
complete the task and to run the program successfully.
______________________ #Line 1
def create_File():
f=open(“STUDENT.DAT”,”ab”)
rollno=int(input(“Enter roll number”))
m1=int(input(“Enter Mark1”))
m2=int(input(“Enter Mark2”))
m3=int(input(“Enter Mark3”))
d={“rollno”:rollno,”M1”:m1,”M2”:m2,”M3”:m3}
pickle._______(d,f) #Line2
f.close()
35 s={} 4
def read_File():
with open(“STUDENT.DAT”,”rb”) as f:
try:
while True:
s=__________________ #Line3
t=s[“M1”]+s[“M2”]+s[“M3”]
print(“RollNo:”,s[rollno],”Total Mark:”,t)
except:
______________________ #Line 4
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 261
KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION
Sample Paper-3(SOLUTION)
SUB: COMPUTER SCIENCE
CLASS XII
Q.NO PART A Marks
Section -A
1 d)= 1
2 a)bool 1
3 d)class 1
4 d)both b and c 1
5 d)pickle 1
6 b)[] 1
7 b)5 10 1
8 c)Many 1
9 a)read 1
10 c)list 1
11 c)IN 1
12 c)UPPER() 1
13 DISTINCT 1
14 b)hub 1
15 a)3 1
16 c)star topology 1
17 b 1
18 c 1
Section-B
19 x=10 2
for I in range(a):
if I%3==0:
print(I)
else:
pass
or
What are routers?.
A router is a network device that can receive the data , analyse it and
transmit it to other networks . It is used to connect a Local Area Network to
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 262
the internet. Using a routing table, it ensures that data packets are travelling
through the best suitable paths to their destinations.
In simple words, a gateway is a device that we use for communicating among
various networks possessing different protocol sets. It is responsible for
converting a given protocol to another one.Gateway connects dissimilar
network
21 a)32 1+1
b) True
23 a)MAN –Metropolitan Area Network b)HTML –Hyper Text Mark up Language 1+1
URL stands for Uniform Resource Locator. A URL is nothing more than the
address of a given unique resource on the Web.
24 h*ll* 2
OR
minimum-0
maximum -1
options(i) and (ii)
25 1. Order By : 2
Order by keyword sort the result-set either in ascending or in descending
order. This clause sorts the result-set in ascending order by default. In
order to sort the result-set in descending order DESC keyword is used.
Order By Syntax –
SELECT column_1, column_2, column_3...........
FROM Table_Name
ORDER BY column_1, column_2, column_3....... ASC|DESC;
2. Group By :
Group by statement is used to group the rows that have the same value. It
is often used with aggregate functions for example:AVG(), MAX(), COUNT(),
MIN() etc. One thing to remember about the group by clause is that the
tuples are grouped based on the similarity between the attribute values of
tuples.
Group By Syntax –
SELECT function_Name(column_1), column_2
FROM Table_Name
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 263
WHERE condition
GROUP BY column_1, column_2
ORDER BY column_1, column_2;
OR
26 a) 1+2
Vehicle Capacity
A-Star 3
Indigo 3
b)
I)
count(vcode) color
2 WHITE
1 BLUE
1 RED
1 SILVER
II)
distinct capacity
7
4
3
III)
min(charge) max(charge)
12 35
iv)
Vehicle Name Make
A-Star Suzuki
C Class Mercedes
Indigo Tata
Innova Toyota
SX4 Suzuki
27 def countA(): 3
file=open("ABC.txt",'r')
r=file.read()
s=r.split()
count=0
for i in s:
if i[-1]=='n':
count+=1
file.close()
print("Count of words ending with “n” is", count)
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 264
OR
def printnum():
file=open("an.txt",'r')
r=file.read()
for i in r:
if i.isdigt():
print(i)
file.close()
28 a)i) 2+1
TOTAL_PRICE
435
ii)
BookName AuthorName
Science Agarkar
Telugu Nannayya
iv)
b)DESC BOOKS
29 def SUMNOS(L): 3
SE=0
SO=0
for i in L:
if i%2==0:
SE+=i
else:
SO+=i
print(“Sum of Even no:s=”,SE)
print(“Sum of Odd no:s=”,SO)
30 def POP(A): 3
if len(A)==0:
print(“UNDERFLOW”)
else:
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 265
val=A.pop()
return val
OR
Write a function PUSH(STACK,Name) to add new name to the STACK data
structure . Also display all the names having atleast 4 characters from the
stack.
def PUSH(STACK,Name):
STACK.append(Name)
#code for displaying
if len(STACK)==0:
print(“Empty stack”)
else:
top=len(STACK)-1
for i in range(top,-1,-1):
if len(STACK[i])>=4:
print(STACK[i] )
31 a) The most suitable place / block to house the server of this organisation 5(1
would be X Building, as this block contains the maximum number of each)
computers, thus decreasing the cabling cost for most of the computers as well
as increasing the efficiency of the maximum computers in the network.
b)
Answer:
Layout 1
Y Z
Buildin
W
X
Layout 2:
Y Z
Buildin
W
X
c)
Answer:
The type of network that shall be formed to link the sale counters situated in
various parts of the same city would be a MAN, because MAN (Metropolitan
Area Networks) are the networks that link computer facilities within a city.
d)
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 266
Answer:
(i) In layout1 between X&Z,X&W.In layout2 between Y and Z.Because
distance is more than 90m.
(ii) In both the layouts, a hub/switch each would be needed in all the
buildings, to interconnect the group of cables from the different
computers in each block
e)switch
def DISPLAY_PROD():
found=False
fin=open("record.csv","r",newline="\n")
data=csv.reader(fin)
for i in data:
if int(i[1])>100:
found=True
print(i[0],i[1])
if found==False:
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 267
print("Record not found")
fin.close()
ADD_PROD()
print(“Displaying product having price more than 100\n”)
DISPLAY_PROD()
OR
CSV file are useful when we need to import data into many other software
applications.
import csv
def inser_ROLL():
fout=open("marks.csv","a",newline="\n")
wr=csv.writer(fout)
rollno=int(input("Enter Roll number "))
mark=float(input("Enter mark :: "))
lst=[rollno,mark]
wr.writerow(lst)
fout.close()
def read_ROLL():
fin=open("marks.csv","r",newline="\n")
data=csv.reader(fin)
d=list(data)
print(“No.of records=”:,len(d))
for i in data:
print(i)
fin.close()
KVS RO EKM - STUDENT SUPPORT MATERIAL (COMPUTER SCIENCE-083) FOR THE ACADEMIC YEAR 2022-23 268