0% found this document useful (0 votes)
932 views

CS QP 1

Uploaded by

meenakvs2007
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)
932 views

CS QP 1

Uploaded by

meenakvs2007
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/ 11

केन्द्रीय विद्यालय संगठन , कोलकाता संभाग

KENDRIYA VIDYALAYA SANGATHAN , KOLKATA REGION


प्री-बोर्ड परीक्षा / PRE BOARD EXAMINATION 2024-25
कक्षा / Class - XII अविकतम अं क / Maximum Marks : 70
विषय / Subject - Computer Science समय / Time : 3 Hrs.
__________________________________________________________________________

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. Section-A (21 x 1 = 21 Marks) Marks

1. State True or False:


(1)
The Python statement print(‘Alpha’+1) is example of TypeError Error

2. What id the output of following code snippet?

country = "GlobalNetwork" (1)


result = "-".join(country.split("o")).upper()
print(result)
(A) GL-BALNETW-RK
(B) GL-BA-LNET-W-RK
(C) GL-BA-LNET-W-RK
(D) GL-BA-LNETWORK

3. Identify the output of the following code snippet:

text = "The_quick_brown_fox"
index = text.find("quick")
(1)
result = text[:index].replace("_", "") + text[index:].upper()
print(result)

(A) Thequick_brown_fox
(B) TheQUICK_BROWN_FOX

Page: 1/11
(C) TheQUICKBROWNFOX
(D) TheQUICKBROWN_FOX
What will be the output of the following Python expression?
4.
x=5
y = 10
(1)
result = (x ** 2 + y) // x * y - x
print(result)

(A) 0
(B) -5
(C) 65
(D) 265
What will be the output of the following code snippet?
5.
(1)
text = "Python Programming"
print(text[1 : :3])

(A) Ph oai
(B) yoPgmn
(C) yhnPormig
(D) Pto rgamn
6. What will be the output of the following code?
tuple1 = (1, 2, 3)
tuple2 = tuple1 + (4,)
tuple1 += (5,)
print(tuple1, tuple2) (1)

(A) (1, 2, 3) (1, 2, 3, 4)


(B) (1, 2, 3, 5) (1, 2, 3)
(C) (1, 2, 3, 5) (1, 2, 3, 4)
(D) Error
7. Dictionary my_dict as defined below, identify type of error raised by statement
my_dict['grape']?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
(A) ValueError (1)
(B) TypeError
(C) KeyError
(D) ValueError
What does the list.pop(x) method do in Python?
8.
A. Removes the first element from the list.
(1)
B. Removes the element at index x from the list and returns it.
C. Adds a new element at index x in the list.
D. Replaces the element at index x with None.

Page: 2/11
In a relational database table with one primary key and three unique constraints
9.
defined on different columns (not primary), how many candidate keys can be
derived from this configuration?
(1)
(A) 1
(B) 3
(C) 4
(D) 2
10. Fill in the blanks to complete the following code snippet choosing the correct
option:

with open("sample.txt", "w+") as file:


(1)
file.write("Hello, World!") # Write a string to the file
position_after_write = file.______ # Get the position after writing
file.seek(0) # Move the pointer to the beginning
content = file.read(5) # Read the first 5 characters
print(content)

(A) tell
(B) seek
(C) read
(D) write
11. State whether the following statement is True or False:
In Python, if an exception is raised inside a try block and not handled, the
program will terminate without executing any remaining code in the finally (1)
block.

12. What will be the output of the following code?


x=4
def reset():
global x
x=2
print(x, end='&')
def update(): (1)
x += 3
print(x, end='@')

update()
x=6
reset()
print(x, end='$')

(A) 7@2&6$
(B) 7@6&6$
(C) 7@2&2$
(D) Error

Page: 3/11
Which SQL command can modify the structure of an existing table, such as adding or
13. (1)
removing columns?

(A) ALTER TABLE


(B) UPDATE TABLE
(C) MODIFY TABLE
(D) CHANGE TABLE
14. What will be the output of the query?
SELECT * FROM orders WHERE order_date LIKE '2024-10-%';
(A) Details of all orders placed in October 2024
(B) Details of all orders placed on October 10th, 2024 (1)
(C) Details of all orders placed in the year 2024
(D) Details of all orders placed on any day in 2024
Which of the following statements about the CHAR and VARCHAR datatypes in SQL
15.
is false?
(A) CHAR is a fixed-length datatype, and it pads extra spaces to match the specified
length. (1)
(B) VARCHAR is a variable-length datatype and does not pad extra spaces.
(C) The maximum length of a VARCHAR column is always less than that of a CHAR
column.
(D) CHAR is generally used for storing data of a known, fixed length.
16. Which of the following aggregate functions can be employed to determine the
number of unique entries in a specific column, effectively ignoring duplicates?
(A) SUM() (1)
(B) COUNT()
(C) AVG()
(D) COUNT(DISTINCT column_name)
17. Which protocol is used to send e-mail over internet?
(A) FTP
(B) TCP
(C) SMTP
(D) SNMP
(1)
18. Which device is primarily used to amplify and regenerate signals in a network,
allowing data to travel longer distances?
(A) Switch
(B) Router (1)
(C) Repeater
(D) Bridge

19. Which communication technique establishes a dedicated communication path


between two devices for the entire duration of a transmission, ensuring a (1)
continuous and consistent connection?

Page: 4/11
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 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

Assertion (A): Python functions can accept positional, keyword, and default
20.
parameters.

Reasoning (R): Default parameters allow function arguments to be assigned a (1)


default value if no argument is provided during the function call.
Assertion (A): A GROUP BY clause in SQL can be used without any aggregate
21.
functions.
Reasoning (R): The GROUP BY clause is used to group rows that have the same (1)
values in specified columns and must always be paired with
aggregate functions.
Q No Section-B ( 7 x 2=14 Marks) Marks
Consider the following Python code snippet:
22.
a = [1, 2, 3]
b=a (2)
a.append(4)
c = (5, 6, 7)
d = c + (8,)
a. Explain the mutability of a and c in the context of this code.
b. What will be the values of b and d after the code is executed?
Give examples for each of the following types of operators in Python:
23.
(I) Assignment Operators (2)
(II) Identity Operators
If L1 = [10, 20, 30, 40, 20, 10, ...] and L2 = [5, 15, 25, ...], then:
24.
(Answer using builtin functions only)

(I) A) Write a statement to count the occurrences of 20 in L1. (2)


OR
B) Write a statement to find the minimum value in L1.

(II) A) Write a statement to extend L1 with all elements from L2.


OR
B) Write a statement to get a new list that contains the unique elements
from L1.

Page: 5/11
25. Identify the correct output(s) of the following code. Also write the minimum and
the maximum possible values of the variable b.
import random
text = "Adventure"
b = random.randint(1, 5)
for i in range(0, b):
print(text[i], end='*') (2)

(A) A* (B) A*D*

(C) A*d*v* (D) A*d*v*e*n*t*u*

26. The code provided below is intended to reverse the order of elements in a given
list. However, there are syntax and logical errors in the code. Rewrite it after
removing all errors. Underline all the corrections made.

def reverse_list(lst)
if not lst:
return lst (2)
reversed_lst = lst[::-1]
return reversed_lst
print("Reversed list: " reverse_list[1,2,3,4] )

27. (I)
A) What constraint should be applied to a table column to ensure that all values in
that column must be unique and not NULL?
OR
B) What constraint should be applied to a table column to ensure that it can have
multiple NULL values but cannot have any duplicate non-NULL values? (2)
(II)
A) Write an SQL command to drop the unique constraint named unique_email
from a column named email in a table called Users.
OR
B) Write an SQL command to add a unique constraint to the email column of an
existing table named Users, ensuring that all email addresses are unique.

28. A) Explain one advantage and one disadvantage of mesh topology in computer
networks.
OR (2)
B) Expand the term DNS. What role does DNS play in the functioning of the
Internet?

Page: 6/11
Q No. Section-C ( 3 x 3 = 9 Marks) Marks

29. A) Write a Python function that extracts and displays all the words present in a
text file “Vocab.txt” that begins with a vowel.
OR (3)
B) Write a Python function that extracts and displays all the words containing a
hyphen ("-") from a text file "HyphenatedWords.txt", which has a three letter
word before hypen and four letter word after hypen. For example : “for-
them” is such a word.
(A) You have a stack named MovieStack that contains records of movies. Each
30.
movie record is represented as a list containing movie_title, director_name, and
release_year. Write the following user-defined functions in Python to perform the
specified operations on the stack MovieStack:

(I) push_movie(MovieStack, new_movie): This function takes the stack MovieStack


and a new movie record new_movie as arguments and pushes the new movie
record onto the stack.

(II) pop_movie(MovieStack): This function pops the topmost movie record from the
stack and returns it. If the stack is empty, the function should display "Stack is
empty".

(III) peek_movie(MovieStack): This function displays the topmost movie record (3)
from the stack without deleting it. If the stack is empty, the function should display
"None".

OR

(B) Write the definition of a user-defined function push_odd(M) which accepts a list
of integers in a parameter M and pushes all those integers which are odd from the
list M into a Stack named OddNumbers.

Write the function pop_odd() to pop the topmost number from the stack and
return it. If the stack is empty, the function should display "Stack is empty".

Write the function disp_odd() to display all elements of the stack without deleting
them. If the stack is empty, the function should display "None".

For example:

If the integers input into the list NUMBERS are: [7, 12, 9, 4, 15]

Then the stack OddNumbers should store: [7, 9, 15]

Page: 7/11
31. Predict the output of the following code:
data = [3, 5, 7, 2]
result = ""
for num in data:
for i in range(num):
result += str(i) + "*"
result = result[:-1]
print(result)
OR

Predict the output of the following code: (3)


numbers = [10, 15, 20]
for num in numbers:
for j in range(num // 5):
print(j, "+", end="")
print()

Q No. Section-D ( 4 x 4 = 16 Marks) Marks

32. Consider the table ORDERS as given below

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
1005 David Tablet NULL 7000

Note: The table contains many more records than shown here.
(4)
A) Write the following queries:
(I) To display the total Quantity for each Product, excluding Products with total
Quantity less than 5.
(II) To display the ORDERS table sorted by total price in descending order.
(III) To display the distinct customer names from the ORDERS table.
(IV) To display the sum of the Price of all the orders for which the quantity is
NULL.
OR
B) Write the output:
(I) SELECT C_Name, SUM(Quantity) AS Total_Quantity FROM ORDERS GROUP BY
C_Name;
(II) SELECT * FROM ORDERS WHERE Product LIKE '%phone%';
(III) SELECT O_Id, C_Name, Product, Quantity, Price FROM ORDERS WHERE Price
BETWEEN 1500 AND 12000;
(IV) SELECT MAX(Price) FROM ORDERS;

Page: 8/11
A CSV file "HealthData.csv" contains the data of a health survey. Each record of the
33.
file contains the following data:

 Name of a country
 Life Expectancy (average number of years a person is expected to live)
 GDP per capita (Gross Domestic Product per person)
 Percentage of population with access to healthcare

For example, a sample record of the file may be: ['Wonderland', 82.5, 40000, 95].
(4)
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 life expectancy is greater than 75.

(II) Count the number of records in the file.

Alex has been tasked with managing the Student Database for a High School. He
34.
needs to access some information from the STUDENTS and SUBJECTS tables for a
performance evaluation. Help him extract the following information by writing the
desired SQL queries as mentioned below.
Table: STUDENTS
S_I FNa LNam Enrollment_Dat Mar
D me e e ks
201 John Doe 15-09-2020 85
202 Jane Smith 10-05-2019 90
203 Alex Johns 22-11-2021 75
(4)
on
204 Emily Davis 30-01-2022 60
205 Mich Brown 17-08-2018 95
ael

Table: SUBJECTS

Sub_ID S_ID SubName Credits


301 201 Mathematics 3
302 202 Science 4
303 203 History 2
304 204 Literature 3
305 205 Physics 4
306 201 Computer 3
Science
Write the following SQL queries:
(I) To display complete details (from both the tables) of those students whose
marks are greater than 70.
(II) To display the details of subjects whose credits are in the range of 2 to 4 (both
values included).
(III) To increase the credits of all subjects by 1 which have "Science" in their subject
names.
(IV) (A) To display names (FName and LName) of students enrolled in the
Page: 9/11
"Mathematics" subject.
(OR)
(B) To display the Cartesian Product of these two tables.

A table, named ELECTRONICS, in the PRODUCTDB database, has the following


35.
structure:

Field Type
productID int(11)
productName varchar(20)
price float
stockQty int(11)

Write the following Python function to perform the specified operation: (4)

AddAndDisplay(): To input details of a product and store it in the table


ELECTRONICS. The function should then retrieve and display all records from the
ELECTRONICS table where the price is greater than 150.
Assume the following for Python-Database connectivity:
Host: localhost
User: root
Password: Electro123

Q.No. SECTION E (2 X 5 = 10 Marks) Marks


Raj is a supervisor at a software development company. He needs to manage the
36.
records of various employees. For this, he wants the following information of each
employee to be stored:
Employee_ID – integer
Employee_Name – string
Position – string
Salary – float (5)
You, as a programmer of the company, have been assigned to do this job for Raj.
(I) Write a function to input the data of an employee and append it to a binary file.
(II) Write a function to update the data of employees whose salary is greater than
50000 and change their position to "Team Lead".
(III) Write a function to read the data from the binary file and display the data of all
those employees who are not "Team Lead".
Interstellar Logistics Ltd. is an international shipping company. They are planning to
37
establish a new logistics hub in Chennai, with the head office in Bangalore. The
Chennai hub will have four buildings - OPERATIONS, WAREHOUSE,
CUSTOMER_SUPPORT, and MAINTENANCE. As a network specialist, your task is to
propose the best networking solutions to address the challenges mentioned in
points (I) to (V), considering the distances between the various buildings and the
given requirements.

Building-to-Building Distances (in meters):

Page: 10/11
From To Distance
OPERATIONS WAREHOUSE 40 m
OPERATIONS CUSTOMER_SUPPORT 90 m
OPERATIONS MAINTENANCE 50 m
WAREHOUSE CUSTOMER_SUPPORT 60 m
WAREHOUSE MAINTENANCE 45 m
CUSTOMER_SUPPORT MAINTENANCE 55 m

Distance of Bangalore Head Office from Chennai Hub: 1300 km

Number of Computers in Each Building/Office:

Location Computers
OPERATIONS 40
WAREHOUSE 20
CUSTOMER_SUPPORT 25
MAINTENANCE 22
BANGALORE HEAD OFFICE 15
(I) Suggest the most suitable location for the server within the Chennai hub. Justify
your decision.
(II) Recommend the hardware device to connect all computers within each building (5)
efficiently.
(III) Draw a cable layout to interconnect the buildings at the Chennai hub efficiently.
Which type of cable would you recommend for the fastest and most reliable data
transfer?
(IV) Is there a need for a repeater in the proposed cable layout? Justify your
answer.
(V) A) Recommend the best option for live video communication between the
Operations Office in the Chennai hub and the Bangalore Head Office from the
following choices:
• a) Video Conferencing
• b) Email
• c) Telephony
• d) Instant Messaging
OR
(V) B) What type of network (PAN, LAN, MAN, or WAN) would be set up among the
computers within the Chennai hub?

Page: 11/11

You might also like