0% found this document useful (0 votes)
62 views11 pages

XII COMP SCI MQP 14

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

XII COMP SCI MQP 14

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

KENDRIYA VIDYALAYA SANGATHAN:: HYDERABAD REGION

MODEL QUESTION PAPER 2024-25


कक्षा CLASS : XII समय TIME : 03
HOURS
विषय SUBJECT : COMPUTER SCIENCE अधिकतम अं क MAX. MARKS: 70

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

1 State true or false: 1


The value of the expressions 4/(3*(2 - 1)) and 4/3*(2 - 1) is the same.

2 What is the output of the following code snippet?

text = "HELLO"

text = text.replace('L', 'Z')

print(text)

(a) HEZZO
(b) HELLO
(c) HELO
(d) HZZLO

3 Which of the following evaluates to False?

(a) not(False)
(b) True and False
(c) True or False
(d) not(True)

4 What is the output of the following expression? 1


text = 'Explanation'

print(text.split('a'))

(a)['Expl', 'n', 'tion']

(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)

8 What is the output of following code? 1


l1 = [ [ 4,1] ,[ 2,3] ,[ 3,5] ,[ 6,0.5] ]

l1.sort()

print(l1)

a) [ [ 2,3] ,[ 3,5] ,[ 4,1] ,[ 6,0.5] ]

b) [ [ 2,3] ,[ 3,4] ,[ 5,6] ]

c) [ [ 0.5,1] ,[ 2,3] ,[ 3,4] ,[ 5,6] ]

d) [ [ 6,0.5] ,[ 4,1] ,[ 2,3] ,[ 3,5] ]

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

10 What will be the output of the following Python code? 1


file = open("example.txt", "r")

data = file.read(100)
file.close()

print(data)

a) First 100 characters of the file

b) First line of the file

c) Last 100 characters of the file

d) FileNotFoundError

11 State true or false: 1


Non - default arguments can be placed before or after a default argument in a function
definition.

12 Which function returns the sum of all elements of a list? 1


a) sum ()

b) count ()

c) total ()

d) add ()

13 In SQL, what does the SUM() function do? 1

14 What will be the output of the query?

SELECT * FROM employees WHERE employee_name LIKE '%son';

(a) Details of all employees whose names start with 'son'


(b) Details of all employees whose names end with 'son'
(c) Names of all employees whose names start with 'son'
(d) Names of all employees whose names end with 'son'

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()

17 Which protocol is used to send emails over the Internet? 1


(A) HTTP
(B) FTP
(C) SMTP
(D) HTTPS

18 Which device is used to amplify and regenerate signals in a network? 1


(A) Modem
(B) Gateway
(C) Repeater
(D) Router

19 Which switching technique establishes a dedicated communication path between two 1


endpoints for the duration of the transmission?

Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct choice
as:

a) Both A and R are true and R is the correct explanation of A.

b) Both A and R are true but R is not the correct explanation of A.

c) A is true but R is false.

d) A is false but R is true

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:

(i) To append the value 100 to a list L


OR
(ii) To convert the string word to all uppercase characters.

B) Write the Python statement to import the required module and (using a built-in
function) to perform the following tasks:

(i) To calculate the square root of a variable num


OR
(ii) To generate a random float between 0 and 1

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)

for i in range(1, b):

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

for num in numbers:

if num / 2 == 0:

total += num

return total

result = sum_even_numbers([1, 2, 3, 4, 5, 6])

print("Sum of even numbers: " result)

27 Given below is a table Item in database Inventory. 2

ItemID ItemName Quantity UnitPrice

101 ABC 5 120

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.

28 List one advantage and one disadvantage of bus topology.

OR

Expand the term HTTP. What is the use of HTTP?

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.

He was devoted to his mother Jijabai.

India at that time was under Muslim rule.

The function should read the file content and display the output as follows:

Total number of lines : 3

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 history of India is very rich.

Many rulers ruled the land of India.

It is the land of diverse cultures and traditions.

The function should read the file content and display the output as follows:

Total number of words: 22

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.

(i) Push_patient(PatientList, SurgeryStack): Push the names and ages of


the patients whose department is 'Surgery' and charges are greater than 250 onto the
stack.

(ii) Pop_patient(SurgeryStack): Pop and display the names of the patients from
the stack until it is empty, then print "Stack Empty".

(iii) Peek_patient(SurgeryStack): This function displays the topmost patient name


and age of the stack without deleting it. If the stack is empty, the function should display
'None'.

OR

Write a function filter_high_charges(PatientList) that accepts a list of


patients and pushes only the patients with charges greater than 300 into a stack called
HighChargePatients. Implement the following functions:

(i) Pop_high_charge(HighChargePatients): This function removes and returns


the top element from the HighChargePatients stack. If the stack is empty, then it
returns None.

(ii) Display_high_charge(HighChargePatients): This function displays all


elements of the stack without deleting them. If the stack is empty, the function should
display None.

For example: If the patients' input into the list PatientList are:

PatientList = [('Sandeep', 65, 'Surgery', 300), ('Ravina', 24, 'Orthopaedic', 200), ('Ankita',
29, 'Cardiology', 800)]

Then the stack HighChargePatients should store: [('Ankita', 29,


'Cardiology', 800)]

31 Predict the output of the following code:


data = [3, 5, 8]

result = "" 3
for number in data:

for i in range(1, number + 1):

result += str(i) + "!"

print(result)

OR

values = [2, 4, 6]

for v in values:

for j in range(v):

print(v, end=" ")

print()

SECTION – D

32 Consider the table CUSTOMERS as given below: 4

C_Id C_Name City Age Join_Date

1 Alice New York 30 2022-01-10

2 Bob Los Angeles 25 2021-11-15

3 Charlie Chicago 35 2023-03-12

4 David Miami 28 2020-07-22

A) Write the following queries:


(I) To display the average age of customers from each city.
(II) To display the total number of customers who joined in the year 2022.
(III) To display the distinct cities from the Customers table.
(IV) To display the maximum age of customers who are from New York.

OR

B) Write the output:


(I) SELECT C_Name, COUNT(*) AS Total_Customers FROM Customers GROUP BY City;
(II) SELECT * FROM Customers WHERE Age > 30;
(III) SELECT C_Id, C_Name FROM Customers WHERE Join_Date BETWEEN '2022-01-01' AND
'2022-12-31';
(IV) SELECT MIN(Age) FROM Customers;

33 A CSV file "EmployeeData.csv" contains the data of employees in a company. Each 4


record of the file contains the following data:

● Employee ID

● Name of the employee

● Department

● Salary

For example, a sample record of the file may be:


[101, 'Alice', 'HR', 75000]

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

a. Write SQL commands for the following statements:


i. To display the names of all activities with their Acodes in descending order.
ii. To display sum of PrizeMoney for the Activities played in each of the Stadium
separately.
iii. Display the activity name ,total participant numbers and their coach name.
iv. A) Display the total prize amount received by each coach.
Or
B) Display the highest prize money and its Coach name

35 A table, named EMPLOYEES, in HRDB database, has the following structure: 4

Field Type

emp_id int(11)

emp_name varchar(30)

department varchar(20)

salary float

Write the following Python function to perform the specified operation:


AddAndDisplay(): To input details of an employee and store it in the table EMPLOYEES. The
function should then retrieve and display all records from the EMPLOYEES table where the
Salary is greater than 50,000.

Assume the following for Python-Database connectivity:


Host: localhost
User: root
Password: Employee123

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

● SNAME – Student Name

● SCLASS – Student Class

● MARKS – Student Marks

Perform the following tasks:

(I) Write a function to input the data of a student and append it to the binary file.

(II) Write a user-defined function find_students(marks) that accepts a marks value as a


parameter and displays all records from the binary file "STUDENTS.DAT" where the student's
marks are greater than the marks value passed as a parameter.

(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".

A rough layout of the same is as follows:

Approximate distance between these offices as per network survey team is as follows:

Place From Place To Distance

Head Office Sales Office 10 KM

Head Office Tech Office 70 METER

Head Office Kolkata Office 1291 KM

Head Office Ahmedabad Office 790 KM

Head Office Coimbatore Office 1952 KM

In continuation of the above, the company experts have planned to install the following

number of computers in each of their offices:

Head Office 100

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.

iii. Recommend the placement of the following devices with justifications:


a. Repeater
b. Hub/Switch
iv. VoIP technology will be implemented for voice communication over the internet. What
does the acronym VoIP stand for?

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?

You might also like