cblecspu10
cblecspu10
Sample Paper 10
Computer Science (083)
CLASS XII 2024-25
Time: 3 Hours Max. Marks: 70
General Instructions:
1. This question paper contains 37 questions.
2. All questions are compulsory. However, internal choices have been provided in some questions. Attempt
only one of the choices in such questions
3. The paper is divided into 5 Sections- A, B, C, D and E.
4. Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
5. Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
6. Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
7. Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
8. Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
9. All programming questions are to be answered using Python Language only.
10. In case of MCQ, text of the correct answer should also be written.
SECTION A
4. Two friends have connected their computers but are experiencing weak signals. Which device should they
use to improve signal strength?
(a) Repeater (b) Hub
(c) Switch (d) Modem
6. ______method creates a cursor object while connecting a Python application with a Mysql database.
(a) connection( ) (b) connect( )
(c) cursor( ) (d) None of these
8. Which attribute is used to return access mode with that file was opened?
(a) mode.file (b) mode.file.name
(c) file.mode (d) file.mode.type
9. Identify the option that is not a DDL (Data Definition Language) command:
(a) ALTER (b) CREATE
(c) DROP (d) DELETE
13. The.........command can be used to remove all records of a table along with the table structure.
(a) DELETE TABLE (b) DROP TABLE
(c) REMOVE TABLE (d) None of these
15. Which function is used to generate a sequence of numbers over a period of time?
(a) range() (b) len()
(c) limit() (d) lim()
17. Given a list Lst= [65,182,90,420,20,10]. What will be the correct statement to take out the 3rd element from
the list?
(a) Lst.pop(2) (b) L.find(2)
(c) L.pop(–1) (d) L.del(90)
18. What is the relationship between Primary key, Candidate key, and Alternate key?
(a) Primary key = Candidate key - Alternate key
(b) Candidate key= Primary key - Alternate key
(c) Alternate key= Primary key+ Candidate key
(d) None of the above
19. The first integrity rule for relational databases ensures that_____
(a) Primary key is unique
(b) Foreign key is unique
(c) Primary key is unique and NOT NULL
(d) There is only one candidate key
21. Assertion (A) : Python supports addition of data in file , preserving the previous data.
Reason (R) : The write mode erases all previous data of a pre-existing file.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.
SECTION B
22. Write the corresponding Python expression for the following mathematical expression.
a
(i) z = a + b – d2
(ii) z = x2 + y 3
23. (a) Identify which of the following identifiers are valid. If any are invalid, provide the reason..
(i) name_1 (ii) _SUM
(iii) $Sum (iv) num ^ 2
(b) Find the output of the following code
i=1
while (i<4):
print(i)
i=i*2
24. Mr. GopiNath, Associate Manager of Unit Nations corporate, recently discovered that the communication
between his company’s accounts office and HR office is extremely slow, and signals drop quite frequently.
These offices are 120 meters apart and connected by an Ethernet cable.
(i) Suggest him a device which can be installed in between the office for smooth communication.
(ii) What type of network is formed by having this kind of connectivity out of LAN, MAN and WAN?
o
Define hub and write its functions and types.
25. Differentiate between char(n) and varchar(n) data types with respect to databases.
26. (a) Mention any two advantages of E-mail over conventional, mail.
(b) Mr. Lal owns a factory which manufactures automobile spare parts. Suggest him the advantages of
having a web page for his factory
SECTION C
29. Write a method countFile() that counts and displays the number of lines starting with the word “FILE”
(considering both lowercase and uppercase) in the text file “start.txt”.
e.g. If the file “start.txt” contains the following lines:
Get the data value to be deleted,
Open the file for reading from it.
Read the complete file into a list
Delete the data from the list
Open the file
Open same file for writing into it
Write the modified list into file.
Close the file.
The method should display
Total lines started with word ‘FILE’ is/are: 0
o
Define a function that takes a sentence as input and displays a list of words that end with a lowercase vowel
and a list of words that end with a lowercase consonant.
30. Write the Push operation for a stack that stores person names. Ensure that the names only accept characters,
spaces, and periods (.), excluding digits. Assume that Pname is an instance attribute of the class.
o
Determine the final contents of a stack that processes the following tokens. Assume that an operand is
pushed onto the stack, and a binary operator pops two operands from the stack, performs the operation,
and then pushes the result back onto the stack..
(100, 8, 3, *, 50, 2, +, +, *)
31. Write a program that counts how often each element appears in a list provided by the user.
o
A user-defined method to open the text file “Author.txt” and display the lines that contain an even number
of words.
def evenwords():
f=open(“Author.txt”)
ln=f.readlines()
for line in ln:
linex=............// Statement
if len(linex)%2==0:
print(line)
f.close()
(a) How is readline() method different from readlines() method in Python?
(b) Write the use of the reader object in csv file operations.
(c) Fill the blank as marked statement.
SECTION D
32. (a) Write a Python program to merge the following dictionaries into a new one:
d1 = {‘X’: 15, ‘Y’: 25}
d2 = {‘Z’: 35, ‘W’: 45}
d3 = {‘P’: 55, ‘Q’: 65}
(b) Consider the table MobileStock with following fields
M_Id, M_Name, M_Qty, M_Supplier
Write the Python code to fetch all records with fields M_Id, M_Name and M_Supplier from database
Mobile.
o
(a) Sohan has a list containing 8 integers as marks of subject Science. You need to help him to create a
program with separate user defined function to perform the following operations based on the list.
(i) Push those marks into a stack which are greater than 75.
(ii) Pop and display the content of the stack.
Simple Input
Marks = [75, 80, 56, 90, 45, 62, 76, 72]
Sample Output
80 90 76
(b) Consider the following table Traders with following fields
TABLE FAMILY
No Name Female Members Male Members Income Occup-ationId
1 Mishra 3 2 7000 O1
2 Gupta 4 1 50000 O2
3 Khan 6 3 8000 O2
4 Chaddha 2 2 25000 O1
5 Yadav 7 2 20000 O3
6 Joshi 3 2 14000 O2
7 Maurya 6 3 5000 O1
8 Rao 5 2 10000 O3
Table : OCCUPATION
Occupationld Type
O1 Service
O2 Business
O3 Mixed
(a) To display Family name , corresponding occupation and income where male members are more than 2.
(b) Write SQL queries for statements (i) to (iv) based on tables FAMILY and Occupation.
(i) To select all the information of family, whose Occupation is Service.
(ii) To list the name of family, where female members are more than 3.
(iii) To list all names of family with income in ascending order.
(iv) To count the number of family, whose income is less than 10000.
35. Study the following tables DOCTOR and SALARY and write SQL commands for the questions (i) to (iv).
TABLE: DOCTOR
ID NAME DEPT SEX EXPER-IENCE
101 John ENT M 12
104 Smith ORTHOPEDIC M 5
107 George CARDIOLOGY M 10
114 Lara SKIN F 3
109 K George MEDICINE F 9
105 Johnson ORTHOPEDIC M 10
117 Lucy ENT F 3
111 Bill MEDICINE F 12
130 Morphy ORTHOPEDIC M 15
TABLE: SALARY
ID BASIC ALLOWANCE CONSULTATION
101 12000 1000 300
104 23000 2300 500
107 32000 4000 500
114 12000 5200 100
109 42000 1700 200
105 18900 1690 300
130 21700 2600 300
(i) Display NAME of all doctors who are in MEDICINE department having more than 10yrs experience
from the table DOCTOR.
(ii) Display the average salary of all doctors working in ENT department using the tables DOCTOR and
SALARY. SALARY = BASIC + ALLOWANCE.
(iii) Display the minimum ALLOWANCE of female doctors.
(iv) Display the highest consultation fee among all male doctors.
o
Write the command to change the data type of consultation to double(8,3).
SECTION E
36. Workalot Consultants are establishing a secure network for their office campus in Gurgaon to support
their daily office and web-based activities. They plan to set up connectivity between three buildings on the
campus and the head office located in Mumbai. Please answer the questions (i) to (v) after reviewing the
building positions and other details provided below.
Building GREEN 32
Building RED 150
Building BLUE 45
Head Office 10
(i) Suggest the most suitable place (i.e. building) to house the server of this organisation. Also, give a
reason to justify your suggested location.
(ii) Suggest a cable layout of connections between the buildings inside the campus.
(iii) Suggest the placement of the following devices with justification :
(a) Switch
(b) Repeater
(iv) Write the use of Modem in a network.
(v) What is the use of firewall in network?
TABLE : FLIGHTS
FL_NO STARTING ENDING NO_FLIGHT NO_STOPS
IC301 MUMBAI DELHI 8 0
IC799 BENGALURU DELHI 2 1
MC101 INDORE MUMBAI 3 0
IC302 DELHI MUMBAI 8 0
AB812 KANPUR BENGA- LURU 3 1
IC899 MUMBAI KOCHI 1 4
AM501 DELHI TRIVAN- DRUM 1 5
MU499 MUMBAI MADRAS 3 3
IC701 DELHI AHME- DABAD 4 0
(i) The command to create the table was written as :
Create table FLIGHTS( FL_NO integer, STARTING char(20), ENDING char(30), NO_FLIGHT
integer, NO_STOPS integer);
What is wrong with command ?
(ii) What is the cardinality of the table ?
(iii) Which functions will be used to :
(a) Display total number of flights .
(b) Display number of flights whose FL_NO starts with “IC”
o
(option for part (iii) only)
Write function names to :
(a) Show the average Number of stops.
(b) Show the maximum number of stops.
EN