Xii CS PB1
Xii CS PB1
Xii CS PB1
SESSION 2023-24
PRE BOARD- I
CLASS XII- COMPUTER SCIENCE
DURATION: 3 Hours MM: 70
General Instructions:
● This question paper contains five sections, Section A to E.
● All questions are compulsory.
● Section A has 18 questions carrying 1 mark each.
● Section B has 7 Very Short Answer (VSA) type questions carrying 2 marks each.
● Section C has 5 Short Answer (SA) type questions carrying 3 marks each.
● Section D has 3 Long Answer (LA) type question carrying 5 marks each.
● Section E has 2 questions carrying 4 marks each. One internal choice is given in Q 35 against
part C only.
● All programming questions are to be answered using Python Language only.
Q. Part
Question Marks
No No.
Section A
1. State True or False: In MySQL, the GROUP BY clause is used to combine all 1
such records of a table which have identical values in specified field(s).
2. Name the python library module(s) which need to be imported to run the 1
following program:
print (sqrt(random.randint(1,16)))
3. What will be the output of the following statement: 1
print(3-1**2**3+99/11)
a) 11 b) 11.0 c) -11.0 d) -11
4. Given the following dictionaries 1
dict_student = {"rno" : "53", "name" : ‘Rajveer Singh’}
dict_marks = {"Accts" : 87, "English" : 65}
Which statement will merge the contents of both dictionaries?
a) dict_student + dict_marks b) dict_student.add(dict_marks)
c) dict_student.merge(dict_marks) d) dict_student.update(dict_marks)
5. Consider the given expression: 1
True or not False and True
Which of the following will be correct output if the given expression is
evaluated?
a) True b) False c) NONE d) NULL
6. Write the output 1
a) #John#Peter#Vicky b) John#Peter#Vicky
c) John#Peter#Vicky# d) #John#Peter#Vicky#
Page 1 of 10
7. The internet facility that facilitates remote login is: 1
a) HTTP b) FTP c) TELNET d) LAN
8. Which of the following function is used with the csv modules in Python to read 1
the content of a csv file into an object?
a) readrow() b) readrows() c) reader() d) load()
9. Stack is a linear data structure which implements? 1
a) Last in First out b) Last in Last out
c) First in First out d) None of the above
10. Consider the declared dictionaries, predict the output of the following code: 1
Book={1:'Thriller', 2:'Mystery', 3:'Crime', 4:'Children Stories'}
Library ={'5':'Madras Diaries','6':'Malgudi Days'}
a) b)
c) d)
a) BACKRIGHT b) BACKRIGHTFRONT
c) BACK d) LEFTFRONTRIGHT
20. Write two points of difference between Circuit Switching and Packet Switching. 2
21. Ms. Shalini has just created a table named “Employee” containing columns 2
Ename, Department and Salary. After creating the table, she realized that she has
forgotten to add a primary key column in the table. Help her in writing an SQL
command to add a primary key column EmpId of integer type to the table
Employee. Thereafter, write the command to insert the following record in the
table: EmpId- 999 Ename- Shweta Department: Production Salary: 26900
OR
Page 3 of 10
Zack is working in a database named SPORT, in which he has created a table
named “Sports” containing columns SportId, SportName, no_of_players, and
category. After creating the table, he realized that the attribute, category has to
be deleted from the table and a new attribute TypeSport of data type string has to
be added. This attribute TypeSport cannot be left blank. Help Zack write the
commands to complete both the tasks.
22. Write a function countNow(PLACES) in Python, that takes the dictionary, 2
PLACES as an argument and displays the names (in uppercase)of the places
whose names are longer than 5 characters. For example, Consider the following
dictionary PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"}
The output should be: LONDON NEW YORK
OR
Write a function, lenWords(STRING), that takes a string as an argument and
returns a tuple containing length of each word of a string. For example, if the
string is "Come let us have some fun", the tuple will have (4, 3, 2, 4, 4, 3)
23. Predict the output of the following code: 2
OR
25. Write any two differences between Fiber-optic cable and Coaxial cable. 2
OR
Page 4 of 10
Write one advantage and one disadvantage of wired over wireless
communication.
26. The table Bookshop in MySQL contains the following attributes : B_code 3
Integer B_name String Qty Integer Price Integer Note the following to establish
connectivity between Python and MySQL.
• Username is shop
• Password is Book
The table exists in a MySQL database named Bstore. The code given below
updates the records from the table Bookshop in MySQL.
i. Statement 1 to form the cursor object.
ii. Statement 2 to execute the query that updates the Qty to 20 of the records
whose B_code is 105 in the table.
iii. Statement 3 to make the changes permanent in the database.
27. Write a method count_words_e()in Python to read the content of a textfile and 3
count the number of words ending with 'e' in the file. 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 count_words_e()
function should display the output as: No. of such words: 4
OR
Write a function reverseFile()in Python, which should read the content of a text
file “TESTFILE.TXT” and display all its line in the reverse order. Example: If
the file content is as follows: It rained yesterday. It might rain today. I wish it
rains tomorrow too. I love Rain. The RainCount()function should display the
output as: .yadretsey deniar tI .yadot niar thgim tI .oot worromot sniar ti hsiw I
.niaR evol I
28. Consider the tables below:
Page 5 of 10
a) Write the outputs of the SQL queries (i) to (iv) based on the relationsProjects 2
and Employee given below:
i) select project, count(*) from employee group by project;
ii) select pid, pname, eid, name from projects p,employee e where p.pid=e.project;
iii) select min(startdate), max(startdate) from projects;
iv) select avg(salary) from employee where doj between '2018-08-19' and '2018-08-
31';
b) Write the command to make Projects column of employee table a foreign key 1
which refers to PID column of Projects table.
29. Write a function AdjustList(L), where L is a list of integers. The function should 3
reverse the contents of the list without slicing the list and without using any
second list.
Example: If the list initially contains 2, 15, 3, 14, 7, 9, 19, 6, 1, 10, then after
reversal the list should contain 10, 1, 6, 19, 9, 7, 14, 3, 15, 2
30. A list, NList contains following record as list elements: [City, Country, distance 3
from Delhi] Each of these records are nested together to form a nested list. Write
the following user defined functions in Python to perform the specified
operations on the stack named travel.
(i) Push_element(NList): It takes the nested list as an argument and
pushes a list object containing name of the city and country, which
are not in India and distance is less than 3500 km from Delhi.
(ii) Pop_element(): It pops the objects from the stack and displays them.
Also, the function should display “Stack Empty” when there are no
elements in the stack. For example: If the nested list contains the
following data: NList=[["New York", "U.S.A.", 11734],
["Naypyidaw", "Myanmar", 3219], ["Dubai", "UAE", 2194],
["London", "England", 6693], ["Gangtok", "India", 1580],
["Columbo", "Sri Lanka", 3405]] The stack should contain:
['Naypyidaw', 'Myanmar'], ['Dubai', 'UAE'], ['Columbo', 'Sri Lanka']
The output should be: ['Columbo', 'Sri Lanka'] ['Dubai', 'UAE']
['Naypyidaw', 'Myanmar'] Stack Empty
SECTION D
31. Sheela is a Python programmer. She has written a code and created a binary file
“book.dat” that has structure [BookNo, Book_Name, Author, Price]. The
following user defined function CreateFile() is created to take input data for a
record and add to book.dat and another user defined function CountRec(Author)
which accepts the Author name as parameter and count and return number of
Page 6 of 10
books by the given Author. As a Python expert, help her to complete the
following code based on the requirement given above:
i) Identify the most appropriate column, which can be considered as Primary key. 1
ii) If 3 more columns are added and 2 rows are deleted from the table MOTOR, 1
what will be the new degree and cardinality?
iii) Write the query to: 1+1
(a) Insert the following record into the table Bcode- 207, Bname- TVS, January-
500, February- 450, April - 350.
(b) Display the names of motor bikes which are sold more than 200 in January
month.
OR (Option for part iii only)
Write the query to:
(a) Add a new column MAY in MOTOR table with datatype as integer.
Page 7 of 10
(b) Display total number of Motorbikes sold in March Month.
SECTION E
33. a) Write the output of the code given below: 2
b) The code given below accepts the increments the value of Clas by 1 foreach 3
student. The structure of a record of table Student is: RollNo – integer; Name –
string; Clas – integer; Marks – integer Note the following to establish
connectivity between Python and MYSQL: ∙ Username is root, Password is abc ∙
The table exists in a MYSQL database named school. Write the following
missing statements to complete the code:
OR
Predict the output of the code given below:
You as an expert of Python have to provide the missing statements and other
related queries based on the following code of Raman.
(i) Choose the appropriate mode in which the file is to be opened in
append mode (Statement 1)
(ii) Which statement will be used to create a csv writer object in
Statement 2.
(iii) Choose the correct option for Statement 3 to write the names of the
column headings in the CSV file, BOOKS.CSV.
(iv) Which statement will be used to read a csv file in Statement 4.
(v) Fill in the appropriate statement to check the field Title starting with
‘R’ for Statement 5 in the above program.
35. FutureTech Corporation, a Bihar based IT training and development company, is 5
planning to set up training centers in various cities in the coming year. Their first
center is coming up in Surajpur district. At Surajpur center, they are planning to
have 3 different blocks - one for Admin, one for Training and one for
Page 9 of 10
Development. Each block has number of computers, which are required to be
connected in a network for communication, data and resource sharing. As a
network consultant of this company, you have to suggest the best network
related solutions for them for issues/problems raised in question nos. (i) to (v),
keeping in mind the distances between various blocks/locations and other given
parameters.
Page 10 of 10