12 CS Board Set 4 QP
12 CS Board Set 4 QP
Main Resource
Table : ACCESSORIES
Building
Building
No Name Price Id
A01 Motherboard 12000 S01
A02 Hard Disk 5000 S01
A03 Keyboard 500 S02
A04 Mouse 300 S01
A05 Motherboard 13000 S02 Training Accounts
A06 Keyboard 400 S03 Building Building
A07 LCD 6000 S04
T08 LCD 5500 S05
T09 Mouse 350 S05
T010 Hard Disk 450 S03 Center to Center distance between various building as per architectural drawings (in
meters is as follows:
i) Select distinct Name from ACCESSORIES where Price > = 5000; Main Building to Resource Building 120m
ii) Select Area, count(*) from SHOP group by Area; Main Building to Training Building 40m
iii) Select count(distinct Area) from SHOP; Main Building to Accounts building 135m
iv) Select A.Name , A.Price from ACCESSORIES A, SHOP S
Resource Building to Training Building 125m
where A.Id =S.Id and Price >=12000;
Resource Building to Account Building 45m
Training building to Account Building 110m
b) write the command to create a database employee.
Expected number of computers in each building is as follows:
29 Write a python function is_even_num(l), where l is the list of elements passed as 3
Main Building 15
. arguments to the function. The function return even numbers from a given list:
Resource Building 25
Sample List : [1,2,3,4,5,6,7,8,9] Training Building 250
Accounts Building 10
Expected Result:[2,4,6,8]
i)Suggest the layout of connection between the building.
ii)Suggest the most suitable (i.e. building) to house the server of this NGO. Also
provide a suitable reason for your suggestion.
iii)Suggest the placement of the following devices with justification:
a)Repeater b)Hub / Switch b)Consider the following code which is doing following ,
iv) The NGO is planning to connect its International office situated in delhi . which updating the records of employees by increasing the salary by Rs.1000 of all those
out of the following wired communication links will you suggest for a very high employees who are getting less than Rs. 80000.
speed connectivity ? Write the following missing statements:
a) Telephone Analog line b) Optical Fiber iii)Ethernet Cable i)statement1
v)Suggest the protocol to be used to update website of their organization from ii)statement2
Training Building. iii)statement3
32 a) Predict the output of the following code fragment ? 2+3
. def check(n1=1, n2=2): import _______.connector #statement1
n1=n1+n2 db1=mysql.connector.connect(host=”localhost”, user=”root”,password=””,
n2+=1 databse=”company”)
print(n1,n2) cursor = _______________ #statement2
check ( ) sql=”update emp set salary = salary + 1000 where salary <80000;”
check(2,1)
try:
b.) study the database ‘company’ that has a table ‘Emp’ that stores IDs of cursor._______________ #statement3
employees. Code contain the connectivity to retrieve data, one record at a time, for bd1.commit( )
employees with IDs less than 10. except:
Write the missing statements db1.rollback( )
i)Statement1 .
ii)Statement2 bd1.close( )
iii)Statement3
33 Write a user defined function to perform read and write operations onto a 5
import MYSQLdb as mycon . ‘student.csv’ file having fields roll number, name, stream and marks.
try:
db=______.connect(host=”localhost”, user =”root”, passwd=” ”, Or
database =”company”) ##write missing part in statement1
cursor = _________________#missing Statement2 Write the difference between text and csv file ?
sql=”select * from Emp where id < 10”) Ranjan kumar of class 12 want to write a program on csv file “user.csv” he wants to
number_of_rows=cursor.execute(sql) store user id and password in user.csv files.
print(cursor.fetchone()) Example he want to write following data where first is user id and second is
db._______ ##missing statement3 password in the file :
except mycon.DataError as e: “Arjun”, “123@456”
print(“DataError”) “Arunima”, “123#453”
print(e) “Shyam”, “12&1234”
35 Vishal has been given following incomplete code which takes a students details 1+1+1+
. (rollnumber, name and marks) and writes into binary file stu.dat using pickling. 1
Print(Rstu)
if Rstu[“Marks”] >= 85:
print(“Eligible for merit certificate”)
else:
print(“Not Eligible for merit certificate”)