0% found this document useful (0 votes)
86 views10 pages

Mid Term Practice Paper

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)
86 views10 pages

Mid Term Practice Paper

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/ 10

SRI SRI RAVISHANKAR VIDYA MANDIR

BANGALORE EAST
MID-TERM 2023– 2024 PRACTICE PAPER
Name: Date:
Subject: Computer Science Class: XII
Duration: 3 hours Max.Marks:70

General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 3 questions (31 to 33). Each question carries 5 Marks.
7. Section E, consists of 2 questions (34 to 35). Each question carries 4 Marks.
8. All programming questions are to be answered using Python Language only.

Ques SECTION - A Mar


tion ks
No. Allo
cat
ed

1 Which of the following is NOT a required argument to the connect() function? 1


a. Hostname
b. Username
c. Password
d. Database name

2 In the relational model, relationships among relations/table are created by 1


using keys.
(a) composite (b) alternate (c) candidate (d) foreign

3 Which keyword is used for table aliasing that involves giving a table short and 1
alternative name to simplify query syntax?
a. from
b. as
c. where
d. on

4 Consider the following tables Uniform and Cost: 1

What will be the number of rows and columns for the following statement?
SELECT * FROM Uniform NATURAL JOIN Cost;

5,5 b. 4, 4 c. 4, 5 d. 5, 6

5 The clause is used to display result of an SQL query in ascending 1


or descending order with respect to specified attribute values

6 In an SQL table, if the primary key is combination of more than one field, then 1
it is called as .
7 If column “salary” of table “EMP” contains the dataset {10000, 15000, 25000, 1
10000,25000}, what will be the output of following SQL statement?
SELECT SUM(DISTINCT SALARY) FROM EMP;
a) 75000 b) 25000 c) 10000 d) 50000

8 D={“AMIT”:90,”RESHMA”:96,”SUMAN”:92} 1
print(“SUMAN” in D, 90 in D, sep=”#”)
(a) True#False (b) True#True (c) False#True (d) False#False
9 Evaluate the following 1
35/5 or 5.0 + 30/10
a. True b. 7.0 c. 8.0 d. 7
10 Choose the most correct statement among the following – 1
(a) a dictionary is a sequential set of elements
(b) a dictionary is a set of key-value pairs
(c) a dictionary is a sequential collection of elements having key-value pairs
(d) a dictionary is a non-sequential collection of elements

11 Identify the invalid Python statement from the following. 1


(a) _b=1 (b) b1= 1 (c) b_=1 (d) 1 = _b

12 Identify the errors in the following code: 1


MyTuple1=(1, 2, 3) #Statement1
MyTuple2=(4) #Statement2
MyTuple1.append(4) #Statement3
print(MyTuple1, MyTuple2) #Statement4
(a) Statement 1 (b) Statement 2 (c) Statement 3 (d) Statement 2 &3

13 Suppose str1= ‘welcome’. All the following expression produce the same result 1
except one?
(a) str[ : : -6] (b) str[ : : -1][ : : -6] (c) str[ : :6] (d) str[0] + str[-1]

14 To include non-graphic characters in python, which of the following is used? 1


a. Special Literals
b. Boolean Literals
c. Escape Character Sequence
d. Special Literal – None

15 What will be output of following code: 1


X = 50
def funct(X):
X=2
funct (X)
print(“X is now: “, X)
a) X is now: 50 b) X is now: 2 c) Error d) None of the above
16 Which of the following expression(s) is an example of type casting? 1
a) 4.0+float(6)
b) 5.3+6.3
c) 5.0+3
d) None of these
Q17 and Q18 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

17 Assertion (A): The function definition calculate(a, b, c=1,d) will give error. 1
Reason (R): All the non-default arguments must precede the default
arguments.

18 Assertion (A): A referential integrity is a system of rules of DBMS. 1


Reasoning (R): It ensures that user don't accidently delete or change related
data.

SECTION-B

19 Give two-point difference between equi-join and natural join . 2

20 Arjun has written a program using function to find and return the sum of 2
natural numbers up to the given limit i.e. Number. Identify the logical and
syntactical errors in the program segment given below. Rewrite the corrected
code and underline each corrections made.

def Tot (Number):


for C in RANGE (1, Number + 1):
Sum + = C
return Sum
print(Tot(3))
print(Tot(6))

21 Differentiate between Drop and Delete commands of MYSQL. Write its syntax. 2

22 Write the Python statement for each of the following tasks: 2


(i) To insert an element at the last position of the given list L using insert
function.
(ii) Write a single statement to delete all the elements from position 2 to
5(including 5) for a given list L.
23 (i) Vani has already created a table named Customer that have fields 2
Cno, Custname, Address,Amount. Now she wants to apply primary
key constraint to attribute Cno. Write a MySQL statement for it.
(ii) Help her to remove the column Amount from the table customer.
24 Predict the output of the following code: 2
R=0
def change( A , B ) :
global R
A += B
R +=3
print(R , end='%')
change(10 , 2)
change(B=3 , A=2)

25 Find output generated by the following code: 2


string=" aababcb"
count=3
while True:
if string[0]=='a':
string=string[2:]
elif string[-1]=='b':
string=string[:2]
else:
count+=1
break
print(string)
print(count)
SECTION – C

26 Consider the table GRADUATE given below and write the output of the SQL 3
queries that follow.
i) SELECT COUNT(DISTINCT SUBJECT) FROM GRADUATE;
ii) SELECT STIPEND*12, NAME FROM GRADUATE WHERE DIV=’I’ AND
AVERAGE >65;
iii) SELECT * FROM GRADUATE WHERE SUBJECT NOT IN(‘PHYSICS’,
‘CHEMISTRY’);

27 Write a function INDEX_LIST(L), where L is the list of elements passed as 3


argument to the function. The function returns another list named ‘indexList’
that stores the indices of all Elements of L which has even number in its unit
place.
For example:
If L contains [12,4,15,11,9,56]
The indexList will have - [0,1,5]
28 Sagar has to create a database EMPDATA for his company and he wants to 3
enter details of all the employees in the table EMPLOYEE. Table has the
following structure. Help him create the database and the Table.
Table: EMPLOYEE
FIELD NAME DATA TYPE REMARKS
EMPID CHAR(5) PRIMARY KEY
EMP_NAME CHAR(15) CANNOT BE EMPTY
DESIGNATION CHAR(15)
BASIC FLOAT
ADDRESS CHAR(25)
29 As part of Fit India Campaign, Suresh has started a juice shop that serves 3
healthy juices. As his database administrator, answer the following questions
based on the data given in the table below.
Table : HEALTHYDRINKS

i) Increase the price of the juices by 3% whose name begins with ‘A’.
ii) Delete the record of those juices having calories more than 140.
iii) Insert the following record into the table
DrinkCode – 107, Dname – Santara Special, Price – 25.00, Calorie –
130
30 Write a menu driven python program using a single function that can perform 3
i. sum of squares of 2 numbers passed as arguments
ii. sum of squares of 3 numbers passed as arguments
iii. Exit from the program
For example:
If a=2 and b=3, where a and b are parameters to function. Then the function
should return the value 22+32 i.e. 13.
Similarly, if a=2, b=3 and c=10, where a,b,c are parameters to the same
function. Then the function should return the value 22+32+102 i.e. 113.
SECTION – D

31 i) Write the command to list all the database. 5


ii) Answer the Question that follows the below two tables:
Table : Event

Table : Company
1. Which field(along with table name) will be considered as the foreign key
as per the above tables.

2. Name all the fields from the relation Event which are capable of being a
candidate key

3. Display the structure of table Event.

4. What will be the cardinality and degree for the cartesian product of
Event and Company table.

32 i) What possible output(s)(choose from (i)-(iv)) are expected to be 2+3


displayed on screen at the time of execution of the program from the
following code? Also specify the maximum value that can be assigned
to each of the variables L and U.

import random
Arr=[10,30,40,50,70,90,100]
L=random.randrange(1,3)
U=random.randrange(3,6)
for i in range(L,U+1):
print(Arr[i],"@",end="")

(i) 40 @50 @
(ii) 10 @50 @70 @90 @
(iii) 40 @50 @70 @90 @
(iv) 40 @100 @

ii) Write a python program to Convert the string S into the Dictionary D.
The format of input string and output dictionary is given below.

S = "Jan=January;Feb=February;Mar=March"
D = {' Jan ': ' January', ' Feb ': ' February', ' Mar ': ' March'}
33 i) Write the output for the following python code: 2+3
def Quo_Mod (L1):
L1.extend([33,52])
for i in range(len(L1)):
if L1[i]%2==0:
L1[i]=L1[i]/5
else:
L1[i]=L1[i]%10
L=[100,212,310]
print(L)
Quo_Mod(L)
print(L)

(i) Write a function List_Shift(Arr) in Python, which accepts a list of


strings. Create a tuple which stores all strings with two characters
followed by all strings with three characters and discards rest of the
strings with any other length.
L=[“Cat”,”AM”,”A”,”Three”,”Hat”,”Bit”,”IS”,”I”]
T=(“AM”,”IS”,”Cat”,”Hat”,”Bit”)

SECTION – E

34 Write a python program to insert 5 records in Employee table. Take these 5 4


records as an input from the user (One record at a time).

Note the following to establish connectivity between Python and MySQL:


Username is root
Password is 12345
hostname is localhost
The table exists in a MySQL database named company.
The table has five attributes (Emp_ID, Emp_Name, DOJ, Gender, Salary)
35 Write queries (a) to (d) based on the tables Sender and Recipients given 4
below:
Table : Sender

Table : Recipients

(a) To display the names of all Senders from Mumbai.

(b) To display the RecID, Sendername, SenderAddress, RecName,


RecAddress for every Recipient.

(c) To display Recipient details in ascending order of RecName.

(d) To display number of Recipients from each city.

You might also like