CS Practical File
CS Practical File
-------------------------------------------------------------------------------------------------------------------------------------
Q18. Design a Python application that fetches all the records from Pet table of menagerie database.
import mysql.connector as a
cur = mydb.cursor()
cur . execute(run)
data = cur.fetchall()
for i in data :
print(i)
mydb.close()
Q19. Design a Python application that inserts the records in STUDENT table of MYDB database.
import mysql.connector as my
mycon = mydb.cursor()
mycon.execute("INSERT INTO student VALUES ('{}', '{}', '{}',)".format (name, roll, class))
mydb.commit()
mydb.close()
Q20. Design a Python application that DELETE the record from STUDENT table of MYDB database.
import mysql.connector as my
mycon = mydb.cursor()
mydb.commit()
mydb.close()
Q21. Design a Python application that UPDATES the record from STUDENT table of MYDB database.
import mysql.connector as my
mycon = mydb.cursor()
mycon.execute("UPDATE student set name='{}' class= '{}', where roll='{}', ".format (name, class, roll))
mydb.commit()
mydb.close()
Q-22.Design a Python application that fetches only those records from Student table of mydb
database where roll is 10.
import mysql.connector as a
cur = mydb.cursor()
cur . execute(run)
data = cur.fetchall()
for i in data :
print(i)
mydb.close()
Q-23. Design a Python application to obtain a search criteria from user and then fetch records based
on that from empl table.
import mysql.connector
database = "employeedb")
cursor = db_con.cursor()
cursor.execute(sql1)
records = cursor.fetchall()
print("Fetched records:")
db_con.close()
Q-24. Design a Python application to obtain a total rows from STUDENT table and fetch top 4 records
by using fetchmany() function.
import mysql.connector
cursor = db_con.cursor()
cursor.execute(sql1)
records = cursor.fetchmany(4)
count=cursor.rowcount
print("Fetched records:")
print(record)
db_con.close()
From To Distance
Admin. Building 20
Finance Building 40
(i) Suggest the most appropriate building, where EPG should plan to install the server.
(ii) Suggest the most appropriate building cable layout to connect all three buildings for
efficient communication.
(iii) Which type of network out of the following is formed by connecting the computers
of the buildings?
1. LAN
2. MAN
3. WAN
(iv) Which wireless channel out of the following should be opted by EPG to connect to
students of all over the world ?
1. Infrared
2. Microwave
3. Satellite
Answer
(i) EPG should install the server in Faculty Studio Building as it houses the maximum
number of computers. Thus, it will reduce cable cost and keep maximum traffic local.
(ii) The most appropriate building cable layout to connect all three buildings for
efficient communication is given below:
(iii) LAN network is formed as the distance between the three buildings is less than 1
km.
(iv) Satellite communication should be opted by EPG to connect to students of all over
the world.