5th Paper Solution
5th Paper Solution
5th Paper Solution
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.
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
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()
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()
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
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)
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)