Xii Comp Sci MQP 15
Xii Comp Sci MQP 15
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written
Q.No Mark
. SECTION-A (21 x 1 = 21 Marks) s
1 Find the invalid identifier [1]
(A) Name (B) break (C) marks 12 (D) section
2 Evaluate the expression given below A=16 and B=15 A%B//A [1]
(A) 0.0 (B) 0 (C) 1.0 (D) 1
3 AL is defined as follows : AL=[1,2,3,4,5] Which of the following statement removes the [1]
middle element from it so that the list AL equals to [1,2,4,5]
20 Assertion (A):Modifying a string creates another string internally but modifying a list cannot [1]
create a list internally
Reason(R): Stings are immutable types whereas Lists are mutable types in Python.
Assertion (A): Exception handling code is clear and block based in Python. [1]
21 Reasoning (R): The code where unexpected runtime exception may occur is separate from
the code where the action takes place when an exception occurs.
SECTION-B ( 7 x 2=14 Marks)
22 Predict the output of the following : [2]
fruit={}
f1=['Apple', 'Banana', 'apple', 'Banana']
for index in f1:
if index in fruit:
fruit[index]+=1
else:
fruit[index]=1
print(fruit)
print(len(fruit))
23 Write the difference between actual parameter and formal parameter with example? [2]
24 Write the Python statement for each of the following tasks using BUILT-IN functions /
methods only:
I)
A. To update dictionary d1 with dictionary d2
or
B. Write the code to remove the fifth element from the list L?
II)
(A ) To add an element 10 in 2nd position into the list age.
or
( B) To replace the letter m with ‘@’ in a string “ Computer Science” holding the variable
name as subject?
25 Consider the following code : [2]
import random
AR=[20, 30,40, 50,60,70]
Lower=random.randint(1,3)
Upper=random.randint(2,4)
for K in range(Lower, Upper+1):
print(AR[K],end=’#’)
What possible output(S) are expected to be displayed on the screen at the time of
execution of the program from the following code?
(A) 10#40#70# (B) 30#40#50# (C) 50#60#70# (D) 40#50#60#
26 Rewrite the following code in Python after removing all syntax error(s). Underline each [2]
correction done in the code.
Value=39
for VAL in range(0,Value)
If val%4==0:
print(VAL*4)
Elseif val%5==0:
print(VAL+3)
Else:
print(VAL+10)
27 (i) (A) A table1 has 5 records and 4 columns another table2 has 6 rows and 3 columns .If 2 [2]
records are added in table2 and 2 columns are removed from table 1 .After cartesan product
of table1 and table2 what is its degree and cardinality?
Or
(B) Which declaration of datatype helps to enter same number of characters everytime ?
(ii ) (A) Which command helps to increase the cardinality of a table?
Or
(i) Push (st, expression), where expression is a string containing a valid arithmetic expression
with +, -, *, and / operators, and st is a list representing a stack. The function should push all
the operators appearing in this expression into the stack st.
(ii) Pop(st) to pop all the elements from the stack st and display them. It should also display
the message 'Stack Empty' when the stack becomes empty.
iii) Main program to accept the expression from the user and add only arithmetic expression
using function call statements accordingly.
31 x = 25 [3]
def modify(s, c=2):
global x
for a in s:
if a in 'QWEiop':
x //= 5
print(a.upper(),'@',c*x)
else:
x += 5
print(a.lower(),'#',c+x)
string = 'We'
modify(string,10)
print(x, '$', string)
OR
Predict the output of the following code:
L=[2,4,6,8,10]
for i in L:
for j in range(I,len(L)+1):
print(j,’#’,end=””)
print()
SECTION – D (4 X 4 =16 MARKS)
32 Write the output of the queries (i) to (iv) based on the table PRODUCTS given below: [4]
Table: PRODUCTS
CODE ITEM QTY PRIC TDATE
E
1001 Plastic Folder 14'' 100 3400 2014-12-14
1004 Pen Stand Standard 200 4500 NULL
1005 Stapler Mini 250 1200 2015-02-28
1006 Punching Machine NULL 1400 2015-03-12
Small
1009 Stapler Big 100 1500 NULL
i) SELECT COUNT(TDATE) FROM PRODUCTS;
ii) SELECT MAX(TDATE) FROM PRODUCTS WHERE PRICE BETWEEN 1000
AND 1400;
iii) SELECT ITEM, QTY*PRICE AS “TOTAL” FROM PRODUCTS WHERE QTY >
200 AND ITEM LIKE ‘%tap%’;
iv) SELECT ITEM, TDATE FROM PRODUCTS WHERE QTY IS NULL AND
PRICE =1400;
or
Write the queries (i) to (iv) based on the table PRODUCTS given below:
i) Display the complete details of products whose Tdate is before the year 2015.
ii) Add a column UNIT PRICE using integer which include two digits and restrict
the entry of null values.
iii) To show the maximum and minimum price of items.
iv) Write query to increase the price by 10% whose price is more than 1200.
33 Write a Program in Python that defines and calls the following user defined functions
(i) InsertRow() – To accept and insert data of an student to a CSV file ‘class.csv’.
Each record consists of a list with field elements as rollno, name and marks to
store roll number, student’s name and marks respectively.
(ii) COUNTD() – To count and return the number of students who scored marks
greater than 75 in the CSV file named ‘class.csv’.
34 Consider the tables STORE and SUPPLIERS given below:
Table : Store
ITEM NO ITEM SCODE QTY RATE LASTBUY
2005 Sharpner Classic 23 60 8 2009-11-31
2003 Ball pen 22 50 25 2010-01-31
2002 Gel pen 21 150 12 2001-11-23
premium
2004 Gel pen classic 22 250 20 2009-01-11
2006 Eraser small 21 220 6 2009-05-12
2008 Eraser big 21 110 8 2009-06-14
2005 Ball pen 0.5 22 180 18 2009-03-25
Table : Supplier
SCODE SNAME
21 Premium Stationary
22 Soft Plastics
23 Tetra Supply
i) To display ItemNo, Item Name and Sname from the tables with their
corresponding matching Scode.
ii) Display the structure of the table store.
iii) Display the average rate of Premium Stationary and Tetra Supply.
iv) A )Display the item, qty, and rate of products in descending order of rates
Or
B ) Display the complete report of store whose item name has p letter in between.
35 Rojalina Gamango has created a table named Student in MYSQL database, SCHOOL: 4
• rno (Roll number)- integer
• name (Name) - string
• DOB (Date of birth) – Date
• Fee – float
Note the following to establish connectivity between Python and MySQL:
• Username - root
• Password – root
• Host – localhost
Rojalina Gamango now wants to display the records of students whose fee is more than
3500.
SECTION - E ( 2 X 5 = 10 MARKS)
36 A binary file data.dat needs to be created with following data written it in the form of 5
Dictionaries.
EI ENAME SALARY
D
101 KARTHIK 55000
102 SANIA 65000
103 SOMESH 52000
Write the following functions in python accommodate the data and manipulate it.
a) A function insert() that creates the data.dat file in your system and writes the three
dictionaries.
b) A function() read() that reads the data from the binary file and displays the dictionaries
whose SALARY is greater than 50000.
c ) A function to delete those records whose employee id is more than 102.
37 NMS Training Institute is planning to set up its Centre in Bhubaneswar with four specialized 5
blocks for Medicine, Management, Law courses along with an Admission block in separate
buildings. The physical distances between these blocks and the number of computers to be
installed in these blocks are given below. You as a network expert have to answer the queries
raised by their board of directors as given in (i) to (iv). Shortest distances between various
locations in meters:
Admin Block to Management Block 50 m
Admin Block to Medicine Block 30 m
Admin Block to Law Block 65 m
Management Block to Medicine Block 40 m
Management Block to Law Block 125 m
Law Block to Medicine Block 35 m
(i). Suggest the most suitable location to install the main server of this institution to get
efficient connectivity.
(ii). Suggest the layout and also draw the best cable layout for effective network
connectivity of the blocks having server with all the other blocks.
(iii). Suggest the device to be installed in each of these buildings for connecting computers
installed within the building.
(iv) Suggest the most suitable wired medium for efficiently connecting each computer
installed in every building out of the following network cables:
• Coaxial Cable
• Ethernet Cable
• Single Pair
• Telephone Cable.
(v) A) Suggest a device/software to be installed to take care of data security.
Or
B ) Suggest the type of network? (PAN,LAN,MAN,WAN)