5th Paper Solution

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

SAMPLE PAPER SET 5

CLASS – XII SUBJECT: Computer Science-083

Total Time- 3 Hours Total Marks- 70

Q1. (c) ssum1 1


Q2. (d)all of the mentioned 1
Q3. (b) def 1
Q4. D={“exam”:”PB”,”yaer”:2023”} 1
Q5. (a)True 1
Q6. (a)['KV S', 'gath', ' '] 1

Q7. (b) wb 1
Q8 (c )drop 1
Q9. (b) Drop 1
Q10. (b) 1
Q11. 1
(d)Distinct
Q12 Pointer /positional value 1
Q13. (a) 1
Q14 © 27.7 1
Q15. sum(*) 1
Q16. Used to connect python 1
Q17. (c) A is True but R is False 1
Q18. (a) Both A and R are true and R is the correct explanation for A 1
Q19. Error1-def is written in capital letter at line1 2
Error2: Colon is not there in line1
Error3:Swap is written wrong
def swap(a,b)://Error1 ,Error2
c=a
a=b
b=c
print("a is",a,"b is",b )
#main()
a=int(input("enter in a "))
b=int(input("enter in b"))
swap(a,b)#calling a function //Error3
Q20. Hub and Switch are both network connecting devices. Hub works at physical layer and is 2
responsible to transmit the signal to port to respond where the signal was received
whereas Switch enable connection setting and terminating based on need.
OR
Ultimately, FTP is more efficient at transferring large files, whereas HTTP is better for
transferring smaller files such as web pages. Although both utilize TCP as the protocol of
choice, HTTP uses a persistent connection, thus making the performance of the TCP better
with HTTP than with FTP
Q21. a) 4 2
b) True
Q22. A foreign key is used to set or represent a relationship between two relations (or tables) in a 2
database. Its value is derived from the primary key attribute of another relation.

Example of two different tables with a common key.


Q23 IMAP – Internet Message Access Protocol 2
HTTP – Hyper text transfer Protocol
URL - Uniform Resource Locator
(a) POP3-Post office protocol ver. III
Q24. {'Rohan': 67, 'Ahasham': 78, 'naman': 89, 'pranav': 79} 2
67
145
234
313
sum of values of dictionaries 313
or
15
Q25 DDL – Data Definition Language 2
DML – Data Manipulation
Language
Any two out of CREATE, DROP, ALTER
OR
Sum()
Q26. .
Event NumPerformers
Engagement 12
Wedding 15

ii. Min(Fee ):100000


Max(Fee): 300000

iii.
Event NumPerformers Phone FeeCharg
Birthday 10 6546454654 250000
Promotion Party 20 46546556544 300000
Engagement 12 6546454654 250000
Wedding 15 9854664654 100000
Q27. def displayTheThis(): 3
num=0
f=open("myfile.txt","r")
N=f.read()
M=N.split()
for x in M:
if x=="the" or x== "this":
print(x)
num=num+1
f.close()
print("Count of the/this in file:",num)
OR
def countVowels():
fobj = open(“myfile.txt”)
data = fobj.read()
count = 0
for ch in data:
if ch == “a” or ch == “e” or ch == “i” or ch == “o” or ch == “u”:
count +=1
print(“Count of vowels in file:”, count)
Note : Using of any correct code giving the same result is also accepted.
Q28.( (i) 3 (ii)650 (iii)TDH 3
a)
Q29. def INDEX_LIST(L): 3
s=0
for a in l:
if a%2==0:
s=s+l
return s

(½ mark for correct function header1


mark for correct loop
1 mark for correct if statement
½ mark for return statement)

Q30. (i) 3
Lname=['narender', 'jaya', 'raju', 'ramesh', 'anita', 'Piyush']
Lage=[45,23,59,34,51,43]
Lnameage=[]
def push_na():
for x in range(len(Lname)):
if Lage[x]>50:
Lnameage.append((Lname[x],Lage[x]))
print(Lnameage)
push_na()

(ii)
def pop_na():
if len(Lnameage)==0:
print("Underflow")
else:
t=Lnameage.pop()
print("The name removed is ",t[0])
print("The age of person is ",t[1])
pop_na()

1 ½ marks for each function


OR
(i)
stu={1:56,2:45,3:78,4:65,5:35,6:90}
stack_roll=[]
stack_marks=[]
def push_stu():
for x,y in stu.items():
if y>60:
stack_roll.append(x)
stack_marks.append(y)
push_stu()
(ii) def pop_stu():
if len(stack_roll)==0:
print("underflow")
else:
stack_roll.pop()
stack_marks.pop()
pop_stu()
Q31 (a) Human Resource will be the most appropriate block where TUC should plan to install their 5
server.
(b) Satellite Link
(c) Switch
Human Resource
(d) Linux and Open Solaris
Block
(e) Conference Block

Finance Block
Q32 (a) Output: 5
105#6#

(b) Ans:
import mysql.connector as pymysql
dbcon=pymysql.connect(host=”localhost”, user=”root”, passwd=”sia@1928”)
if dbcon.isconnected()==False
print(“Error in establishing
connection:”) cur=dbcon.cursor()
query=”select * from
stmaster” cur.execute(query)
resultset=cur.fetchmany(3)
for row in resultset:
print(row)
dbcon.close()
or
Ans:
(a)sELCcME&Cc
Ans:
(c) Statement 1:
con1.cursor()

Statement 2:
mycursor.execute("select * from student where Marks>75")

Statement 3:
mycursor.fetchall()

Q33. Advantage of a csv file:


 It is human readable – can be opened in Excel and Notepadapplications
 It is just like text file

Program:

import csvdef
ADD():
fout=open("record.csv","a",newline="\n") wr=csv.writer(fout)
empid=int(input("Enter Employee id :: "))name=input("Enter
name :: ")
mobile=int(input("Enter mobile number :: "))lst=[empid,name,mobile]---------1/2 mark
wr.writerow(lst)--------------------------------------1/2 mark
fout.close()

def COUNTR():
fin=open("record.csv","r",newline="\n")data=csv.reader(fin)
d=list(data)
print(len(d))
fin.close()

ADD()
COUNTR()

Q34. i. Identify the most appropriate column, which can be considered asPrimary
key.

Ans: ROLL_NO

(1 mark for correct answer)

ii. If two columns are added and 2 rows are deleted from the table result,what will
be the new degree and cardinality of the above table?

Ans:
New Degree: 8
New Cardinality: 5
iii. Write the statements to:
a. Insert the following record into the table – Roll No- 108, Name-Aadit,
Sem1- 470, Sem2-444, Sem3-475, Div – I.
b. Increase the SEM2 marks of the students by 3% whose namebegins
with ‘N’.

Ans:
a. INSERT INTO RESULT VALUES (108, ‘Aadit’, 470, 444, 475, ‘I’);
b. UPDATE RESULT SET SEM2=SEM2+ (SEM2*0.03) WHERE SNAME LIKE“N%”;
(1 mark for each correct statement)

OR (Option for Part iii only)

iii. Write the statements to:


a. Delete the record of students securing IV division.
b. Add a column REMARKS in the table with datatype as varchar
with50 characters

Ans:
a. DELETE FROM RESULT WHERE DIV=’IV’;
b. ALTER TABLE RESULT ADD (REMARKS VARCHAR(50));
(1 mark for each correct statement)
Q35. (i) pickle
(ii) fout=open(‘temp.dat’, ‘wb’)
(iii) Statement 3: pickle.load(fin)
Statement 4: pickle.dump(rec,fout)

You might also like