0% found this document useful (0 votes)
27 views10 pages

Model 2 XII CS MS

The document is an examination paper for Computer Science with a maximum of 70 marks and a duration of 3 hours. It includes multiple-choice questions, code corrections, and explanations related to programming concepts, database management, and networking. The paper is divided into sections with varying types of questions, including theoretical and practical coding tasks.

Uploaded by

ig.troll2255
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)
27 views10 pages

Model 2 XII CS MS

The document is an examination paper for Computer Science with a maximum of 70 marks and a duration of 3 hours. It includes multiple-choice questions, code corrections, and explanations related to programming concepts, database management, and networking. The paper is divided into sections with varying types of questions, including theoretical and practical coding tasks.

Uploaded by

ig.troll2255
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

THE VILLAGE INTERNATIONAL SCHOOL THODUPUZHA

Second Model Examination 2023-2024

Computer Science[083]
Maximum Marks: 70 Marking Scheme Time Allowed:3 Hours

Qst.
Question Mark
No.
Section A
1. Which of the following cannot be a variable? 1
(b) print
2. Consider the code given below and write the output: 1
>>>L=[1,2,3,4,5]
>>>[Link](10,2)
>>>L
(c) [1,2,3,4,5,2]
3. What will be the output of: 1
>>>print(“red pen with red ink” . partition(‘red’))
(a) (‘‘ ,’red’, ‘ pen with red ink’
4. Which of the following statement is false? 1
(b) one block of except statement cannot handle multiple exceptions
5. Which of the following statement(s) would give an error during the execution of the 1
following code?
R={‘pno’:52, ‘pname’:’Virat’, ‘expert’:[‘Badminton’, ‘Tennis’], ‘score’:(77,44)}
print(R) #statement 1
R[‘expert’][0]=’Cricket’ #statement 2
R[‘score’][0]=50 #statement 3
R[‘pno’] =50 #statement 4
(c) statement 3
6. _ _ _ _ _ is used for point-to-point communication or unicast communication such as 1
radar and satellite.
(c) Microwave
7. fetchall() method fetches all rows in a result set and return a: 1
(a) Tuple of lists
8. In mysql database, if a table Alpha has degree 5 and cardinality 3, and another table 1
Beta has degree 3 and cardinality 5, what will be the degree and cardinality of the car-
tesian product of Alpha and Beta?
(b) 8,15
9. The correct syntax of seek() is: 1
(a) file_object.seek(offset[,reference point])
10. Consider the expression:
not 5 or 4 and 10 and ‘bye’
Which of the following will be the correct output if the expression is evaluated?
(d) ‘bye’
11. Expand the following terms:
(i) PPP Point-Point Protocol
(ii) VoIP Voice over Internet Protocol
12. What will be the following expression be evaluated to in python? 1
>>>print((-33//13)*(35%-2)*15/3)
(c) 15.0
13. _ _ _ _ _ is a communication methodology designed to establish a direct and dedicated 1
communication between an internet user and his/her ISP.
(c) PPP
14. Consider the code given below: 1
b=100
def Test(a):
_____ #missing statement
b=b+a
print(a,b)
Test(10)
print(b)
Which of the following statement should be given in the blank for #missing statement,
if the output produced is 110?
(c) global b
15. Which of the following statement is FALSE about keys in a relational database? 1
(c) a candidate key that is not a primary key is a foreign key
16. import random 1
alpha = [‘T’, ‘U’, ‘V’, ‘W’]
dig = [2,6,7,3]
print(‘The winner is:’,end=” “)
print(alpha[[Link](0,3)], end=” “)
for i in range(4):
print(dig[i + [Link](0,3)], end=” “)
What possible output(s) is expected to be displayed on screen at the time of execution
of the program from the above code:
(i) The winner is: T 7 3 6 (ii) The winner is: W 2 6 7 5
(iii) The winner is: V 6 6 0 (iv) The winner is: U 2 7 3
(b) i and iv
17. Assertion (A) : If the arguments in function call statement match the number and
order of arguments as defined in the function definition,
such arguments are called positional arguments.
Reasoning(R) : During a function call, the argument list is first conatins default
argument(s) followed by positional arguments.
(c) A is True but R is False
18. Assertion (A) : with statement can be used to open a file and should be preferred over
other ways to open a file.
Reasoning(R) : with statement is a block of statement that makes sure the file is closed
in case of any run-time error and buffer is cleared to avoid data loss.
(a) Both A and R are true and R is the correct explanation for A

Page »02|10
Section B
19. Rewrite the following code in pythonafter removing all syntax or logical error(s). Underline 2
each correction done in code.
def determine(s):
d={“UPPER”:0, “LOWER”:0}
for c in s:
if [Link]():
d[“UPPER”]+=1
elif [Link]():
d[“LOWER”]+=1
else:
pass
print(“Original string:”,s)
print(“Upper case count:”,d["UPPER"])
print(“Lowewr case count:”,d[“LOWER”])
determine(“These are HAPPY Times”)
20. Write two points of difference between circuit switiching and packet switiching. 2
Ans: Circuit switiching Packet switchig
is the method of switiching which is the method of switiching where no
is used for establishing a dedicated dedicated path is established from the
communication path between source to destination.
sender and receiver
data is processed and transmitted at data is processed and transmitted not only
source only at the source but at each switching station
It is more reliable it is less reliable
OR
Write two points of difference between XML and HTML.
XML(eXtensible markup language) HTML(hypertext Markup Language)
tags are not predefined, they are user defined tags are predefined
stores and transfer data HTML is about displaying data
dynamic in nature static in nature
21. (a) Given is the python string declaration: 1
wish = “ ##Wishing All Happy Diwali @#$”
Write the output of wish[-6::-6]
Ans: lyli# 1
(b) Write the output of the code given below:
my_dict = {“name” : “Aman”, “age” : 26}
my_dict[“age”]=27
my_dict[“address”]=”Delhi”
print(my_dict.items())
Ans: dict_items([('name', 'Aman'), ('age', 27), ('address', 'Delhi')])
22. Explain the use of ‘foreign key’ for performing table joins, giving a suitable example to 2
support your answer.
Ans: The foreign key constaraint is used to ensure referential integrity of the data in
the table. It matches the value of the column designated as the foreign key in one table
with another table's primary key. (1 mark for example)
23. (a) Write the full form of (i) SMTP and (ii) IMAP. 1
(i)Simple Mail Transfer Protocol (ii) Internet message access protocol 1
(b) Name two top level domain names with their area of applications.
Ans: Top Level Domain refers to the last segment of a domine name.
.com - commercial business
.org - organizations

Page »03|10
24. Give the output of the following python code: 2
def comp(N1, N2=10):
return N1>N2
Num=[10, 23, 14, 54, 32]
for var in range(4,0,-1): Ans: False#True#True%False%
A=Num[var]
B=Num[var-1]
if var>len(Num)//2:
print(comp(A,B),”#”, end=’’)
else:
print(comp(B,A),”%”,end=’’)
OR
Write the output of the following:
tuple1=([7,6], [4,4], [5,9], [3,4], [5,5], [6,2], [8,4])
listy=list(tuple1)
new_list=list()
for ele in listy:
tot=0
for value in ele:
tot+=value
if [Link](value)==2: Ans: (4,4,5,5)
new_list.append(value)
tot=0
else:
print(tuple(new_list))
25. Consider the following two commands with reference to a table, named Students, hav- 2
ing a column named Section:
(a) select count(section) from Students;
(b) select count(*) from Students;
If these two commands are producing different results,
(i) What may be the possible reason?
(ii) Which command, (a) or (b), might be giving high value?
Ans: The COUNT(*) function returns the number of rows in a dataset using the SE-
LECT statement. The function counts rows with NULL, duplicate, and non-NULL val-
ues. Count(section) will not accept NULL values.
(b) having high value
OR
Differentiate between WHERE and HAVING clauses in Mysql.
Ans: Where clause is used to filter the records from the table or used while joining
more than one table. Only those records will be extracted who are satisfying the speci-
fied condition in where clause. It can be used with select, update delete statements.
Having clause is used to filter the records from the groups based on the given condi-
tion in the having clause. Those groups who will satisfy the given condition will appear
in the final result. It can be used only with group by clause.
Section C
26. Ucode Uname Ucolour Size Prize 1
1 Shirt White L 550
1 Shirt White M 500
2 Pant Grey L 850
2 Pant Grey M 810

Page »04|10
(i) Select distinct sports from sportsclub; ½
(ii) Select sports, max(Salary) from sportsclub groupby sports having ½
sports <>'Snooker';
(iii) Select pname sports salary from sportsclub where country='INDIA' order by ½
salary DESC;
(iv) Select sum(salary) from sportsclub where rating='B'; ½
27. def COUNT(): (½) 3
F=open('[Link]', 'r') (½)
T=[Link]() (½)
x=1
for i in T: (½)
print("line ", x, ':', [Link]('e')) (½)
x+=1
[Link]() (½)
COUNT()
OR
def START_WITH_I(): (½)
F=open('[Link]', 'r') (½)
T=[Link]() (½)
for i in T: (½)
if i[0] in 'I': (½)
print(i)
[Link]() (½)
START_WITH_I()
28. (a) 3
(i) ½
FID MIN(FEES) MAX(FEES)
F01 12000 40000
F04 15000 17000
F03 8000 8000
F05 NULL NULL

(ii) AVG(Salary ½
29500

(iii) ½
FNAME CNAME
Neha Python
Neha Computer Net-
work

(iv) ½
FNAME CNAME FEES
Anishma Grid Computing 40000
Neha Python 17000

(b) DESC or DESCRIBE command 1

Page »05|10
29. def index_List(L): (½) 3
in_list=[]
for i in range(len(L)): (1)
if L[i]%3!=0: (1)
in_list.append(i)
return in_list (½)
30. N=[12,13,34,56,21,79,98,22,35,38] 3
def push(S, N):
[Link](N)
def pop(S):
if S!=[]
return [Link]()
else:
return None
ST=[]
for k in N:
if k%2==0:
push(ST,k)
while True:
if ST!+[]
print(pop(ST),end=' ')
else:
break
OR

R={“Niki” : 76, “Manu” : 45, “Bilu” : 54, “Ani” : 65, “Kanu” : 90, “Hok” : 82}
def push(S,N):
[Link]()
def pop(S):
if S!+[]:
return [Link]()
else:
return None
ST=[]
for k in R:
if R[k]>75:
push(ST,k)
while True:
if ST!=[]:
print(pop(ST), end=' ')
else:
break

Page »06|10
Section D
31. (a) What will be the output of the follwoing code? 2
value=100
def display(N):
global value
value=150
if N%7==0: Ans: 100#100
value = value+N
else:
value = value -N
print(value, end=’#’)
display(50)
print(value)
(b) The code given below inserts the following record in the table student:
Rollno - integer, Name - string, class - integer, Marks - integer
Note the following to establish connectivity between Python and Mysql:
username is root, password is tiger
The table exists in a mysql database named school
The details (Rollno, Name, Class and Marks) are to be accepted from the user.
Write the following missing statements to complete the code:
statement 1 - to form the cursor object
statement 2 - to write a query to insert records into the table
statement 3 - to execute the query
statement 4 - to add record permanently in the database
import [Link] as mysl
def sql_data():
con1 = [Link](host = ”localhost”, user = ”root”, password = ”tiger”, 3
database = ”school”)
mycursor = _ _ _ _ _ _ _ _ _ _ #statement 1 [Link]() (½)
rno = int(input(“Enter the roll number:”))
name = input(“Enter the name:”)
class = int(input(“Enter the class:”))
marks = int(input(“Enter the marks:”))
query = _ _ _ _ _ _ _ _ _ _ #statement 2 "insert into student values({}, '{}',
{},{})".format(rno, name, class, marks) (1)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _#statement 3 [Link](query) (½)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _#statement 4 [Link]() (1)
print(“Data added successfully”)

OR
(a) Give the output for the following:
cBsEe#2#eXAM (2)
(b) ALmost same as the (b) part of the other question (3)
marks for connection object (½), cursor object(1), executing query (½), commit(1).

Page »07|10
32. Fun Media Services Ltd. is an event planning organization. It is planning to set up its 5
campus in Mumbai with its head office in Delhi. The Mumbai campus will have four
blocks/buildibgs - Admin, Decorators, Food and Media.
You as a network expert need to suggest the best network related solutions for them
to resolve the issue/problems mentioned in points (i) to (iv), keeping in mind the dis-
tance between various blocks / locations and other given parameters.

MUMBAI DELHI

Food
Admin

Media
Head Office

Decorators

(i) Linear / Bus topology (145m)


Ethernet cable
(ii) Firewall
(iii) Admin (max. number of computers, mention 80-20 rule)
WAN
(iv) Video Conferencing
H.320 / H.323 / SIP
(v) Switch / Hub in each building.
As per layout no need of repeater because distance between each building can't ex
ceed 70m
33. (a) The reader object reads data from a csv file on storage disk and removes the delim- 5
iter and loads the data into a python iterator from which the data can be fetched row
by row. (1)
(b) import csv (½)
def write():
fout=open("[Link]", "a", newline="\n") (½)
wr=[Link](fout) (½)
roll=int(input("Enter roll number:"))
name=input("Enter name of student:")
aggregate=int(input("Enter aggregate:"))
lst=[roll, name, aggregate] (½)
[Link](lst) (½)
[Link]()
def count():
fin=open("[Link]","r",newline="\n") (½)
data=[Link](fin) (½)
ctr=0
for i in data:
if int(i[2])>75: (½)
ctr+=1
print(ctr)
[Link]()
write()
count()
Page »08|10
(a) Files are limited resource managed by the OS, so it is imporatant to close them to
avoid reaching the open limit and impacting program performance. Files left uninten-
tionally open become vulnerable to loss data, and changes to files cannot be readable
until closed.
(b) import cvs
def Add_Book():
f=open("[Link]","a",newline=' ')
wo=[Link](f)
book_id=input("Enter book id:")
b_name=input("Enter book name:")
pub=input("Enter publisher:")
[Link]([book_id, b_name, pub])
[Link]()
def search_Book():
f=open("[Link]", 'r')
ro=[Link](f)
pn=input("Enter publisher:")
cnt=0
for i in ro:
if i[2]==pn:
cnt+=1
print(i[0], i[1],i[2])
print("Total books published by", pn,"are", cnt)
[Link]()
Add_Book()
search_Book()
Section E
34. (i) sid (1) 4
(ii) degree -8
cardinality-5 (1)
(iii) (a) update Result set sem2=sem2+(sem2*0.04) where sname like "P%"; (1)
(b) Delete from Result where division='iv'; (1)
OR
(a) Alter Table Result rename column Division to Grade;
(b) Select * from result order by sem1, sem2;
35. Satya is a python programmer. He has written a code and created a binary file 4
'[Link]' with employeeid, ename and salary. The file contains 10 records.

He now has to update a record based on the employeeid entered by the user and up-
date the salary. The updated record is then to be written in the file '[Link]'. If the
employeeid is not found, an appropriate message should to be displayed.

As a python expert, help him to complete the following code based on the requirement
given below.

Page »09|10
import pickle
def update_data():
rec={ }
fin = open("[Link]","rb")
fout = open(" _ _ _ _ _ _ _ _")------------------ >#1
found = False
eid = int(input("Enter the employee id to update:"))
while True:
try:
rec = _ _ _ _ _ _ _ _ _ _ ------------- >#2
if rec["Employeeid"]==eid:
found = True
rec["Salary"] = int(input("Enter the new salary:"))
_________ -------------->#3
else:
pickle . dump(rec, fout)
except:
break
if _ _ _ _ _: -------------------------------- >#4
print("The salary of employee id", eid, "has been updated")
else:
print("No such employee exists")
[Link]()
[Link]()
(i) Write correct statement require to open the temporary file [Link](statement
#1)
fout=open("[Link]", "wb") (1)
(ii) Which statement should Satya fill in statement #2 to read data from binary file
[Link] and in statement #3 to write the updated data?
[Link]( fin) (1)
[Link](rec,fout) (1)
(iii) Which statement should Satya fill in statement #4 so that he can display the
proper message.
found==True (1)

Page »10|10

You might also like