CS Sample Paper 10
CS Sample Paper 10
Sample Paper 10
Computer Science (083)
CLASS XII 2023-24
Time: 3 Hours Max. Marks: 70
General Instructions:
1. Please check this question paper contains 35 questions.
2. The paper is divided into 4 Sections- A, B, C, D and E.
3. Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark
4. Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
5. Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
6. Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
7. Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
8. All programming questions are to be answered using Python Language only.
Section A
1. The output of print(math.ceil(17.34)) is
(a) 18 (b) 17
(c) 10 (d) 20
3. Two friends have connected their computers , but are getting weak signals. Which device need to be used to get
better signals?
(a) Repeater (b) Hub
(c) Switch (d) Modem
4. ______method creates a cursor object while connecting a Python application with a Mysql database.
(a) connection( ) (b) connect( )
(c) cursor( ) (d) None of these
6. 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
10. 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
14. 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)
15. The relation between Primary key , Candidate key and Alternate key is
(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
16. 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
18. 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
19. Write the corresponding Python expression for the following mathematical expression.
(i) z= a/a+ b – d2
(ii) z= x2 + y3
20. 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 metre away from each other 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.
21. (a) Determine which of the following identifiers are valid. If invalid, explain with reason.
(i) name_1 (ii) _SUM
(iii) $Sum (iv) num ^ 2
(b) Find the output of the following code
i=1
while (i<5):
print(i)
i=i*2
22. Differentiate between char(n) and varchar(n) data types with respect to databases.
23. (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
Find the syntax error in the following program and underline after correct them.
90 = w
while(w > 60)
print(w)
w = w – 50
Section C
26. Consider the tables FAMILY and Occupation:
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.
27. Write a method countFile() to count and display the number of lines starting with the word ‘FILE’ (including small
cases and upper cases) present in a 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
Write definition of a function that takes input a sentence and display the list of words that end with a lowercase
vowel and list of words that end with a lowercase consonant
28. (a) Study the following tables DOCTOR and SALARY and write SQL commands for the questions (i) to (iv).
TABLE: DOCTOR
ID NAME DEPT SEX E X P E R -
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.
(b) Write the command to change the data type of consultation to double(8,3).
29. Write a program to count the frequency of elements in a list entered by user.
30. Write the Push operation of stack containing person names. Notice that the name should only accept characters,
spaces and period (.) except digits. Assume that Pname is a class instance attribute.
o
Find the final contents of a stack that encq]lnters the following tokens.
Assume that an operand is pushed to stack and a binary operator pops two operands from stack and pushes the result
to the stack.
(100, 8, 3, *, 50, 2, +, +, *)
Section D
31. Workalot consultants are setting up a secured network for their office campus of Gurgaon for their day-to-day office
and web based activities. They are planning to have connectivity between 3 buildings and the head office situated
in Mumbai.
Answer the questions (i) to (v) after going through the building positions in the campus and other details, which are
given below:
32. (a) Write a Python program to concatenate following dictionaries to create a new one.
d1={‘A’:10, ‘B’:20}
d2={‘C’:30, ‘D’:40}
d3={‘E’:50, ‘F’:60}
(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
Write Python code to display the names of those traders who are either from Delhi or from Mumbai.
Section E
34. Consider the following table FLIGHTS :
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 BENGALURU 3 1
IC899 MUMBAI KOCHI 1 4
AM501 DELHI TRIVANDRUM 1 5
MU499 MUMBAI MADRAS 3 3
IC701 DELHI AHMEDABAD 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”
(option for part (iii) only)
Write function names to :
(a) Show the average Number of stops.
(b) Show the maximum number of stops.
35. A user-defined method to open a text file ‘Author.txt” and display the lines that have 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.
EN