XII-PB1-2024-25 Set-A
XII-PB1-2024-25 Set-A
XII-PB1-2024-25 Set-A
2024-2025
CLASS XII
COMPUTER SCIENCE (083)
TIME: 03 HOURS M.M.: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 21 questions carrying 01mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 03 Short Answer type questions carrying 03 marks each.
6. Section D has 04 Long Answer type questions carrying 04 marks each.
7. Section E has 02 questions carrying 05 marks each.
8. All programming questions are to be answered using Python Language only.
SECTION A
1. Write statement to assign a tuple containing an Integer? (1)
2. Which of the following data type in Python supports concatenation? (1)
a) int b) float c) bool d) str
3. What will be output of the following code: (1)
d1={1:2,3:4,5:6}
d2=d1.popitem()
print(d2)
a){1:2} b){5:6} c)(1,2) d)(5,6)
4. The correct output of the given expression is: (1)
True and not False or False
(a)False (b)True (c)None (d) Null
5. Fill in the blank: (1)
Command is used to add a new column in a table in SQL.
a)update b)remove c)alter d)drop
6. Consider the Python statement: (1)
f.seek(10, 1)
Choose the correct statement from the following:
(a) File pointer will move10 byte in forward direction from beginning of the file
(b) File pointer will move 10 byte in forward direction from end of the file
(c) File pointer will move 10 byte in forward direction from current location
(d) File pointer will move 10 byte in backward direction from current location
7. Choose correct SQL query which is expected to delete all rows of a tab (1)
a) DELETE TABLE;
b) DROP TABLE emp;
c) REMOVE TABLE emp;
d) DELETE FROM emp;
8. Which of the following is NOT a DML Command? (1)
(a)Insert (b)Update (c)Drop d) delete
9. Select the correct output to the code: (1)
a="Year2022atallthe best"
a=a.split('a')
b=a[0]+"-"+a[1]+"-"+a[3]
print (b)
a) Year–0-atAllthebest b) Ye-r2022-llthe best
c) Year–022-at Allthebest d) Year–0-atallthebest
10. Which of the following statement(s) would give an error during execution? (1)
S="Lucknow is the Capital of UP " #Statement1
print(S) #Statement2
S[4]='$’ #Statement3
S="Thankyou" #Statement4
S=S+"Thankyou" #Statement5
(a)Statement3 (b)Statement4 (c)Statement5 (d)Statement4 and 5
11. Which of the following function returns a list datatype? (1)
a) d=f.read() b) d=f.read(10) c) d=f.readline() d)d=f.readlines()
12. Select the correct statement, with reference to SQL: (1)
a) Aggregate functions ignore NULL
b) Aggregate functions consider NULL as zero or False
c) Aggregate functions treat NULL as a blank string
d) NULL can be written as 'NULL' also.
Q 20 and 21 are ASSERTION AND REASONING 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
c) A is True but R is False
d) A is false but R is True
20. Assertion (A):-The default arguments can be skipped in the function call. (1)
Reason (R):-The function argument will take the default values even if the values are supplied
in the function call
21. Assertion(A):A tuple can be concatenated to a list, but a list cannot be concatenated to a tuple. (1)
Reason(R): Lists are mutable and tuples are immutable in Python.
SECTION B
22. Ravi has written a function to print Fibonacci series for first 10 element. His code is having
errors. Rewrite the correct code and underline the corrections made. Some initial elements of (2)
Fibonacci series are:
def fibonacci()
first=0
second=1
print((“first no. is “, first)
print(“secondno.is, second)
for a in range (1,9):
third=first+second
print(third)
first,second=second,third
febonacci()
23. What possible outputs (s) are expected to be displayed on screen at the time of execution of (2)
the program from the following code? Also specify the maximum values that can be assigned
to each of the variables FROM and TO.
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print(AR[K],end="#")
(i)10#40#70# (ii)30#40#50# (iii)50#60#70# (iv)40#50#70#
29. Write a method SHOWLINES() in Python to readlines from text file‘TESTFILE.TXT’ and
display the lines which do not contain 'ke'.
Example: If the file content is as follows: An apple a day keeps the doctor away. We all pray
for everyone’s safety. A marked difference will come in our country.
The SHOWLINES() function should display the output as:
We all pray for everyone’s safety.
OR
Write a function in python to count the number of lines in a text file ‘Country.txt’ which are
starting with an alphabet ‘W’ or ‘H’. (3)
For example, If the file contents are as follows:
Whose woods these are I think I know.
His house is in the village though; He will not see me stopping here To watch his woods fill
up with snow.
The output of the function should be: W or w:1 H or h : 2
30. Consider the following tables GAMES. Give outputs for SQL queries (i) to (iv). (2+
Table:GAMES 1)
GCode GameName Number PrizeMoney ScheduleDate
101 CaromBoard 2 5000 23-Jan-2004
102 Badminton 2 12000 12-Dec-2003
103 TableTennis 4 8000 14-Feb-2004
105 Chess 2 9000 01-Jan-2004
108 LawnTennis 4 25000 19-Mar-2004
(i) SELECT COUNT(DISTINCT Number) FROM GAMES;
(ii) SELECT MAX(ScheduleDate), MIN(ScheduleDate) FROM GAMES;
(iii) SELECT SUM(PrizeMoney) FROM GAMES;
(iv) SELECT * FROM GAMES WHERE PrizeMoney>12000;
(b)Write the command to view all the databases in an RDBMS.
31. Write a function in Python PUSH_IN(L), where L is a list of numbers. From this list, push all (3)
numbers which are multiple of 3 into a stack which is implemented by using another list.
OR
Write a function in Python, Push(KItem),where KItem is a dictionary containing the details of
Kitchen items– {Item:price}.
The function should push the names of those items in a stack which have price less than 100.
Also display the average price of elements pushed into the stack.
For example: If the dictionary contains the following data:
{"Spoons":116,"Knife":50,"Plates":180,"Glass":60}
The stack should contain
Glass
Knife
The output should be:
The average price of an item is 55.0
SECTION D
32. A csv file "Emp.csv" contains the data of a survey. Each record of the file contains the following (4)
data:
● Name of a country
● Population of the country
● Sample Size (Number of persons who participated in the survey in that country)
● Profile (Businessman/Serviceman)
For example, a sample record of the file may be:
[‘Signiland’, 5673000, 5000, ‘Serviceman’]
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 population is more than 5000000.
(II) Count the number of records in the file.
33. A departmental store MyStore is considering maintaining their inventory using SQL to store (4)
the data. As a database Administrator, Anek has decided that:
Name of the database–mystore
Name of the table –STORE
The attributes of STORE are as follows
ItemNo –numeric
ItemName–character of size 20
Scode – numeric
Quantity– numeric
Table : STORE
ii) Anek wants to display the structure of the table STORE i.e.name of the attributes and
their respective data types that he has used in the table. Write the query to display the
same.
OR
(c)
(i) Anek wants to ADD a new column price with data type as decimal in store column.
Write the query to add the column..
(ii) Anek wants to remove a column price from the table STORE. Write the query.
34. Write SQL queries for (a) to (d)on the basis of tables given below Table : (4)
35 A table, named STATIONERY, in ITEMDB database, has the following structure: (4)
Field Type
itemNo int(11)
itemName varchar(15)
price float
qty int(11)
Write the following Python function with mysql connectivity to perform the specified operation:
AddAndDisplay(): To input details of an item and store it in the table STATIONERY.
The function should then retrieve and display all records from the STATIONERY table where the
Price is greater than 120.
Assume the following for Python-Database connectivity: Host: localhost, User: root, Password:
Pencil
SECTION E
36 Surya is a manager working in a recruitment agency. He needs to manage the records of various (1+
candidates. For this, he wants the following information of each candidate to be stored: - 2+2)
Candidate_ID – integer - Candidate_Name – string - Designation – string - Experience – float
You, as a programmer of the company, have been assigned to do this job for Surya.
(I) Write a function to input the data of a candidate and append it in a binary file.
(II) Write a function to update the data of candidates whose experience is more than 10 years
and change their designation to "Senior Manager".
(III) Write a function to read the data from the binary file and display the data of all those
candidates who are not "Senior Manager".
37 Piccadily Design and Training Institute is setting up its centre in Jodhpur with four specialised (5)
units for Design, Media, HR and Training in separate buildings. The physical distances between
these units and the number of computers to be installed in these units are given as follows.
Shortest distances between various locations in metres :
Design Unit to Media Unit 60
Design Unit to HR Unit 40
Design Unit to Training Unit 60
Media Unit to Training Unit 100
Media Unit to HR Unit 50
Training Unit to HR Unit 60
Number of computers installed at various locations are as follows :
Design Unit 40
Media Unit 50
HR Unit 110
Training Unit 40
You as a network expert, have to answer the queries as raised by the administrator as given in (a)
to (e).
a) Suggest by drawing the cable layout for effective network connectivity.
b) Suggest the most suitable location to install the main server.
c) Suggest the devices to be installed in each of these buildings for connecting computers
installed within each of the units out of the following : Modem, Switch, Gateway, Router
d) Suggest an efficient as well as economic wired medium to be used within each unit for
connecting computer systems out of the following network cable : Co-axial Cable, Ethernet
Cable, Single Pair Telephone Cable
e) Is there a requirement of a repeater in the given cable layout? Why/Why not?
****END****