Model School: Mid Term Examination (2024-25) Class-XII
Model School: Mid Term Examination (2024-25) Class-XII
1 PTO
ix. A table, Students has been created in a database with the following fields:
StudentID, NAME, DOB, CITY, MARKS Give the SQL command to change
the datatype of CITY from Varchar(30) to Char(30).
x. What are SQL Joins?
xi.The default mode of opening a file in Python is ______.
xii. Which function is used to establish connection between Python and SQL.
xiii. Name the python library that can be used for connectivity with databases.
Q14 and 15 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
xiv. Assertion(A): Python overwrites an existing file or creates a non- existing file
when we open a file with ‘w’ mode.
Reason(R): a+ mode is used only for writing operations
xv. Assertion ( A): In SQL, the aggregate function avg() calculates the average value
on a set of values and produces a single result.
Reason ( R): The aggregate functions are used to perform some fundamental
arithmetic tasks such as min(), max(), sum() etc
SECTION - B
Q2. Answer the following questions – 8
i. Satheesh has created a database “school” and table “student”. Now he wants to
view all the databases present in his laptop. Help him to write SQL command
for that , also to view the structure of the table he created.
ii. Meera got confused with DDL and DML commands. Help her to select only
DML command from the given list of command. UPDATE , DROP TABLE,
SELECT , CREATE TABLE , INSERT INTO, DELETE.
iii. Consider the following query :
Select sname from subjects where sname like ???
Which string should replace ??? to display the names of the subjects that
end with ‘CE’?
iv. Name aggregate function(s) that ignore null value.
Q3. Evaluate following postfix expression while showing status of stack after each
operation given A = 3, B = 5, C = 1, D = 4.
AB * C / D * 2
Q4. When are the following built-in exceptions raised? Give examples to support
your answers. 2
2
PTO
a) Indexerror b) NameError
Q5. Complete the following code 3
print (" Practicing for try block")
try:
numerator=50
denom=int(input("Enter the denominator"))
quotient=(numerator/denom)
print ("Division performed successfully")
except_______________:
print ("Denominator as ZERO is not allowed")
except _______________:
print ("Only INTEGERS should be entered")
else:
print ("The result of division operation is ", quotient)
________:
print ("OVER AND OUT")
Q6. Write a program in Python to replace a character by another character in a file
“story.txt”.(Accept both the characters from the user). 3
SECTION –C
Q7. Imagine you are working with a table named "Customers," designed to store
records of online customers. The table has the following columns: CustomerID,
Name, City, Purchase, Amount, and Date. 4
3 PTO
b) To delete the column City from the table.
Q8. A list contains the following records of students: [Student_name, Percentage,
State] Write the following user-defined functions to perform given operations
on the stack named student: 4
(i) Push_Student(SDetails) - A function to push an object containing the
name, percentage, and state of students who have a percentage greater
than 85 into the stack. Also, display the count of students pushed into
the stack.
(ii) Pop_Student() - A function to pop the objects from the stack and
display them. If the stack is empty, display "Stack Empty."
Q9. Consider the following tables ACTIVITY and COACH and answer (a) and (b)
parts of this question : 4