Revision Exam I (XII) Ans-1
Revision Exam I (XII) Ans-1
1
23. 2
Post Office Protocol version 3 is used to access mailbox and download e-mail
messages to the local computer.
OR
A modem is a computer peripheral that connects a workstation to other work
stations via telephone lines and facilitates communications.
Modem converts digital signals to A/F(Audio Frequency) tones which are in the
frequency range that the telephone lines can transmit and also it can convert
transmitted tones back to digital information
2
29. OUTPUT: 1+2
a)
i)
Name Designation Salary
Rakesh Minhas Manager 45000
b)(i)
Designation Count(*)
Manager 2
Accountant 1
Clerk 2
(ii) AVG(Age)
34
(iii)
Name Designation Gender
Himani Singh Clerk F
Shreya Sharma Clerk F
(iv)
Designation
Manager
Accountant
Clerk
30. def cnt_M(): 3
num=0
f=open('MYNOTES.TXT','r')
for line in f.readlines():
if line[0]=='M':
num=num+1
print(num)
f.close()
OR
def BIGWORDS():
num=0
f=open('CODE.TXT','r')
data=f.read()
words=data.split()
for w in words:
if len(w)>=7:
num=num+1
print(num)
f.close()
Using any correct code giving the same result is also accepted
3
31. Using any correct code giving the same result is also accepted 3
def PUSH(Num):
s=[]
for x in Num:
if x%2==0 and x>0:
s.append(x)
if len(s)==0:
print("STACK EMPTY")
else:
print(s)
OR
def POP(cities):
#For empty stack
if(len(cities)==0):
print("Under flow")
else:
l=len(cities)
c=cities[l-1]
print(c)
cities.pop(l-1)
SECTION D
32. import pickle 4
def AddStudents():
F= open("STUDENT.DAT",'wb')
while True:
Rno = int(input("Rno :"))
Name = input("Name : ")
Percent = float(input("Percent :"))
L = [Rno, Name, Percent]
pickle.dump(L,F)
Choice = input("enter more (y/n): ")
if Choice in "nN":
break
F.close()
def GetStudents():
Total=0
Countrec=0
Countabove75=0
with open("STUDENT.DAT","rb") as F:
while True:
try:
R = pickle.load(F)
4
Countrec+=1
Total+=R[2]
if R[2] > 75:
print(R[1], " has percent = ",R[2])
Countabove75+=1
except:
break
if Countabove75==0:
print("There is no student who has percentage
more than 75")
average=Total/Countrec
print("average percent of class = ",average)
AddStudents()
GetStudents()
import csv
def ADD():
fout=open("record.csv","a",newline="\n")
5
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()
OR
Advantage of a csv file:
It is human readable – can be opened in Excel and Notepad applications
It is just like text file
OR
import csv
def add():
fout=open("furdata.csv","a",newline='\n')
wr=csv.writer(fout)
fid=int(input("Enter Furniture Id :: "))
fname=input("Enter Furniture name :: ")
fprice=int(input("Enter price :: "))
FD=[fid,fname,fprice]
wr.writerow(FD)
fout.close()
def search():
fin=open("furdata.csv","r",newline='\n')
data=csv.reader(fin)
found=False
print("The Details are")
for i in data:
if int(i[2])>10000:
found=True
print(i[0],i[1],i[2])
if found==False:
print("Record not found")
fin.close()
add()
print("Now displaying")
search()
6
35. (i) SELECT * FROM WORKERS ORDER BY LASTNAME; 4
(ii) SELECT FIRSTNAME, W_ID, ADDRESS FROM WORKERS WHERE
GENDER=’M’;
(iii) SELECT MIN(SALARY) FROM DESIG WHERE DESIGNATION
IN(‘MANAGER’, ‘CLERKS’);
(iv) SELECT FIRSTNAME, SALARY FROM WORKERS, DESIG WHERE
WORKERS.W_ID=DESIG.W_ID;
SECTION E
HR
DESIGN TRAINING
c. Switch
c. Ethernet Cable
d. WAN as the given distance is more than range of LAN and MAN.
37. a) 4 5
3
b) import mysql.connector as mysql
def sql_data():
con1=mysql.connect(host="localhost",user="root",passw
ord="tiger", database="company")
mycursor=con1.cursor()
rno=int(input("Enter Employee ID :: "))
name=input("Enter name :: ")
class=int(input("Enter Department ID :: "))
marks=int(input("Enter Salary :: "))
querry="insert into employee
values({},'{}',{},{})".format(eid,name,deptid,salary)
mycursor.execute(querry)
con1.commit()
print("Data Added successfully")
7
OR
a) (space) THAAIbbbbCOM
b) import mysql.connector as mysql
def sql_data():
con1=mysql.connect(host="localhost",user="root",
password="tiger", database="school")
mycursor=con1.cursor()
print("Students where students name starts with ‘A’: ")
mycursor.execute("select * from student where name like ‘A%’")
data=mycursor.fetchall()
for i in data:
print(i)
print()