0% found this document useful (0 votes)
136 views12 pages

Cs Xii QP Set 2 PB 2

This document is a question paper for the Computer Science subject for Class XII under Kendriya Vidyalaya Sangathan, Mumbai Region. It consists of 37 questions divided into five sections, covering various topics in Python programming and database management, with a total of 70 marks. The paper includes multiple-choice questions, programming tasks, and SQL queries, with specific instructions for each section.

Uploaded by

dhanush4spam
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)
136 views12 pages

Cs Xii QP Set 2 PB 2

This document is a question paper for the Computer Science subject for Class XII under Kendriya Vidyalaya Sangathan, Mumbai Region. It consists of 37 questions divided into five sections, covering various topics in Python programming and database management, with a total of 70 marks. The paper includes multiple-choice questions, programming tasks, and SQL queries, with specific instructions for each section.

Uploaded by

dhanush4spam
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/ 12

Subject Code 0 8 3 Roll No.

KENDRIYA VIDYALAYA SANGATHAN, MUMBAI REGION


SECOND PRE-BOARD (SESSION 2024-25)
(SET- II)
Subject: Computer Science (Theory) Class: XII
Time Allowed: 3:00 Hours 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.

Q. No. SECTION-A (21 x 1 = 21 Marks) Marks

1. State True or False: 1


“raise and assert statements are used to raise exceptions”

2. Identify the output of the following code snippet: 1


S=”'CBSE-2025-exam'”
P=str(S.find('a'))+S[:7:4]+str(S.count('e')+4)
P=P.title()
print(P)
a) ‘12C-4’
b) ‘21B-5’
c) ‘12C-5’
d) ‘21B-4’

3. What is the value of x? 1


x= 13+14%4.00-True//5
(A) 15
(B) 15.0
(C) 14
(D) 14.0

Page 1 of 12
4. What is the output of the expression? 1
S1=”Mission2025”
S2=”2025”
print(S1.isalpha(),S2.isdigit(),sep=’$’)
(A) False$True
(B) True$False
(C) False$False
(D) True$True

5. What will be the output of the following code? 1


msg=”Kendriya Vidyalaya Sangathan”
print(msg[:16:3]+'@'+msg[-5::-4])

6. Given tp=(5,3,1,9,0). Which of the following two statements will give the same 1
output?
(i) print(tp[:-1])
(ii) print(tp[0:5])
(iii) print(tp[0:4])
(iv) print(tp[-4:])

Options:-
(A) (i) & (ii)
(B) (ii) & (iv)
(C) (i) & (iv)
(D) (i) & (iii)

7. Which of the following Python codes will raise an error if d1 is as shown 1


below?
d1={“a”:1,”b”:2,”c”:3}
(A) print(len(d1))
(B) print(d1.get(“b”))
(C) d1[“a”]=5
(D) None of these

Page 2 of 12
8. Which of the following is the correct syntax to make deep copy of one list into 1
another.?
(A) listA=listB[]
(B) listA=listB[]()
(C) listA=list(listB)
(D) listA=listB[:]

9. Select the correct statement, with reference to RDBMS: 1


(A) NULL can be a value in a Primary Key column.
(B) ' ' (Empty string) can be a value in a Primary Key column.
(C) A table with a Primary Key column can have duplicate values.
(D) A table with a Primary Key column must have unique values.

10. Which of the following option is the correct Python statement to read and 1
display the first 10 characters of a text file “Notes.txt”?
(A) F=open(‘Notes.txt’)
print(F.load(10))
(B) F=open(‘Notes.txt’)
print(F.dump(10))
(C) F=open(‘Notes.txt’)
print(F.read(10))
(D) F=open(‘Notes.txt’)
print(F.write(10))

11. State whether the following statement is True or False: 1


When syntax error is encountered, Python does not display the name and
small description about an error.

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


a=20
def convert(a):
b=20
a=a+b
convert(10)
print(a)

Page 3 of 12
(A) 10
(B) 20
(C) 30
(D) Error

13. Gaurav created a table ‘Employee’ with 3 columns and inserted 5 records. He 1
deleted 4 records and then added 1 column. As a DBMS expert help Gaurav to
find degree and cardinality of the table ‘Employee’

14. Consider the following query: 1


SELECT * FROM employee ORDER BY salary …….., name……..;
To display the salary from greater to smaller and name in alphabetical order
which of the following options should be used?
(A) Ascending, Descending
(B) Asc, Desc
(C) Desc, Asc
(D) None of these

15. Which among the following is Correct MySQL command to display all those 1
records from the table EMPLOYEE whose SALARY (column name: SALARY)
has not entered in the table.
(A) Select * from EMPLOYEE where SALARY==NULL;
(B) Select * from EMPLOYEE where SALARY==”NULL”;
(C) Select * from EMPLOYEE where SALARY is NULL;
(D) Select * from EMPLOYEE where SALARY is “NULL”;

16. All aggregate functions except ………… ignore null values in their input 1
collection.
(A) Count(attribute)
(B) Count(*)
(C) Avg()
(D) Sum()

Page 4 of 12
17. TCP(Transmission Control protocol) is not responsible for 1
(A) Dividing the message into multiple packets.
(B) Assigning addresses to the packets.
(C) Rearranging the received packets.
(D) Asking for missing packets.

18. Which network device regenerates and retransmits the whole signal? 1
(A) Modem
(B) Hub
(C) Repeater
(D) Bridge

19. Consider the URL: 1


https://www.iitbhu.ac.in/dept/che
What is domain name in above given URL.

Q.20 and Q.21 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

20. Assertion (A): A parameter having a default value in the function header is 1
known as default parameter.
Reason (R): The default values for parameters are considered only if no values is
provided for that parameter in the function call statement.

21. Assertion (A): In order to carry out the join operation in MySQL, there should 1
be a governing condition.
Reason (R): A join condition may be based on equality, less than, greater than or non-
equality.

SECTION-B ( 7 x 2=14 Marks)

22. Write difference between mutable and immutable data types? Write name of 2
any two mutable data types.

23. i. Which operator in python has right to left associativity? 2


ii. Evaluate the following expression and write output:
>>> 5//4**3%6+2

Page 5 of 12
24. If str1= “foundation stone” and str2= “strong base”, then 2
Write the Python statements for each of the following tasks using Built-in
functions/methods only:
i.
A. To count the occurrence of the letter ‘n’ in str1.
OR
B. To convert the string str2 in a list and each word of the string should
become the element of the list.
ii.
A. To convert the string str2 in capital letters.
OR
B. To convert the first character of each word to uppercase of str1.

25. Look at the following python code and find the possible output(s) from the 2
options (i) to (iv) following it. Also, write the highest and lowest values that can
be pointed by label p.

import random
text = "NewYear"
p=random.randint(0,2)
q=random.randint(1,2)
for j in range(0, p+q):
print(text[j], end='@')

i. e@w@Y@ ii. N@
iii. N@e@w@Y@ iv. N@e@w@Y@e@

26. The code provided below is intended to check a number whether it is perfect 2
number or not. However, there are syntax and logical errors in the code.
Rewrite the code in python after removing all error(s). Underline each correction
done in the code.

def Perfect_Number():
n=input(int("Enter a number: "))
sum=0
for i in range(1,n):
if n%i==0:
sum=+i
if N==sum:
print("Perfect number")
else:
print("Not a perfect number")

Perfect_Number():

Page 6 of 12
27. i. 2
A. Which SQL command is used to save changes permanent in the
database after executing data manipulation operations like INSERT,
UPDATE or DELETE?
OR
B. What constraint should be applied on an attribute in a relation so that
the values under that attribute must not have NULL value and duplicate
values?

A. Write the SQL command to list the details (all column names, data type,
size, constraint) of a table named as “MUSIC”.
OR
B. Write an SQL command to remove a primary key which is applied on
the attribute “Book_ID” of integer data type in existing table “BOOKS”.

28. Write one advantage and one disadvantage of using Optical Fiber cable. 2
OR
Write two points of difference between 4-G and 5-G technology.

SECTION-C ( 3 x 3 = 9 Marks)

29. Write a function ETCount() in Python, which should read each character of a 3
text file “TESTFILE.TXT” and then count and display the count of occurrence
of alphabets ‘E’ and ‘T’ separately (including small cases ‘e’ and ‘t’ too).
Example: If the file content are as follows:
Today is a pleasant day.
It might rain today.
It is mentioned on weather sites
The ETCount() function should display the output as:
E or e: 6
T or t : 9
OR
Write a user defined function in Python named ShowInLines () which reads
contents of a text file named “STORY.TXT” and displays every sentence in a
separate line. Assume that a sentence ends with a full stop (.), a question mark
(?), or an exclamation mark (!).
For example, if the content of file STORY. TXT is as follows:
Our parents told us that we must eat vegetables to be healthy. And it turns out,
our parents were right! So, what else did our parents tell?

Then the function should display the file's content as follows:


Our parents told us that we must eat vegetables to be healthy.
And it turns out, our parents were right!
So, what else did our parents tell?

Page 7 of 12
30. You have a stack named PMSHRIStack that contains records of PMSHRI 3
schools. Each school record is represented as a list containing School_Name,
Principal_Name, and Establishment_year.
Write the following user-defined functions in Python to perform the specified
operations on the stack PMSHRIStack:
i. add_school(PMSHRIStack, new_school): This function takes the stack
PMSHRIStack and a new school record new_school as arguments and
pushes the new school record onto the stack and display the stack.
ii. remove_school(PMSHRIStack): This function removes the topmost
school record from the stack and returns it. If the stack is already empty,
the function should display "Underflow".
iii. view_peak(PMSHRIStack): This function displays the topmost element of
the stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
Write the following user-defined functions in python to perform the specified
operations on the stack OddNumbers.
i. Push_odd(W) which accepts a list of integers in a parameter W and
pushes all those integers which are odd from the list W into a Stack
named OddNumbers.
ii. Pop_odd(OddNumbers) to pop the topmost number from the stack and
return it. If the stack is empty, the function should display "Stack is
empty".
iii. Disp_odd(OddNumbers) to display all elements of the stack without
deleting them. If the stack is empty, the function should display "None".

31. Predict the output of the following code 3


D={"Saurav":80,"Aditi":89, "Aman":75}
print(min(D))
R={"Aditi":85, "Rajat":65}
R.update(D)
print(D)
P=D
P["Aman"]=82
print(D)
OR

Write the output of the code given below:


P=[6,12,18,24,30]
for i in p:
for j in range(1, i%4):
print (j,” #”, end=’ ’)
print()

Page 8 of 12
SECTION-D ( 4 x 4 = 16 Marks)

32. Consider a table Food as given below: 4


Food_ID Food_name Category Quantity Expiry_date
201 Apple Fruit 100 2025-01-31
202 Banana Fruit 150 2025-01-25
206 Carrot Vegetable 200 2025-02-17
209 Milk Dairy 50 2025-02-22
204 Butter Dairy 100 2025-02-20
203 Rice Grain 60 2025-09-20
210 Bread Bakery 120 2025-01-23
208 Tomato Vegetable 110 2025-01-22
207 Chicken Meat 20 2025-03-15
205 Orange Fruit 80 2025-02-05

A) Write the SQL queries:


i. Display the Category and average quantity of each category of food.
ii. Display Food_ID, Food Name and Expiry date of those foods which has
alphabet ‘g’ as second last character in food name.
iii. Display Food name, Category and Quantity of those foods whose food
category is not NULL.
iv. Display name of each food category in alphabetic order without repetition
of category.
OR
B) Write the output:
i. Select Food_ID, Food_Name, Quantity from FOOD Where Expiry_date<
“2025-01-31” order by Quantity desc;
ii. Select Category, avg(Quantity) from Food group by Category;
iii. Select Food_Name, Expiry_date from Food where Category= “Fruit” and
Quantity<110;
iv. Select min(Expiry_date) from Food where Category= “Vegetable”;

33. Ms. Pallavi is a python programmer working in a software company. She has to 4
develop a simple inventory management system of all books in a library. She
has created a csv file named bookdata.csv, to store the details of books. The
structure of bookdata.csv is:
[Book_Number, Book_Name, Author, Price]
Ms. Pallavi wants to write a Program in Python that defines and calls the
following user defined functions:
i. Insert_Books() – To accept and add data of n number of books to a
CSV file ‘bookdata.csv’.
ii. Display() – To show the record of those books which have the price
more than 400 in the CSV file named ‘bookdata.csv’.

Page 9 of 12
34. Ms. Pooja has been entrusted with the online shopping Database. She needs 4
to access some information from CUSTOMER and ORDER tables for a survey
analysis. Help her to extract the following information by writing the desired SQL
queries as mentioned below.
Table: CUSTOMER
CUST_ID Customer_name Gender City
C011 Hemali F Pune
C025 Gaurang M Mumbai
C031 Kiran F Nagpur
C045 Payal F Pune
C050 Manish M Mumbai

Table : ORDERS
ORDER_ID Product_Name Amount CUST_ID
OD01 TV 75000 C031
OD02 Laptop 80000 C050
OD03 Mobile 25000 C011
OD04 Mobile 40000 C031
OD05 TV 30000 C045

i. To display customer name and city of those customers who have placed
order for TV.
ii. To display Customer name, Product name and amount of those orders
which have the amount more than 60000.
iii. To display Order ID, Product name and customer name of those orders
which have been placed by any male customer.
iv.
A. To display customer name, city and amount in descending order of
order amount.
OR
B. What will be cardinality of resultant table after performing cartesian
product of CUSTOMER table and ORDERS table.

35. Mr. Sanjeev wants to create a table named SHOP in the MARKET database, 4
which should have the following structure:

Field Type Remarks


Shop_Number int Primary Key
Shop_Name varchar(50) NOT NULL
Start_Date Date
Category Varchar(30)
TurnOver float(11,2)

Page 10 of 12
Write the following Python function to perform the specified operation:
 Shop_Details() : To create a table SHOP as per details given above and
after creation of the table assume that you have inserted 20 records in it.
Now, display the details of those shops which have the Category as
“Footwear”.
Consider the following for Python-Database connectivity:
host: localhost, user: root, password: dbwork

SECTION-E (2 X 5 = 10 Marks)

36. Mr. Ashok is working on a Toy Shop project to manage toys records using 5
Python. The toys data is stored in a binary file named TOYDATA.DAT. The
binary file TOYDATA.DAT contains each record in given format:
{“Toy_ID”: T_ID, “TName”:toy_name, “Price”:price}
Where
● Toy_ID: Toy ID (string)
● TName: Toy name (string)
● Price: Price of toy (integer)

You as a programmer, help him to write following python functions:


i. ADD_Data() : To write n records in binary file TOYDATA.DAT by taking
the values for each record from user.

ii. SHOW_Data() : Read all records from binary file and display them.

iii. Remove_Toy() : that deletes the record of a toy in the file


TOYDATA.DAT based on the Toy ID provided by the user. If the Toy ID
does not exist in the file, display an appropriate message.

37. “Tech_AI Services” is planning to set up its India campus at Pune with its 5
Head Office at Delhi. The Pune campus has 3-main blocks-App Development,
Generative AI and Web Designing. You as a network expert have to suggest
the best network related solutions for their problems raised in (i) to (v).

Page 11 of 12
DELHI
Generative AI
Head Office

Web Designing
App Development

Pune Campus

Distance between various building blocks:


App Development to Generative AI BLOCK 90 m
App Development to Web Designing BLOCK 110 m
Generative AI to Web Designing BLOCK 40 m
Head Office to Pune Campus 1390 KM

Number of computers in each Block:


App Development BLOCK 50
Generative AI BLOCK 100
Web Designing BLOCK 60

i. Suggest the most appropriate location of the server inside the Pune
campus (out of the 3 blocks), to get the best connectivity for maximum
number of computers. Justify your answer.
ii. Suggest the placement of following devices in various blocks at Pune
campus:
a. Switch/Hub
b. Repeater
iii. What would be your recommendation for enabling live visual
communication between the Generative AI Block at Pune campus and
Delhi Head Office from the following options:
 Video Conferencing
 Telephony
 E-Mail
 Instant Messaging
iv. Which of the following communication medium, you will suggest to be
procured by the company for connecting their local offices in Pune for
very effective and fast communication?
● Telephone cable
● Optical fiber
● Ethernet cable
v.
A. What type of network (out of LAN, MAN, WAN, PAN) would be setup
among the computers within the Pune campus.
OR
B. Suggest and draw the cable layout to efficiently connect various
blocks within the Pune campus for connecting the computers.

Page 12 of 12

You might also like