XII COMP SCI MQP 14
XII COMP SCI MQP 14
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.
Section A
text = "HELLO"
print(text)
(a) HEZZO
(b) HELLO
(c) HELO
(d) HZZLO
(a) not(False)
(b) True and False
(c) True or False
(d) not(True)
print(text.split('a'))
(b)['Expl', 'nation']
(c)('Expl', 'n', 'tion')
(d) Error
5 Which method should I use to convert String "Python programming is fun" to "Python 1
Programming Is Fun"?
a) upper()
b) capitalize()
c) istitle()
d) title()
6 Which of the following functions raises an exception if the key is not found in a dictionary? 1
a) dict.get()
b) dict[key]
c) dict.keys()
d) dict.items
7 Which method in Python is used to remove the first occurrence of a value from a list? 1
(a) list.remove(value)
(b) list.pop(value)
(c) list.clear(value)
(d) list.delete(value)
l1.sort()
print(l1)
9 Which of the following attributes can be considered as a choice for the primary key? 1
a) Street
b) Subject
c) Roll No
d) Name
data = file.read(100)
file.close()
print(data)
d) FileNotFoundError
b) count ()
c) total ()
d) add ()
15 Which SQL query is used to retrieve all records from a table named 'products'? 1
(a) SELECT * FROM products;
(b) SHOW products;
(c) RETRIEVE * FROM products;
(d) SELECT ALL IN products;
16 Which aggregate function can be used to find the total number of records in a table? 1
(A) SUM()
(B) COUNT()
(C) MAX()
(D) AVG()
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice
as:
20 Assertion (A): Python allows us to divide a large program into the basic building blocks 1
known as a function.
Reason (R): The function contains the set of programming statements enclosed by ( )
21 Assertion (A): The primary key in a database table ensures that all values in a column are 1
unique.
Reasoning (R): A primary key is used to identify records uniquely within a table, which
allows for efficient data retrieval.
Section-B
22 Explain the difference between mutable and immutable objects with examples from 2
Python.
23 Differentiate between == and is operators in Python with examples.
24 A) Write the Python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
B) Write the Python statement to import the required module and (using a built-in
function) to perform the following tasks:
25 Identify the correct output(s) of the following code. Also write the minimum and maximum
possible values of the variable b
import random
a = "Python"
b = random.randint(2, 5)
print(a[i], end='')
(a) y
(b) yt
(c) yth
(d) ython
26 The code provided below is intended to calculate the sum of all even numbers in a given
list. However, there are errors in the code. Identify and correct these errors. Underline all
the corrections made.
def sum_even_numbers(numbers)
total = 0
if num / 2 == 0:
total += num
return total
102 XYZ 7 70
103 PQR 8 65
104 XYZ 12 55
Riya created this table but forget to add column ManufacturingDate. Can she add this
column after creation of table?
If yes, write the code where user’s name and password are system and test respectively.
OR
SECTION –C (3x3=9)
29 Write the definition of a function Count_Line() in Python, which should read each line of a 3
text file "SHIVAJI.TXT" and count total number of lines present in text file. For example, if
the content of the file "SHIVAJI.TXT" is as follows:
Shivaji was born in the family of Bhonsle.
The function should read the file content and display the output as follows:
OR
Write the definition of a function Count_Words() in Python, which should read each line of
a text file "HISTORY.TXT" and count the total number of words present in the text file.
The function should read the file content and display the output as follows:
30
You have a list PatientList where each element represents a patient record in the
format Name, Age, Department, Charges. Write Python functions to operate on 3
the stack SurgeryStack.
(ii) Pop_patient(SurgeryStack): Pop and display the names of the patients from
the stack until it is empty, then print "Stack Empty".
OR
For example: If the patients' input into the list PatientList are:
PatientList = [('Sandeep', 65, 'Surgery', 300), ('Ravina', 24, 'Orthopaedic', 200), ('Ankita',
29, 'Cardiology', 800)]
result = "" 3
for number in data:
print(result)
OR
values = [2, 4, 6]
for v in values:
for j in range(v):
print()
SECTION – D
OR
● Employee ID
● Department
● Salary
Write the following Python functions to perform the specified operations on this file:
(I) Read all the data from the file in the form of a list and display all those records for which
the salary is greater than ₹60,000.
(II) Count the number of records in the file.
34 Write the SQL commands for (i) to (v) on the basis of the table 4
HOSPITAL Consider the following tables ACTIVITY and COACH and answer (a) and (b)
parts of this question: Table: ACTIVITY
ACode ActivityName Stadium Participantsnum PrizeMoney ScheduleDate
1001 Relay 100 x 4 Star Annex 16 10000 23-Jan-2004
1002 High Jump Star Annex 10 12000 12-Dec-2003
1003 Shot Put Super Power 12 8000 14-Feb-2004
1005 Long Jump Star Annex 12 9000 01-Jan-2004
1008 Discuss Throw Super Power 10 15000 19-Mar-2004
Table: COACH
PCode Name ACode
1 Ahmad Hussain 1001
2 Ravinder 1008
3 Janila 1001
4 Naaz 1003
Field Type
emp_id int(11)
emp_name varchar(30)
department varchar(20)
salary float
SECTION - E
36 Consider a binary file "STUDENTS.DAT" containing a dictionary with multiple elements. Each 5
element is in the form:
SID: [SNAME, SCLASS, MARKS]
where:
SID – Student ID
(I) Write a function to input the data of a student and append it to the binary file.
(III) Write a function to update the class to "12" for students whose marks are greater than 90
37 "Hindustan Connecting World Association" is planning to start their offices in four major 5
cities in India to provide regional IT infrastructure support in the field of Education & Culture.
The company has planned to setup their head office in New Delhi in three locations and have
named their New Delhi offices as "Sales Office", "Head Office" and "Tech Office". The
company’s regional offices are located in "Coimbatore", "Kolkata" and "Ahmedabad".
Approximate distance between these offices as per network survey team is as follows:
In continuation of the above, the company experts have planned to install the following
Sales Office 20
Tech Office 50
Kolkata Office 50
Ahmedabad Office 50
Coimbatore Office 50
i. Based on the distance and number of computers, suggest the most suitable location for
the main server that will optimize connectivity across all offices. Explain your reasoning.
ii. For efficient communication between the various offices, suggest a suitable network
topology and illustrate it.
v. A) If Hindustan Connecting World Association intends to link its New Delhi head office with
the regional offices in Coimbatore, Kolkata, and Ahmedabad, which type of network (LAN,
MAN, or WAN) will be created? Justify your answer.
OR
B) Which hardware device would you recommend to connect all the computers in the head
office effectively?