Pbi Xii CS QP
Pbi Xii CS QP
Pbi Xii CS QP
General Instructions:
• Please check this question paper contains 35 questions.
• The paper is divided into 4 Sections- A, B, C, D and E.
• Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
• Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
• Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
• Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
• Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
• All programming questions are to be answered using Python Language only.
S.NO QUESTION MARKS
SECTION A
1 State True or False: 1
“The else clause of python loop executes when the loop terminates
normally”
2 What is the maximum value that can be stored in NUMERIC (4, 2)? 1
a. 9999.99 b. 99.9999 c. 99.99 d. 9.99
3 What is the output of the following expression? 1
print( float(5+int(4.39+2.1)%2))
a. 5 b. 5.0 c.8.0 d. 8
4 Select correct output of the python code: 1
X="Swatchtha Hi Seva @ Swatcch Bharat"
Y=X.split()
print(Y)
a. ['Swatchtha Hi Seva', '@', 'Swatcch Bharat']
b. ['Swatchtha Hi', 'Seva@', 'Swatcch', 'Bharat']
c. ['SwatchthaHi’, 'Seva', '@', 'SwatcchBharat']
d. ['Swatchtha', 'Hi', 'Seva', '@', 'Swatcch', 'Bharat']
5 In the following SQL Query which type of join is mentioned? 1
SELECT customer.cust_id, order.cust_id , name, order_id from
customer,order WHERE customer.cust_id=order.cust_id;
a. Equi Join b. Natural Join c. Cross Join d. Cartesian Product
6 Network in which every computer is capable of playing the role of a 1
client, or a server or both at same time is called
a. local area network b. peer-to-peer network
c.dedicated server network d. wide area network
7 Given the following dictionaries 1
dict_fruit={"Banana":"Yellow", "DraganFruit":"Pink"}
dict_vegetable={"Chilli":"Green", "Brinjal":"Purple"}
Which statement will merge the contents of both dictionaries?
a. dict_fruit.update(dict_vegetable) b. dict_fruit + dict_vegetable
c. dict_fruit.add(dict_vegetable)
d.dict_fruit.merge(dict_vegetable)
8 Which of the following statement(s) would give an error after 1
executing the following code?
Str="BharatiyaBashaUtsav" # Statement 1
print(Str) # Statement 2
Str="India @ 75" # Statement 3
Str[1]= '$' # Statement 4
Str=Str+"Thank you" # Statement 5
a. Statement 1 b. Statement3 c. Statement 4 d. Statement 5
9 Consider the statements given below and then choose the correct 1
output from the given options:
tp1=(10,15,20,60)
tp1=tp1+(3)
print(tp1)
a. (10,15,20,60,3) b. (3,10,15,20,60)
c. (10,15,20,60, (3)) d. Error
10 What could be the minimum possible and maximum possible 1
numbers generated by following code?
import random
print(random.randint(3,10)-3)
a. 0,7 b. 1,8 c.3,10 d. 2,9
11 A device that forwards data packet on dissimilar networks is called a 1
____________
a. Bridge b. Hub c. Router d. Gateway
12 Find and write the output of the following python code: 1
a=10
def call():
global a
a=15
b=20
print(a)
call()
a. 10 b. 20 c. 15 d. 25
13 State whether the following statement is True or False 1
“Every syntax error is an exception but every exception cannot be a
syntax error”
14 Fill in the blank: 1
An attribute in a relation can be a foreign key if it is the ________ key
in any other relation.
a. Candidate Key b. Foreign Key
c. Primary Key d. Unique Key
15 ______________is a communication methodology designed to establish 1
a direct and dedicated communication between an internet user and
his/her ISP.
a. VoIP b. SMTP c.PPP d.HTTP
16 Which function is used to write a list of string in a file? 1
a. writeline()
b. writelines()
c. writestatement()
d. writefullline()
Q17 and 18 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):Key word arguments are related to the function calls 1
Reason(R): When you use keyword arguments in a function call, the
caller identifies the arguments by the parameter name
18 Assertion (A) : In Python, a stack can be implemented using a list. 1
Reasoning (R) : A stack is an ordered linear list of elements that
works on the principle of First In First Out (FIFO).
SECTION B
19 a. Expand the following: 1+1=2
i. FTP ii. IMAP
b. What is the use of XML
(OR)
Write one advantage and one disadvantage of guided over unguided
communication media.
20 Kunika, a Python programmer, is working on a project in which she 2
wants to write a function to count the number of even and odd
values in the list. She has written the following code but his code is
having errors. Rewrite the correct code and underline the corrections
made.
define EOcount(L):
evensum=oddsum=0
for i in range(0,len(L))
if L[i]%2=0:
evensum+=1
Else:
oddsum+=1
print(evensum, oddsum)
21 Write a function Show_sal(EMP) in python that takes the dictionary, 2
EMP as an argument. Display the salary if it is less than 25000
Consider the following dictionary
EMP={1:18000,2:25000,3:28000:4:15000}
The output should be:
18000
15000
EMP={1:18000,2:25000,3:35000,4:15000}
(OR)
Write a function, VowelWords(Str), that takes a string as an
argument and returns a tuple containing each word which starts
with an vowel from the given string
For example, if the string is "An apple a day keeps the doctor away”,
the tuple will have (“An”,”apple”,”a”, “away”)
22 Predict the output of the Python code given below: 2
L=[4,3,6,8,2]
Lst=[]
for i in range(len(L)):
if L[i]%2==0:
t=(L[i],L[i]**2)
Lst.append(t)
print(Lst)
23 Write the Python statement for each of the following tasks using 1+1=2
BUILT-IN functions/methods only:
i. To return index position of substring in given string.
ii. To delete first occurrence of an item in the list
(OR)
A list named stu_marks stores marks of students of a class. Write
the Python command to import the required module and display the
average of the marks in the list.
24 Differentiate between Alter and Update? 2
OR
What is the difference between WHERE and HAVING clause of
SQL statement?
25 Predict the output of the following code: 2
def ChangeVal(M,N):
for i in range(N):
if M[i]%5==0:
M[i]+=5
if M[i]%3==0:
M[i]+=3
L=[5,8,15,12]
ChangeVal(L,4)
for i in L:
print(i,end='$')
SECTION C
26 Predict the output of the following code: 3
L1=[10,20,30,40,12,11]
n=2
l=len(L1)
for i in range (0,n):
y=L1[0]
for j in range(0,l-1):
L1[j]=L1[j+1]
L1[l-1]=y
print(L1)
27 Consider the table SportsClub given below and write the output of 1*3=3
the SQL queries that follow.
Table:SportsClub
Based on the given table write SQL queries for the following:
i. Change the Flavour of the chips to “black salt “ for those chips
whose flavour is “SALTY”
ii. Display the Brand_Name ,Flavour and Total
Amount(price*quantity) of those chips whose Brandname ends
with ‘s’. Total Amount column name should also be displayed.
iii. Delete the records of those chips whose quantity is less than 10
30 Write a function in Python, Push(Cosmetics) where, Cosmetic is a 3
dictionary containing the details of products– {Pname:price}.
The function should push the names of those products in the stack
whose price is greater than 130.
Also display the count of elements pushed into the stack.
For example:
If the dictionary contains the following data:
Ditem = {“FaceWash”:105, "Facepack":150, "CleansingMilk":130,
"Sunscreen": 180, "FaceMask":115}
The stack should contain
Facepack
Sunscreen
The output should be:
The count of elements in the stack is 2
SECTION D
31 Consider the following tables BOOKS and ISSUED in a database 1*4=4
named “LIBRARY”.
Write SQL queries for the following:
i. Display bookname, Author name and quantity issued from
table Books and issued.
ii. Display the details of books in the order of qty whose price
is in between 200 to 300
iii. Display total qty of books of type “Computer”
iv. List the tables in the database Library
32 Mandeep is a Python programmer working in C-company. For storing 4
details of employees working in the company, he has created a csv
file named record.csv, to store the
The structure of record.csv is :
[Emp_Id, Emp_Name, Mobile, Salary]
Where
Emp_Id is Employee ID (integer)
Emp_Name is Employee Name (string)
Mobile is to store mobile number of employee (integer)
Salary – Salary earned by the employees(integer)
Mandeep want to write program in Python that defines and calls the
following user defined functions:
a) ADD() – To accept and add data of an employee to a CSV file
‘record.csv’. Each record consists of a list with field elements as
empid, name and mobile andemployee salary respectively.
b) COUNTR() – To count the number of records present in the CSV
file named ‘record.csv’.
As python expert help him complete the task
SECTION E
33 A company SUN Enterprises has four blocks of buildings as shown: 1*5=5
B1 B2 B3 B4
****************************