You are on page 1of 7

Part – A

Section – 1

Answer any 15 questions out of the given 21 questions.

Question Question Marks


No. allotted
1. Find the invalid identifier from the following 1
a) MyName b) True c) 2ndName d) My_Name
2. Consider a stack s=['a','b','c','d','e'], what will be the output 1
at the end of the execution of following commands?
Pop(), Push(‘f’), Push(‘g’), Pop(), Pop()
3. Name the Python Library modules which need to be 1
imported to invoke the following functions :
(i) randint() (ii) pow()
4. Given the lists L=[1,3,6,82,5,7,11,92] , write the output of 1
print(L[2:5])
5. Write the SQL query string to display a list of tables stored 1
in a database. (Python-MySQL connectivity)
6. If we delete an attribute of a table 1
(a) degree increases
(b) cardinality increases
(c) degree and cardinality increase
(d) degree decreases
7. Identify the valid arithmetic operator in Python from the 1
following. a) ? b) < c) ** d) and
8. Which string method is used to implement the following? 1
i. To count the number of characters in the string.
ii. To change the first character of the string in capital
letter.
9. Which method returns the next row from the result set as 1
tuple?
(a) fetchone ( )
(b) fetchmany ( )
(c) fetchall ( )
(d) rowcount
10. The insertion of element in a stack is technically called. 1
a) pull operation
b) insert operation
c) pop operation
d) push operation
11. Define Primary key. 1
12. Which method is used to get the row-id of the last modified 1
row?
(A) cursor.getrowid()
(B) cursor.endrowid()
(C) cursor.lastrowid()
(D) cursor.exitrowid()
13. Which of the following function headers is correct? 1
a) def fun(a = 2, b = 3, c): b) def fun(a = 2, b, c = 3):
c) def fun(a, b = 2, c = 3): d) def fun(a, b, c = 3, d):
14. Mandatory arguments required to connect any database 1
from Python
(A) Username, Password, Hostname, Database Name, Port.
(B) Username, Password, Hostname.
(C) Username, Password, Hostname, Database Name.
(D) Username, Password, Hostname, Port.
15. Suppose a tuple T is declared as T = (10, 12, 43, 39), which 1
of the following is incorrect?
a) print(T[1]) b) T[2] = -29 c) print(max(T)) d) print(len(T))
16. Which of the following statement is outside the function 1
“sum”?
def sum():
a = int(input(“Enter number”))#Statement 1
b = int(input(“Enter number”)) #Statement 2
s = a + b #Statement 3
print(s) #Statement 4
a. Statement 1
b. Statement 2
c. Statement 3
d. Both Statement 3 and Statement 4
17. Raj wants to make EmpNo and PFNo columns of his table as 1
the primary key. Is it possible?
(a) Yes
(b) No
(c) Yes , possible as a combination of columns
(d) None of the above
18. Which technique is followed by stacks? 1
19. Write a statement in Python to declare a dictionary whose 1
keys are 1, 2, 3 and values are Monday, Tuesday and
Wednesday respectively
20. In the following question, A statement of Assertion (A) is 1
followed by a statement of Reason (R). Mark the correct
choice as.
(A) Both A and R are true and R is the correct explanation
for A.
(B) Both A and R are true and R is not correct explanation
for A.
(C) A is true but R is false.
(D) A is false but R is true.

Question. Assertion (A): A referential integrity is a system


of rules of DBMS.
Reason (R): It ensures that user don’t accidently delete or
change related data.
21. What is the situation when one tries to push an item in 1
stack that is full?
a) peek
b) underflow
c) overflow
d) pop

Section – II

Both the Case study based questions are compulsory. Attempt any 4

sub parts from each question. Each question carries 1 mark

Question Question Marks


No. allotted
22. A departmental store MyStore is considering to maintain 1x4=4
their inventory using SQL to store the data. As a database
administer, Abhay has decided that :
• Name of the database - mystore
• Name of the table - STORE
• The attributes of STORE are as follows:
 ItemNo - numeric
 ItemName – character of size 20
 Scode - numeric
 Quantity – numeric
Table : STORE
ItemNo ItemName Scode Quantity
2005 Sharpener Classic 23 60
2003 Ball Pen 22 50
2002 Gel Pen Premium 21 150
2006 Gel Pen Classic 21 250
2001 Eraser Small 22 220
2004 Eraser Big 22 110
2009 Ball Pen 21 180

(a) Identify the attribute best suitable to be declared as a


primary key.
(b) Write the degree and cardinality of the table STORE.
(c) Insert the following data into the attributes ItemNo,
ItemName and SCode respectively in the given table
STORE. ItemNo = 2010, ItemName = “Note Book” and
Scode = 25
(d) Abhay want to remove the table STORE from the
database MyStore. Which command will he use from
the following:
a) DELETE FROM store;
b) DROP TABLE store;
c) DROP DATABASE mystore;
d) DELETE store FROM mystore;
(e) Now Abhay wants to display the structure of the table
STORE, i.e, name of the attributes and their respective
data types that he has used in the table. Write the
query to display the same.
23. Jagriti is working on a student management project where 4
Python is being used as front-end and MySQL as back-end
tool. She needs to
(i) write a program which asks for student’s admission
no (admno) and displays the record.
(ii) insert a new record.

Write a Python program to achieve the above two goals using


the following guidelines :-
(a) Name of user = admin
(b) Password = 93872
(c) Database = SchoolDB
(d) Name of table :- Stud_info
(e) Mandatory fields in Stud_info =
rollno,admno,sname,age,father,mother
(f) Primary key = admno

Part – B

Section – I

Question Question Marks


No. allotted
24. What will be the output of the following code? 2
25. Convert the following infix expression to its equivalent 2
postfix expression, showing the stack contents for each step
of conversion. P/(Q+(R-T)*U
26. What do you understand by Candidate Keys in a table? Give 2
a suitable example of Candidate Keys from a table
containing some meaningful data.
27. Find and write the output of the following Python code: 2

28. Rewrite the following code in Python after removing all 2


syntax error(s).
Underline each correction done in the code.
29. Evaluate the following postfix expression: (show status of 2
stack after each operation)
100,40,8,/,20,10,-,+,*
30. Differentiate between fetchone() and fetchall() methods with 2
suitable examples for each.
31. Given below is a table ‘Item’ in database ‘Inventory’. 2

Riya created this table but forgot to add column


ManufacturingDate. Write Python code to add this column
to the ar

32. Rev py basic 2


33. Dbms and sql 2

Section – II

Question Question Marks


No. allotted
34. Func 3
35. Rev py basic 3
36. Dbms and sql 3
37. Stack 3

Section – III

Question Question Marks


No. allotted
38. Func 5
39. Stack 5
40. Dbms and sql 5

You might also like