12 CS 2024-25 SQP 3
12 CS 2024-25 SQP 3
Page 1 of 7
a) <objectvariable>=pickle.load(<fileobject>) b) pickle.load(<fileobject>, <objectvariable>)
c)
a) <fileobject>.load(<objectvariable>) d) <objectvariable> = <fileobject>.load( )
12. The clause is used to display result of an SQL query in ascending or descending order 1
with respect to specified attribute values
13. Fill in the blank: 1
is the protocol used for transferring files from one machine to another.
a) HTTP b) FTP
e) c) SMTP d) VOIP
14. How will the following expression be evaluated in Python? 1
2 + 9 * ( ( 3 * 12) – 8 ) / 10
a) 29.2 b) 25.2
c) 27.2 d) 27
15. Which function is used to display the sum of values in a specified column ? 1
a) COUNT(column) b) TOTAL(column)
c) SUM(column) d) ADD(column)
16. To open a connector to the MySQL database, which statement is used to connect with MySQL ? 1
a) connector b) connect c) password d) username
17. Which of the following statement(s) would give an error after executing the following code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Thank you" # Statement 5
(a) Statement 3 (b) Statement 4 (c) Statement 5 (d) Statement 4 and 5
18. Consider the following operation performed on a stack of size 5.
Push(1)
Pop()
Push(2)
Push(3)
Pop()
Push(4)
Pop()
Pop()
Push(5)
After the competition of all operation, the number of elements present is stack are
(a) 1 (b) 2 (c) 3 (d) 4
19. Which keyword is used to catch exceptions in Python?
a) try (b) catch (c) except (d) d) handle
Q20 and 21 are ASSERTION AND REASONING based questions. 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 the correct explanation for A
(c) A is True but R is False
(d) A is False but R is True
20. Assertion (A) : A variable defined outside any function or any block is known as a global variable. 1
Reason (R) : A variable defined inside any function or a block is known as a local variable.
21. Assertion (A) : The tell( ) method returns an integer that specifies thecurrent position of the file 1
object in the file.
Reason (R) : Offset can have any of the three values – 0, 1 and 2
SECTION B
22. Observe the following Python code very carefully and rewrite it after removing all syntactical errors 2
Page 2 of 7
with each correction underlined.
DEF result_even( ):
x = input(“Enter a number”)if (x % 2 = 0) :
print (“You entered an even number”)else:
print(“Number is odd”)
even ( )
23. Write two points of difference between LAN and WAN. 2
(OR)
Write two points of difference between HTTP and SMTP.
24 (a) Given is a Python string declaration: 1
str1="!!Welcome to Python!!"
Write the output of: 1
print(str1[::-2])
(b) Write the output of the code given below:
dict1 = {"name": "Suman", "age": 36}
dict1['age'] = 27
dict1['address'] = "Chennai"
print(dict1.keys())
25. Write a Python program that executes division and handles an ArithmeticError exception if there is 2
an arithmetic error.
26. (a) Expand the following: 1
i) XML ii) HTML
(b) What is the use of PPP in computer networks? 1
27. Observe the following Python code very carefully and rewrite it after removing all syntactical 2
errors with each correction underlined.
DEF execmain ():
x=input ("Enter a number :")
if (abs(x)=x):
print"You entered a positive number" else:
x=*-1
print"Number made positive:"x
execmain()
28. Differentiate between COUNT(*) and SUM( ) functions in SQL with appropriate example. 2
(OR)
Categorize the following commands as DDL or DML: CREATE, DROP, UPDATE, INSERT
SECTION C
29. Write a function in python to count the number lines in a text file ‘Country.txt’ which is starting 1+2
with an alphabet ‘W’ or ‘H’. If the filecontents are as follows:
Whose woods these are I think I know.
His house is in the village though;
He will not see me stopping here
To watch his woods fill up with snow.
The output of the function should be:W or w : 1
H or h : 2
(OR)
Write a user defined function countwords( ) to display the total number of words present in the text
file “Quotes.Txt”. If the text file has the following data written in it:
Page 3 of 7
Becoming the best version of you
For example:
If the dictionary contains the following data:
Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain
Notebook
Pen
The output should be
The count of elements in the stack is 2
31. Predict the output of the following Python code: 3
def Bigger(N1,N2):
if N1>N2:
return N1
else:
return N2
Page 4 of 7
L=[32,10,21,54,43]
for c in range (4,0,-1):
a=L[c]
b=L[c-1]
print(Bigger(a,b),'@', end=' ')
(OR)
SECTION D
32. As part of Fit India Campaign, Suresh has started a juice shop that serveshealthy juices. As his 1+1+2
database administrator, answer the following questions based on the data given in the table below.
Table : HEALTHYDRINKS
Page 5 of 7
stores the records of various products such as Television, Refrigerator, Air-conditioner, etc. under
different fields as mentioned below:
Code Item Company Price Quantity
T01 Television LG 43000 15
T02 Television Sony 55000 20
F01 Refrigerator LG 35000 10
(i) Now display the details of all televisions of various comparisons from the file.
(ii) Count the number of records those item quantity more than 20.
34. In a Database Company, there are two tables given below: 4
Table: SALES
SALESMANID NAME SALES LOCATIONID
S1 ANITA SINGH ARIRA 250000 102
S2 Y.P. SINGH 1300000 101
S3 TINA JAISWAL 1400000 103
S4 GURDEEO SINGH 1250000 102
S5 SIMI FAIZAL 1450000 103
Table: LOCATION
LOCATIONID LOCATIONNAME
101 Delhi
102 Mumbai
103 Kolkata
104 Chennai
Write SQL queries for the following :
(i) To display SalesmanID, Name of salesman, LocationID with corresponding location names.
(ii) To display name of salesmen, sales and corresponding location names who have achieved Sales
more than 1300000.
(iii) To display names of those salesmen who have ‘SINGH’ in their names.
(iv) (A) Indentify Primary key in the table SALES. Give reason for your choice.
OR
(B) Write SQL command to change the LocationID to 104 of the Salesman with ID as S3 in the
table ‘SALES’.
35. The code given below inserts_and_show() the following record in the table Employee: 4
Empid – integer
Name – string
salary-float
Note the following to establish connectivity between Python and MYSQL:
• Username is root
• Password is tiger
• The table exists in a MYSQL database named Empolyee.
• The details (Empid, Name, salary) are to be accepted from the user.
SECTION E
36. Python University is setting up its academic blocks at Chennai 5
and is planning to set up a network. The University has 3 academic blocks and one Human Resource
Center as shown in the diagram below:
Page 6 of 7
Center to Center distances between various blocks/center is as follows:
Page 7 of 7