Professional Documents
Culture Documents
MS-Computer Science-12-Common Exam
MS-Computer Science-12-Common Exam
Class-12
(COMPUTER SCIENCE - 083)
Roll No.: Maximum Marks: 70
Date: 12/01/2024 Time allowed: 3 hours
Marking Scheme
SECTION A
1 True 1
2 The “SHANMUGA RAJAN” name length is 14 characters, the actual width of Ename is 1
6 characters. So, Needs to increase the column width from 6 characters to 14 or more.
SQL command:
Alter table tablename/emp modify Ename varchar(14).
3 24.6 1
4 1
PNO NAME GENDER FNO START END F_DATE FARE
1001 Suresh MALE F104 KOLKATA MUMBAI 2021-12-20 4500
1001 Suresh MALE F105 DELHI BENGALURU 2021-01-12 5000
1002 Anita FEMALE F104 KOLKATA MUMBAI 2021-12-20 4500
1002 Anita FEMALE F105 DELHI BENGALURU 2021-01-12 5000
1003 Nita FEMALE F104 KOLKATA MUMBAI 2021-12-20 4500
1003 Nita FEMALE F105 DELHI BENGALURU 2021-01-12 5000
6 Microwave 1
7 print(200 in mydict.values()) 1
8 d) idnIen$ 1
9 b) (3, 4, 2) (1, 2) 1
10 b) ['G','Green']:['B','Blue']:['G','Green']: 1
d) ['I','Indgo']:['B','Blue']:['B','Blue']:
Each option carries 0.5 mark, if extra options are added, 0 Marks is awarded.
11 a) VoIP 1
12 c) global b 1
13 True 1
14 c) A candidate key that is not a primary key is a foreign key. 1
15 Router 1
16 Exception 1
19 a)[1mark] 2
Circuit switching Packet switching
First the complete physical It has a tight upper limit on block size
connection between two computer is
established and then data are A fixed size of packet which can be
transmitted from the source computer transmitted across the network is
to the destination computer. specified.
21 [Accept/assign=0.5mark,count+logic=1mark,sort=0.5mark] 2
def COUNT(d):
c=0
for a in d.keys():
if d[a][2]==2020:
c+=1
print("No of vehicles released in 2020:",c)
for a in sorted(d,key=d.get):
print(a,d[a],sep='\t')
d={'santro':['Hyndai','lts',2020,450000],'k7':['Ford','lts',2020,450000],'ATS':
['Maruthi','lts',2019,450000]}
COUNT(d)
OR
[Accept/assign=0.5mark,append+logic=1mark,return=0.5mark]
def INDEX_TUPLE(T):
indexlist=[]
for i in T:
if i!=0:
indexlist.append(T.index(i))
return indexlist
L=(12,4,0,11,0,56)
print(index(L))
b) [1mark]
Page 2 of 9
A database cursor is a special control structure that facilitates the row by row processing
of records in the result set. i.e., set of records retrieved as per query.
OR
a)
b)
16 [1mark]
24 a) [1mark] 2
Create table project_info(stud_roll int(3) primary key,
Name char(15) NOT NULL,
Project_name char(20) unique not null,
Number_of_students int(4) check Number_of_students>1,
Date_of_submission date default(‘2022-JUN-6’));
OR
a)
i) alter table sports drop column category; [1mark]
ii)alter table sports add typesport char(20) not null; [1mark]
25 [First four lines carries=1mark, Next four lines carries =1mark] 2
ggOd OOhhAd ** 88
27 a) 1mark 1+
+-------+-----------+---------+--------+ 2
| Acode | Name | Type | city |
+-------+-----------+---------+--------+
| A01 | Amrita | Savings | Delhi |
| A02 | Parthodas | current | Mumbai |
| A01 | Amrita | Savings | Nagpur |
+-------+-----------+---------+--------+
b) [0.5markx4=2mark]
i)
DISTINCT TID
--------------------
101
NULL
102
104
103
Page 3 of 9
ii)
TID COUNT(*) MIN(FEES)
------ -------------- ----------
101 2 12000
iii)
CNAME
-----------
Digital marketing
Mobile Application Development
iv)15500.00
28 [file open=0.5mark, reading+split=1mark, logic=1mark, result=0.5mark] 3
def countwords():
z=open("myfile.txt",'r')
data=z.read()
p=data.split()
a=0
for i in p:
f=0
for k in i:
if k.isdigit()==True:
f=1
if f==1:
a=a+1
f=0
OR
f=open("car.txt",'r')
data=f.readlines()
line=0
for i in data:
print(i[0])
print(i[-2])
if i[0].lower()==i[-2].lower(): #[-1] is full stop
line=line+1
print("Number of line=",line)
print("words average is= ",a/len(p))
f.close()
29
i) [1mark+1mark+1mark] 3
+----+-------+--------+--------------+--------+
| no | name | salary | address | city |
+----+-------+--------+--------------+--------+
| 5 | Rajan | 9000 | 27-k,Westend | Mumbai |
Page 4 of 9
+----+-------+--------+--------------+--------+
ii)
+----+-------+------+
| no | name | dept |
+----+-------+------+
| 4 | Leena | Advt |
+----+-------+------+
iii)
+------+-----------+-------------+
| dept | count(no) | sum(salary) |
+------+-----------+-------------+
| comp | 2| 13500 |
+------+-----------+-------------+
30 3
[Global stack=0.5mark, push()-1mark, pop()=1mark,display=0.5mark]
N=[3,5,10,12,21,23,45,56,60,78]
def PUSH(S,N):
S.append(N)
def POP(S):
if S!=[]:
return S.pop()
else:
return None
ST=[]
for k in N:
if k%3==0:
PUSH(ST,k)
while True:
if ST!=[]:
print(POP(ST),end=' ')
else:
break
SECTION D
31. i) SELECT P.NAME,F.FARE,F.F_DATE FROM PASSENGER P, FLIGHT F 4
WHERE F.START=”DELHI” AND P.FNO=F.FNO; [1mark]
32 4
import csv
def create():
heading=["Name","Age","Gender"]
rows=[
["rat",43,'M'],
["anu",45,'F'],
["raja",50,'M'],
["rani",52,'F'],
]
filename="data.csv"
with open(filename,'w',newline="") as f:
Page 5 of 9
object=csv.writer(f,delimiter=',')
object.writerow(heading)
for k in rows:
object.writerow(k)
print("Successfully.., Records are written in data.csv file .")
f.close()
def display():
f=open("data.csv",'r')
object=csv.reader(f)
for x in object:
print(x)
f.close()
def search():
found=0
f=open("data.csv",'r')
object=csv.reader(f)
sn=input("Enter Name to search:")
for row in object:
if row[0]==sn:
print("Name=",row[0])
print("Age=",row[1])
print("Gender=",row[2])
found=1
if found==1:
print("Record found...!!!")
else:
print("Sorry., No record not found")
SECTION – E
33 5
1) Suggest the cable layout of connections between the buildings and the topology
thus formed (school wings only).
Topology: STAR
2) Suggest the most suitable place (i.e. building) to house the server of this School,
provide a suitable reason.
Server: ADMIN
b. Hub /Switch
HUB/SWITCH PLACED IN EACH WING.
Page 6 of 9
4) Radiowave
MAN
5) Satellite wave.
34 a) 1+
Pickling process serializes the objects(serialization) and converts them into byte stream 4
so that they can be stored in binary file.
b)
import pickle
def CREATE_DIC():
f=open("ISRO.dat","wb")
n=int(input("Enter number of records:"))
for i in range(0,n,1):
rno=int(input("Enter Rocket Number:"))
name=input("Enter Rocket Name:")
speed=int(input("Enter Speed:"))
t={"rocketno":rno,"rocketname":name,"Speed":speed}
pickle.dump(t,f)
f.close()
def SEARCH_DIC():
x=open("ISRO.dat",'rb')
flag=0
try:
while True:
s=pickle.load(x)
if s["rocketname"]=="Chandrayan_3":
flag=1
print("Rocket no:",s["rocketno"])
print("Rocket name:",s["rocketname"])
print("Spedd:",s["speed"])
except EOFError:
x.close()
if flag==0:
print("Record Not found")
OR
a)
Stdin- reads from the keyboard
Stdout- prints to the display and can be redirected as standard input.
Stderr- same as stdout but normally only for errors. Having error output separately
allows the user to divert regular output to a file and still be able to read error messages.
b)
import pickle
Page 7 of 9
def CREATE_TUPLE():
f1=open("HAPPY.dat","wb")
n=int(input("Enter number of records:"))
t=()
for i in range(0,n,1):
record=[]
roll=int(input("Enter Roll Number:"))
name=input("Enter Name:")
marks=int(input("Enter Marks:"))
record=[roll,name,marks]
t=tuple(record)
pickle.dump(t,f1)
f1.close()
def SEARCH_TUPLE(temp):
f4=open("HAPPY.dat","rb")
flag=0
try:
while True:
s=pickle.load(f4)
for i in s:
if i==temp:
flag=1
print("record found")
print(s)
except EOFError:
f4.close()
if flag==0:
print("record not found")
35 a) 1+
1) Difficulty in data access. 4
2) Data Redundancy.
3) Data Inconsistency.
4) Data Isolation. 18
5) Data dependence.
b)
import csv
def pwd_create():
f=open("password.csv",'w',newline="")
writer=csv.writer(f)
writer.writerow(["User Name",'Password'])
while True:
r=input("Enter the User id:")
n=input("Password:")
data=[r,n]
writer.writerow(data)
ch=input("press any key to continue?N to exit\n")
if ch in 'nN':
break
f.close()
def search():
f=open("password.csv",'r')
status=0
id=(input("Enter the User id to search password:"))
reader=csv.reader(f)
for a in reader:
Page 8 of 9
if a[0]==id:
print("Password :",a[1])
status=1
break
f.close()
if status==0:
print("user id is not present..!!!")
pwd_create()
search()
OR
a)
b)
import mysql.connector
con=mysql.connector.connect(host="localhost",user='root',password="tiger",
database="employee")
cur=con.cursor()
cur.execute("Create table EMPL(Eno int,Ename varchar(10),Esal float)")
print("table created successfully:")
cur=con.cursor()
while True:
Eno=int(input("Enter Employee Number :"))
Name=input("Enter Employee Name:")
salary=float(input("Enter Employee Salary:"))
query="Insert into empl values({},'{}',{})".format(Eno,Name,salary)
cur.execute(query)
con.commit()
print("row inserted successfully...")
ch=input("Do You Want to enter more records?(y/n)")
if ch=="n":
break
END OF PAPER
Page 9 of 9