4th Paper Solution
4th Paper Solution
SECTION A
1. B True c) 2ndName 1
2. B List 1
3. C D1[“REMARK”] = “EXCELLENT” 1
4. A 1
5. C 1
6. B 1
7. C 1
8. C 1
9. B 1
10 C 1
11 B 1
12 B 1
13 D 1
14 A 1
15 C 1
16 B 1
17 A 1
18 B 1
1
SECTION
B
19. Correct Code is 2
def DigitSum():
n = int( input("Enter number ::
")) dsum = 0
while n > 0 :
d = n % 10
dsum =dsum + d
n = n //10
return dsum
20. What is an E-mail? Write two advantages of an E-mail. 2
Give one marks for Explain Email 1 marks for any one Advantage of Email
OR
Write two points of difference between Bus topology and Star topology.
1 marks for any 1 correct difference
2 marks for 2 difference
21. a. correct output is Cntyo 1
b. item @ Laptop
Make @ HP
Price @ 57000
1
22. 1 marks for relevant candidate key and 1 marks for alternate key 2
23. A. 2
(i) CDMA (ii) VOIP
CODE Division Multiple Access ½
VOICE OVER INTERNET PROTOCOL ½
B) What is Web browser? Give name of two commonly used web browsers.
½ marks for explanation Web browser and ½ marks for 2 correct web browswe
24. [11,22,33,45,55,66] 2
[22,11,66,90,110,33]
OR
12,33,66
2
Two marks for any two DDL and DML
SECTION C
26 a. Itemno 1+2
b. insert into items values(2010,”NoteBook”,25,50);
c. Select * from items where itemname like’G%’;
27 def display(): 3
f=open("INDIA.TXT”,"r")
s=f.read()
r=s.split()
for i in r:
if len(i)==3:
print(i,end=’ ‘)
f.close()
28 a) Write the outputs of the SQL queries (i) to (iv) based on the relations 3
i. Select Count(*) from Books
Ans 4
ii. Select Max(Price) from books where quantity
>=15 Ans 750
iii. Select book_name, author_name from books where publishers=’First Publ.’
Ans : Thunderbolts Anna Roberts
iv. Select a.book_id,a.book_name,b.quantity_issued from books a, issued b
where a.book_id=b.book_id
C0001 Fast Cook
F0001 The Tear
T0001 My First c++
3
30 def Readfile(): 3
i=open(“Employee.dat”,”rb+”)
x=i.readline()
count=0
while(x):
count+=1
y=x.split(‘:’)
if((float(y[2]>=20000) and (float(y[2]<=40000) :
print x
x=i.readline()
print(“No. of employees are”, count)
or
SECTION D
4
(b) The code given below inserts the following record in the table
Item: ItemNo – integer
Name – string
Price – integer
Qty – integer
def sql_data():
con1=mysql.connect(host="localhost", user="root",
password="omega", database="resource")
mycursor= con1.cursor()
ItemNo = int(input("Enter ItemNo :: "))
Name = input("Enter name :: ")
Price = int(input("Enter price :: "))
Qty = int(input("Enter Qty :: "))
querry="insert into student
values({}, '{}',{ }, {})".format(Itemno, Name, Price, Qty)
#Statement 2
# Statement 3
print("Data Added successfully")
Statement 1 : mysql.connector
Statement 2 : cursor.execute(“querry”)
Statement 3 : conl.commit()
OR
a) #ack##asIc
(b)import mysql.connector as mysql
def sql_data():
5
con1=mysql.connect(host="localhost",user="root", password="tiger",
database="school")
mycursor= #Statement 1
print("Students with marks greater than 85 are :")
#Statement 2
data = #Statement3
for i in data:
print(i)
print()
Ans : Statement 1. mycursor=conl.cursor()
Statement 2 mycursor.execute(“select * from student where Marks>85”)
Statement 3 data=mycursor.fetchall()
33. A. I MARKS FOR CVS ABOUT FILE 5
(1+2+2
import pickle )
def createFile():
fobj=open("Book.dat","ab")
BookNo=int(input(“Book Number :”))
Book_Name=input(“Name:”)
Author = input(“Author:”)
Price = int(input(“Price :”))
rec=[BookNo,Book_Name,Author,Price]
pickle.dump(rec,fobj)
fobj.close()
2 MARKS FOR ANY CORRECT ANSWER OTHER THAN ABOVE ALSO
def CountRec(Author):
fobj=open("Book.dat","rb")
num = 0
try:
while True:
rec=pickle.load(fobj)
if Author==rec[2]:
num = num + 1
except:
fobj.close()
return num
2 MARKS FOR ANY CORRECT ANSWER OTHER THAN ABOVE ALSO
OR
6
def pushme(stock):
a=input(“enter item name”)
stock.append(a)
print(a,”inserted in stack”)
def popme(stock):
if(package==[]):
print(“stack empty”)
else:
print(“deleted stack ”,stock.pop())
SECTION E
34 (i) Identify the most appropriate column, which can be considered as 1+1+2
Primary key.
Ans empno
(ii) If one column is added and 2 rows are deleted from the table EMP, what
will be the new degree and cardinality of the above table?
Ans Degree 8
Cardinality 5
(iii) Write the statements to:
a. Insert the following record into the table
EmpNo- 8, Name- Ravi, Dept- Sales, Design- Mgr, Gender- M, Salary –
34000, City- Delhi .
Ans Insert into Emp values(8,”Ravi”,”Sales”,”Mgr”,”M”,34000,”Delhi”)
b. Increase the Salary of the Employees who are in Acct
department by 3%.
Ans Update Emp set salary=salary+.03*salary where Dept=”Acct”
7
35 a) Name the Module that Aditya should import in Statement 1
b) In which mode, Aditya should open the file to add data into the file in statement
2.
c) Fill in the blank in statement 3 to fetch the data to a file and statement 4 to close
the file.
Statement 1 :pickle
Statement 2 : ab
Statement 3 :pickle.dump(Lst,
fin) Statement 4 :fin.close()