XII-PB1-2024-25 Set-B
XII-PB1-2024-25 Set-B
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. State True or False (1)
In Dynamic Typing the datatype attached with the variable can change during the program run
2. Which of the following is/are invalid identifier(s) in Python? (1)
(a) _number (b) None (c)123int (d)decimal
3. What will be the output of the following Python code: (1)
try:
a = 10
b=0
c = a/b
print ("a/b =", c)
except Exception as error:
print(error)
else:
print ("No Error")
a)0 b)No Error c) Value Error d) division by zero
4. What is the purpose of the SQL JOIN clause? (1)
a) To create a new table
b) To combine rows from two or more tables based on a related column
c) To delete records from a table
d) To update data in a table
5. Given the following dictionaries (1)
dict_fruit={"Kiwi":"Brown", "Cherry":"Red"}
dict_vegetable={"Tomato":"Red", "Brinjal":"Purple"}
Which statement will merge the contents of both dictionaries?
a) dict_fruit.update(dict_vegetable) b) dict_fruit + dict_vegetable
c) dict_fruit.add(dict_vegetable) d) dict_fruit.merge(dict_vegetable)
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 table (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.
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#
24. Write a suitable Python statement for each of the following tasksusing built-in functions / (1)
methods only:
a) To delete an element Mumbai:50 from Dictionary D.
b) To display words in a string S in the form of a list
OR
Write a Python Program to display alternate characters of a stringmy_str. For example, if (1)
my_str = "Computer Science" The output should be Cmuecec
25. Explain the use of ‘Foreign Key’ in a Relational Database. Give an example to support your (2)
answer.
26. (a) Write the full forms of the following: (1)
(i) POP (ii)HTTPS
(b) Write two points of difference between Circuit Switching and Packet Switching (1)
27. Predict the output of the Python code given below: (2)
value = 50
def display(N):
global value
value = 25
if N%7==0:
value=value+N
else:
value=value-N
print(value, end="#")
display(20)
print(value)
28. Consider the following two commands with reference to a table, named Students, having a (2)
column named Section:
(a) Select count(Section)from Students;
(b) Select count(*)from Students;
If these two commands are producing different results,
(i) What may be the possible reason?
(ii) Which command,(a) or (b) might be giving higher value?
OR
Name the aggregate functions which work only with numeric data, and those that work with
any type of data.
SECTION C
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. A nested list contains the data of visitors in a museum. Each of the inner lists contains the (3)
following data of a visitor: [V_no (int), Date (string), Name (string), Gender (String M/F), Age
(int)]
Write the following user defined functions to perform given operations on the stack named
"status":
(i) Push_element(Visitors) - To Push an object containing Gender of visitor who are in the age
range of 15 to 20.
(ii) Pop_element() - To Pop the objects from the stack and count the display the number of Male
and Female entries in the stack. Also, display “Done” when there are no elements in the stack.
For example: If the list Visitors contains:
[['305', "10/11/2022", “Geeta”,"F”, 35]
['306', "10/11/2022", “Arham”,"M”, 15],
['307', "11/11/2022", “David”,"M”, 18],
['308', "11/11/2022", “Madhuri”,"F”, 17],
['309', "11/11/2022", “Sikandar”,"M”, 13]]
The stack should contain F M M
The output should be: Done Female: 1 Male: 2
SECTION D
32. A csv file “Book.csv” has structure [BookNo, Book_Name, Author, Price]. (4)
a. Write a user defined function CreateFile() to input data for a record and add to Book.csv .
b. Write a function CountRec(Author) in Python which accepts the Author name as parameter
and count and return number of books by the given Author are stored in the file “Book.csv”
33. A departmental store MyStore is considering to maintain their inventory using SQL to store the (4)
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
(c)
i) Anek wants to remove the table STORE from the database MyStore, Help Abhay in
writing the command for removing the table STORE from the database MyStore.
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. 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****