1st Paper Solution
1st Paper Solution
iv
Gender Count(Gender)
M 5
F 3
b. DESC Teacher; 1
29 def oddeve(myList): 3
print("All positive numbers of the list :
") for ele in myList:
if ele >= 0:
print(ele, end = " ")
30 def AddCustomer(Customer): 3
CStake.append(Customer)
if len(CStack)==0:
print (“Empty Stack”)
else:
print (CStack)
OR
def DeleteCustomer():
if (CStack ==[]):
print(“Stack empty!”)
else:
print(“Record deleted:”,CStack.pop())
Section-D
31 (i) Admin Block. Because of Maximum Computers. 5
(ii) Any Suitable layout
(iii) Switch
(iv) Ethernet cable
(v) LAN
32 a. cCICKEe 2
b. 3
i. import mysql.connector
ii. cursorobj.execute(query)
iii. mysql.connector.connect(host= “192.168.11.111”, user = “root”, passwd
= “Admin”, database= “MYPROJECT”)
OR
a. G*L*TME 2
b. Statement-1: mysql.connector 1
Statement-2: cursor() 1
Statement-3: execute 1
33 Pickle module helps us to work with Binary files from Python program. 2+3
import csv
f1=open('one.csv','w',newline= “”)
w1=csv.writer(f1,delimiter = ",")
w1.writerow(['Roll.No', 'Name',
'Marks']) while True:
print ("Enter 1 to continue adding, 0 to exit")
op = int(input("Enter Option"))
if (op == 1):
rollno = int(input("Enter Roll No"))
name = input("Enter Name")
marks = int(input("Enter Marks"))
wlist = [rollno,name,marks]
w1.writerow(wlist)
elif op == 0:
break;
f1.close()
OR
tell(): It returns the current position of cursor in file
seek(): Changes the cursor position by bytes as specified by the offset.
import csv
f=open("student.csv","r")
d=csv.reader(f)
next(f)
print("Students Scored More than 80")
print()
for i in d:
if int(i[2])>80:
print("Roll Number =", i[0])
print("Name =", i[1])
print("Marks=", i[2])
f.close( )
34 a. Degree: 4 Cardinality: 6 1
b. TID as this is different for every row/tuple in the 1
table c. 2
i. INSERT INTO TRAINER (TID, TNAME, CITY, HIREDATE,
SALARY) VALUES(107,’Bhoomi’,’Delhi’,”2001-12-15”,90000);
ii. UPDATE TRAINER SET SALARY = SALARY*101 WHERE
SALARY > 80000;
OR
i. DELETE FROM TRAINER WHERE TNAME = “Richa”;
ii. ALTER TABLE TRAINER ADD Remarks VARCHAR(50);
35 i. csv 1
ii. read mode 1
iii. Line-2: “emp.csv”, “r” 2
Line-3: reader