0% found this document useful (0 votes)
33 views8 pages

Sahodaya School Complex Kochi MODEL EXAMINATION 2024-2025 Computer Science - Answer Key

This document contains the answer key for the Model Examination 2024-2025 for Computer Science at Sahodaya School Complex Kochi. It includes answers to various questions related to computer science concepts, programming, and database queries. The document also features code snippets and SQL queries relevant to the examination topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views8 pages

Sahodaya School Complex Kochi MODEL EXAMINATION 2024-2025 Computer Science - Answer Key

This document contains the answer key for the Model Examination 2024-2025 for Computer Science at Sahodaya School Complex Kochi. It includes answers to various questions related to computer science concepts, programming, and database queries. The document also features code snippets and SQL queries relevant to the examination topics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

SAHODAYA SCHOOL COMPLEX KOCHI

MODEL EXAMINATION 2024-2025


COMPUTER SCIENCE – ANSWER KEY(083)

1. False

2. pOrMI

3. True

4. Madam

5. ‘D’

6. (3, 1, 2, 4)

7. dict1.update(dict2)

8. (c) Succeed

9. (d) All

10. (c)file pointer will move10 byte in forward direction from current location

11. False

12. (b) connect ( )

13. d=f.readlines()

14. (b) 7,18

15. LIKE

16. (c) Having

17. (b)3,20

18. URL

19. (b)Gateway

20. (a)

21. (b)
22. def max_length(L):
b=0
for i in L:
l=len(i)
if l>b:
b=l
st=i
print("string with max length=",st)

23. (i)
DISTINCT DESIGNATION
Manager
Director
Clerk

(ii) CITY SUM(SALARY)


Delhi 135000
Mumbai 175000
Kolkata 85000

(iii) NAME SALARY


Peter 45000
Jack 85000
Harry 90000

(iv) NAME SALARY CITY


Harry 90000 Delhi

24. (i) EXAM.append(“maths”)

(ii) EXAM.sort(reverse=True)

25. (i) INDIGO&BLUE&GREEN&


Minimum Value of End = 3
Maximum Value of End = 4

26. def func(a): #def


s=m=n=0 #local variable
for i in range(0,a): #range function missing
if i%2==0:
s=s+i
elif i%5==0 : #elif and colon
m=m+i
else:
n=n+i
print(s,m,n) #indentation
func(15)

27. (i) USE Employee

(ii) No: of characters occupied in attribute A = 4


No: of characters occupied in attribute B = 20

28. (i) Hyper Text Transfer Protocol


(ii) Used for transferring hypertext on WWW.

29. def ConsonantCount():


f=open("MY_FILE.TXT","r")
st=f.read()
c=0
for i in st:
if i.isalpha():
if i not in"AEIOUaeiou":
c=c+1
print("No: of consonants=",c)
f.close()

OR
def filter():
f1=open("source.txt","r")
f2=open("target.txt","w")
text=" "
L=f1.readlines()
for i in L:
if i[0]!='@':
f2.write(i)

f1.close()
f2.close()

30. def POP_PUSH(LPop, LPush, N):


if len(LPop)<N:
print("Pop not possible")
else:
for i in range(N):
LPush.append(LPop.pop())
OR

edetail = []
def push():
name = input("Enter name")
sal = int(input("Enter Salary"))
item = [name, sal]
edetail.append(item)

def pop():
if len(edetail) > 0:
it=edetail.pop()
print("Deleted item=",it)
else:
print("Stack is empty")

31.
fUNnpYTHON

OR

1 20 X@
4 30 X@Y@
9 60 X@Y@Z@

32. (A)
(i) SELECT NAME, GENDER FROM PERSONAL WHERE DOB between ‘2008-01-01’
and ‘2009-12-31’;
(ii) SELECT * FROM PERSONAL WHERE DOB IS NULL ;
(iii) SELECT CITY, COUNT(*) FROM PERSONAL GROUP BY CITY;
(iv) SELECT GENDER, SUM(FEE) FROM PERSONAL GROUP BY GENDER ;
OR

(i) MAX(DOB) MIN(DOB)


2010-11-29 2007-04-17

(ii) GENDER COUNT(GENDER)


M 4
F 3

(iii) NAME UPPER(CITY)


Maanshi KOLKATA
Kavitha AHMEDABAD
(iv) NAME CITY
Arun Bengaluru
Karan Chennai
Kavitha Ahmedabad
Maanshi Kolkatta
Manav Kolkatta
Suhani Chennai
Suresh Bengaluru

33. import csv


def createfile( ):
f = open ( 'record.csv' , 'w', newline=”\n” )
stwriter=csv.writer(f)
ans=’y’
while ans==’y’:
rno = int ( input ('Enter the roll number : ' ) )
name = input ( 'Enter the name : ' )
clas = int (input ('Enter Class : ') )
section = input ( 'Enter Section : ' )
per = float (input ( ‘Enter percentage : ‘ ) )
record = [rno,name,clas,section,per]
stwriter.writerow(record)
ans = input ( 'Do you have more records (y/n) : ' )
f.close( )

def searchRecord(num):
f=open('record.csv','r',newline=”\n”)
found=0
streader=csv.reader(f)
for i in streader:
if i[0] == num:
print(i)
found=1
break

if found==0:
print(“No such record found”)
f.close()
print(“search successful”)
f.close( )
#main
createfile()
rn=int(input(‘Enter roll no. to search=’))
searchRecord(rn)
34. (a) DELETE FROM TRANSACT WHERE AMOUNT<1000;
(b) SELECT TTYPE, SUM(AMOUNT) FROM TRANSACT GROUP BY TTYPE;
(c) SELECT NAME, AMOUNT FROM CUSTOMER,TRANSACT
WHERE CUSTOMER.CNO=TRANSACT.CNO AND TTYPE=’CREDIT’;
(d) UPDATE CUSTOMER SET PHONE=9988117700 WHERE CN0=1002;

35. import mysql.connector as sqlcon


mycon=sqlcon.connect(host=”localhost”,user=”root”,passwd=”tiger”,
database=”COMPANY”)
cur=mycon.cursor()
id=int(input(“enter id”))
sn=input(“enter name”)
d=input(“enter doj”)
sal=int(input(“enter salary”))
qry=””” INSERT INTO STAFF VALUES({ },’{ }’,’{ }’,{ })”””.format(id,sn,d,sal)
cur.execute(qry)
mycon.commit()
cur.execute(““”select * from STAFF where salary>50000”””)
data=cur.fetchall()
for i in data:
print(i)
cur.close()
mycon.close()

36.
Import pickle
def Add_book():
f = open(“book.dat”,”wb”)
ans=’y’
while ans==’y’:
Bn=int(input(“enter book no”))
N=input(“enter name”)
A=input(“enter author”)
L=[Bn,N,A]
pickle.dump(L,f)
ans=input(“do you want to continue(y/n)”)
f.close()

def change_book():
f = open(“book.dat”,”rb+”)
found=0
try:
while True:
pos=f.tell()
bk=pickle.load(f)
if bk[2]== “J.K.Rowling”:
bk[2]= “J.K.R”
f.seek(pos)
pickle.dump(bk,f)
found=1
except EOFError:
if found==0:
print(“No matching record”)
else:
print(“Record modification successful”)

def search_book():
au=input(“enter author name”)
f=open(“book.dat”,”rb”)
print(“Books written by”,au)
try:
while True:
bk=pickle.load(f)
if bk[2]==au:
print(bk[1])
except EOFError:
f.close()

37. (a) Repeater


(b)
City Head Office Village1 Training
Center

Village2 Training Village3 Training


Center Center

(c)Hub/switch
(d)VoIP
(e) MAN

You might also like