0% found this document useful (0 votes)
46 views2 pages

g12 RDBMS

Tina is writing a Python program to insert two rows into a Teacher table in a MySQL database. She has written some code but there are blanks that need to be filled in. The summary identifies the missing elements in the code and their correct values: 1) The mysql.connector.connect function needs to be used on line 1. 2) The INTO keyword is missing on line 2. 3) The date value on line 3 needs quotes. 4) The commit method needs to be called on line 4. 5) The print statement is missing on line 5.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views2 pages

g12 RDBMS

Tina is writing a Python program to insert two rows into a Teacher table in a MySQL database. She has written some code but there are blanks that need to be filled in. The summary identifies the missing elements in the code and their correct values: 1) The mysql.connector.connect function needs to be used on line 1. 2) The INTO keyword is missing on line 2. 3) The date value on line 3 needs quotes. 4) The commit method needs to be called on line 4. 5) The print statement is missing on line 5.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

RSK INTERNATIONAL SCHOOL (CBSE)

(SENIOR SECONDARY)
CBSE Affiliation Number 1930766
Class Test (RDMS)
GRADE:XII COMPUTER SCIENCE – 083 MAX MARKS:20
ROLL NO : ______ MAX TIME : 45 MINTS

1. Write Python code to create a table Location with the following fields: (3 m)
Id – Id of the location
bldg_code – code of the building
room – Type of rooms
capacity – capacity of the room

2. Consider the table Teacher in which Tina wants to add two rows. For this, she wrote a progeam in
which some code is missing. Help her to complete the following code. (5 m)

Import mysql.connector
Mycon=mysql.______________connect
#Line1
(host=”Localhost”,User=”root”,passwd=”system”,database=”test”)
Cursor=ccon.cursor()
Sql=”INSERT _______ Teacher(T_Id,
#Line2
Fname,Lname,Hire_dat,Salary,Subject)
VALUSE
(%s,%s,%s,%s,%s)”
________________ = [(101,’viba’,’Bajpai’,#Line3
’12-10-2021’,27000,’Python’),
(104,’Rekha’,’Sharma’,’01-01-2022’,27000,’Matha’)]
try:
cursor.executemany(sql,val)
mycon._____________() #Line4
except:
mycon.rollback()
___________________ #Line5

(i) Which function will be filled in the blank at line4?


(ii) What should be come in the blank at the line2?
(iii) Which function will be filled in the blank at line5?
(iv) What should be come in the blank at line1?
(v) What should be come in the blank at the line3?

3. Define degree and cardinality. Based upon given table write degree and cardinality. (2 m)
PATIENTS
PatN PatName Dept DocID
O
1 Leena ENT 100
2 Supreeth Ortho 200
3 Madhu ENT 100
4 Neha ENT 100
5 Deepak Ortho 200

4. Which of the following was the first network database? (1 m)


a. SYSTEM 2000 b. DBTG Codasyl c. SYSTEM Codasyl d. DBTG 2000
5. A tuple in RDBMS is referred to ____________ of a table. (1 m)
a. Record b. Field c. Table d. Key
6. Mandatory arguments required to connect any database from Python (1 m)
a. Username, Password, Hostname, Database Name, Port
b. Username, Password, Hostname
c. Username, Password, Hostname, Database Name
d. Username, Password,Hostnamae, Post (1 m)
7. Which method of cursor class is used to fetch limited rows from the table?
a. cursor.fetchsize(SIZE) b. cursor.fetchmany(SIZE) c. cursor.fecthall(SIZE)
d. cursor.fetchonly(SIZE)
8. Exception raised when the relational integrity of the database is affected in Python(1 m)
a. IntegrityFailError b. IntegrityFailyre c. IntegrityViolationError
d. IntegrityError
9. Which of the following is invalid method for fetching the records from database within Python?(1m)
a. fetchone() b.fetchmany() c.fetchall() d.fetchmulti()
10. Which of the following database servers is/are supported by Python DB-API? (1 m)
a. MySQL b. Interbase c. Oracle d. All of these
11. List the most common parameters and the usage that are passed to communicate with the
database.(2m)
12. Which command is used to modify the records of the table? (1 m)

You might also like