0% found this document useful (0 votes)
36 views4 pages

Model School: Mid Term Examination (2024-25) Class-XII

ddd

Uploaded by

hardiksuneja07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views4 pages

Model School: Mid Term Examination (2024-25) Class-XII

ddd

Uploaded by

hardiksuneja07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MODEL SCHOOL

Run by - MODEL EDUCATION SOCIETY, ROHTAK


Mid Term Examination (2024-25)
Class- XII
Subject – COMPUTER SCIENCE
Time: 2:15 hrs Date - 25/11/24 M.M- 50
General Instructions—
1. All questions ae compulsory.
2. This paper contains 3 Sections i.e. Section -A , Section B and Section C.
3. Section -A contains 15 questions carrying 1 mark each under question 1.
4.Section -B contains 5 questions.
5. Section –C contains 4 questions.
SECTION - A
Q1 Answer the following questions: 15
i. State True or False:
“Count (*) function in SQL counts all rows ,regardless of whether they
contain NULL values or not”.
ii. If a table which has one Primary key and two alternate keys. How many
Candidate keys will this table have?
a. 1 b. 2 c. 3 d. 4
iii.Write the missing statement to complete the following code:
file = open("example.txt", "r")
data = file.read(100) _____ #Move the file pointer to the beginning of the file
next_data = file.read(50)
file.close()
iv. Which of the following functions changes the position of file pointer and returns
its new position?
a.flush() b.tell() c.seek() d.offset()
v. What is Overflow situation in Stack?
vi. In SQL, name the clause that is used to display the tuples in ascending order of
an attribute?
vii. What does the SQL command WHERE do in a SELECT statement?
a. Specifies the columns to be retrieved
b. Filters rows based on a condition
c. Groups rows by a specified column
d. Arranges rows in ascending or descending order
viii. Name 4 Data types used to store Numeric data in Databases?

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

CustomerID Name City Purchase Amount Date


C001 Priya Delhi Laptop 55000 2023-01-15
C002 Jiya Orissa Smartphone 42000 2023-09-12
C003 Mukesh Jaipur Tablet 33000 2023-07-09
C004 Harish Ghaziabad Headphones 1800 2023-09-19
C005 Geeta Delhi Laptop 79000 2023-10-10

Based on the data given above answer the following questions:


i. Identify the most appropriate column, which can be considered as Primary
key.
ii. What is the cardinality of the table?
iii. Write SQL commands for the following:
a) To add a new column Date of Delivery.

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

Write SQL commands for the following statements:


1. To display the names of all activities with their Acodes in descending order.
2. To display sum of PrizeMoney for the Activities played in each of the
Stadium separately.
3. To display the coach’s name and acodes in ascending order of Acode from the
table Coach.
4. To display the content of the Activity table whose schedule date earlier than
01-01-2004 in ascending order of Participants Num.
Q10. Design a Python application that fetches all the records from Pet table of
menagerie database. 5

You might also like