HY-XII-CS-MS-24-25
HY-XII-CS-MS-24-25
1 C 5 A 9 B 13 A 17 B
2 A 6 A 10 B 14 A 18 C
3 A 7 B 11 C 15 B
4 D 8 12 FALSE 16 D
20, 35 # 90 2
55 # 85
21. GOOdbbDAy 2
for i in s:
w=i.split()
if len(w)>5:
print(i)
1
f.close()
Page
HP 1
23. Primary key uniquely identifies each and every tuple in a relation. 2
The second query counts number of tnames and there must be 3 NULL values. That is why it
produces 17.
25. a) True 2
b) floor( )
26. def countDigit (): 3
f=open('alnum.txt','r')
text=f.read()
dig=al=0
for i in text:
if i.isdigit():
dig+=1
elif i.isupper():
al+=1
print(dig, al)
f.close()
countDigit( )
OR
def India():
f=open('alnum.txt','r')
text=f.read()
text=text.split()
ind=0
for i in text:
if i.upper()=='INDIA':
ind+=1
print(ind)
f.close()
27. a) 3
fees dec(8,2),
HP 2
startdate date,
tid int
);
b)
b)
except:
HP 3
f.close()
print('Average price of car :',tot_price/count_rec)
30. a) 2
67#6#
b)
31. a) 1
read( ) load( )
It reads unstructured data It reads structured data 1
It is used to read from text file It is used to read from binary file
f.read(20) pickle.load(f)
b)
c)
1
i) ‘a’ mode opens a file in append mode. Previous file content is not erased and the file pointer is
positioned at the end of the file. ‘w’ mode opens a file is write mode. Previous file content is
erased.
1
ii) newline
32. a) 3
i)
def Add_Mob():
f=open('mobile.dat','ab')
prodid=int(input('Product Id :'))
prodname=input('Product name :')
brand=input('Brand :')
price=float(input('Price :'))
rec={}
L=[prodname,brand,price]
rec[prodid]=L
pickle.dump(rec,f)
f.close()
ii)
def Get_Mob():
4
f=open('mobile.dat','rb')
Page
try:
HP 4
while True:
x=pickle.load(f)
if x[prodid][1]=='Apple':
print(x)
except:
f.close()
b) Degree : Number of attributes of a relation is known as degree. 1
Cardinality: Number of tuples of a relation is known as cardinality.
(b) csv_w.writerow(fields)
(c) csv_w.writerows(rows)
(e) row[0]
5
Page
HP 5