Preboard_Class12_ComputerScience_QP
Preboard_Class12_ComputerScience_QP
V GROUP OF SCHOOLS
PREBOARD COMMON EXAMINATION (2024-25)
COMPUTER SCIENCE (083)
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in
some questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.
Section-A (21 x 1 = 21 Marks)
1. State True or False:
“In a Python program, if a break statement is given in a nested loop, it terminates
the execution of all loops in one go.”
2. What will be the output of the following python expression?
print(2**3**2)
a. 64 b. 256 c. 512 d. 32
3. Which one of the following is False regarding data types in Python?
a. In Python, explicit data type conversion is impossible
b. Mutable data types are those that can be changed.
c. Immutable data types are those that cannot be changed.
d. None of the above
4. The return type of string.split() is a
a. string b. List c. Tuple d. Dictionary
5. Select the correct output of the code:
S="Computer Students are very smart"
l=S.split()
s_new="-".join([l[0].upper(),l[1],l[2].lower(),l[3],l[4].upper()])
print(s_new)
a. COMPUTER-students-ARE-very-SMART
b. COMPUTER-Students-are-very-SMART
c. computer-students-are-very-SMART
d. COMPUTER-STUDENTS-ARE-VERY-SMART
6. What will be the output of the following code:
t=(4,5,6)
t1=t*2
t2=t+t1
print(t1)
print(t2)
a. b.
(4, 5, 6, 4, 5, 6) (4, 5, 6, 4, 5, 6)
(4, 5, 6, 4, 5, 6, 4, 5, 6, 4, 5, 6) (4, 5, 6, 4, 5, 6, 4, 5, 6)
c. d.
4, 5, 6 [4, 5, 6, 4, 5, 6]
[4, 5, 6, 4, 5, 6, 4, 5, 6]
7. Given the following dictionary
Emp1={"salary":10000,"dept":"sales","age":24,"name":"john"}
Emp1.keys()
can give the output as
a. (“salary”,‟dept”,‟age‟,‟name‟) b. (['salary', 'dept', 'age', 'name'])
c. [10000,‟sales‟,24,‟john‟] d. {„salary‟,‟dept‟,‟age‟,‟name‟}
8. Select the correct output of the code :
S= " Azadi Ka Amrit Mahotsav @ 2022"
a=S.partition (" ")
print (a)
a. ('', ' ', 'Azadi Ka Amrit Mahotsav @ 2022')
b. ['', ' ', 'Azadi Ka Amrit Mahotsav @ 2022']
c. (' Azadi Ka Amrit Mahotsav ', '@', ' 2022')
d. ('Amrit', ' ', 'Mahotsav @ 2022')
9. Which SQL command is used to change some values in existing rows?
a) update b) insert c) alter d) order
10. Which method is used to move the file pointer to a specified position.
a. tell()
b. seek()
c. seekg()
d. tellg()
11. State True or False
A try block must have 1 or more except blocks to handle exception.
12. What will be the output of the following code?
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)
a. 5#50# b. 50#50 c. 5#5 d. 50#30
13. The correct definition of column ‘alias’ is
a. A permanent new name of column
b. A new column of a table
c. A view of existing column with different name
d. A column which is recently deleted
14. Select the correct statement, with reference to SQL:
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.
15. A_______ is a query that retrieves rows from more than one table or view:
a. Start b. End c. Join d. All of these
16. In a relational model, _______ is the number of rows.
a. Attribute b. Degree c. Cardinality d. Tuple
17. Two doctors seating in a room and sharing some data between their mobile phone.
Identify the type of network formed by their devices.
a. LAN b. MAN c. PAN d. WAN
18. Fill in the blank:
_______ is used for point-to-point communication or unicast communication
such as radar and satellite.
a. Micro waves b. Infrared waves
c. Radio waves d. Bluetooth
19. Fill in the blank:
The modem at the sender’s computer end acts as a .
a. Model b. Modulator c. Demodulator d. Convertor
Q20 and Q21 are Assertion(A) and Reason(R) 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 A
c. A is True but R is False
d. A is False but R is True
20. Assertion (A): In Python, when we use while loop, first condition is checked. If the
condition allows, then loop body is executed.
Reason (R): In Python, while loop is considered as an entry-controlled loop.
21. Assertion (A): CSV (Comma Separated Values) is a file format for data storage which
looks like a text file.
Reason (R): The information is organized with one record on each line and each field is
separated by comma.
Section-B (7 x 2 = 14 Marks)
25. What are the possible outcome(s) from the following code? Also, specify the
maximum and minimum values that can be assigned to variable SEL.
import random
SEL=random. randint (1, 3)
ANIMAL = ["DEER", "Monkey", "COW", "Kangaroo"]
for A in ANIMAL:
for AA in range (0, SEL):
print (A, end ="")
print ()
i. ii. iii. iv.
DEERDEER DEER DEER DEER
MONKEYMONKEY DELHIMONKEY MONKEY MONKEYMONKEY
COWCOW DELHIMONKEYCO COW KANGAROOKANGAROOKANGAROO
KANGAROOKANGAROO W KANGAROO
26. Rishaan has written a code to input a number and check whether it is even or odd
number. His code is having errors. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made.
Def checkNumber(N):
status = N%2
return
#main-code
num=int (input (“Enter a number to check :)) k=checkNumber(num)
if k = 0:
print (“This is EVEN number”)
else:
print (“This is ODD number”)
Now Ritika wants to remove the column Quantity from the table CHStore . And she
also wants to display the structure of the table CHStore, i.e, name of the attributes
and their respective data types that she has used in the table. Help her to write the
correct commands.
28. Write two points of difference between Circuit Switching and Packet Switching.
OR
Differentiate Web browser and Webserver.
Section-C ( 3 x 3 = 9 Marks)
29. Write a function count_Dwords () in Python to count the words ending with a digit
in a text file "details.txt".
Example:
If the file content is as follows:
On seat2 VIP1 will sit and
On seat1 VVIP2 will be sitting
Output will be:
Number of words ending with a digit are 4
OR
Write a method in Python to read lines from a text file “book.txt”, to find and display
the occurrence of the word 'are'. For example, if the content of the file is:
Books are referred to as a man’s best friend. They are very beneficial for mankind
and have helped it evolve. Books leave a deep impact on us and are responsible for
uplifting our mood.
The output should be 3.
30. Two list Lname and Lage contains names of persons and age of persons
respectively. A list named Lnameage is empty. Write functions as details given below
(i) Push_na() :- it will push the tuple containing pair of name and age from
Lname and Lage whose age is above 50
(ii) Pop_na() :- it will remove the last pair of name and age and also print
name and age of removed person. It should also print “underflow” if
there is nothing to remove
For example, the two lists have following data Lname=[‘narender’, ‘jaya’, ‘raju’,
‘ramesh’, ‘amit’, ‘Piyush’]
Lage=[45,23,59,34,51,43]
After Push_na() Lnameage stack should contain: [(‘raju’,59),(‘amit’,51)]
The output of first execution of pop_na() should be: The name removed is amit
The age of person is 51
OR
A list, NList contains following record as list elements:
[City, Country, distance 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']
31. Predict the output of the code given below:
def convert(Old):
l=len(Old)
New=" "
for i in range(0,l):
if Old[i].isupper():
New=New+Old[i].lower()
elif Old[i].islower():
New=New+Old[i].upper()
elif Old[i].isdigit():
New=New+"*"
else:
New=New+"%"
return New
Older='InDIa@2022'
Newer=convert(Older)
print('New String is: ', Newer)
OR
Section-D ( 4 x 4 = 16 Marks)
OR
Consider the following tables BOOKS and ISSUED in a database named “LIBRARY”.
Write SQL commands for the statements (i) to (iv).
i. Display book name and author name and price of computer type books.
ii. To increase the price of all history books by Rs 50.
iii. Show the details of all books in ascending order of their prices.
iv. To display book id, book name and quantity issued for all books which have
been issued.
33. Ronit has a CSV file “marks.csv” which has name, class and marks separated by comma. He is
writing a Python program to copy only rows of students of class 2 to another CSV file “class.csv”.
He has written the following code. Help him to successfully execute the given task.
import csv
file = open('class.csv', 'w' , 1 )
w1 = 2 (file)
with open('marks.csv') as 3 :
data = csv. reader(csvfile)
for row in data:
if 4 == '2' :
writer. 5 (row)
file.close()
i. While opening the file what needs to be added to suppress extra EOL during
writing?
ii. Fill in the bank with the name of the filehandle to be used.
iii. Fill in the blank to select the right field which needs to be compared with 2.
iv. Fill in the blank with correct function to write in csv file.
34. Based on given tables “ACCOUNT” and “TRANSACT” answer following questions:
35. Design a Python application that fetches only those records from Event table
of menagerie database where type is Kennel.
MYSQL credentials:
user = "root"
password = "lion"
Section-E ( 2 x 5 = 10 Marks)
36. Ariba Malik has been following incomplete code, which takes a student’s
details (rollnumber, name and marks) and writes into a binary file stu.dat
using pickling.
import pickle
sturno=int(input(“Enter roll number:”))
stuname=input(“Enter name:”)
stumarks=float(input(“Enter marks:”))
stu1={“RollNo.”:sturno,”Name”:stuname,”Marks”:stumarks}
with __________ as fh: # Fill_Line1
________________ # Fill_Line2
______________ as fin: # Fill_Line3
________________ # Fill_Line4
print(Rstu)
if Rstu[“Marks”]>=85:
print(“Eligible for merit certificate”)
else:
print(“Not eligible for merit certificate”)
(a) Complete Fill_Line1 so that the mentioned binary file is opened for writing in fh
object using a with statement.
(b) Complete Fill_Line2 so that the dictionary stu1’s contents are written on the file
opened in step(a)
(c) Complete Fill_line3 so that the earlier created binary file is opened for reading in a
file object namely fin, using a with statement.
(d) Complete Fill_line4 so that the contents of open file in fin are read into a dictionary
namely Rstu.
37. The USA-based company, Micron, has selected Tata Projects to build the
semiconductor assembly and test facility in Sanand Town, near Ahmedabad in Gujurat.
It is planning to set up its different units or campuses in Sanand Town and its head office
campus in New Delhi.
Shortest distance between various locations of Sanand Town blocks and Head
Office at New Delhi:
Number of computers installed at various locations are as follows:
As a network consultant, you have to suggest the best network related solution for their
issues/problems raised :
(i) Suggest the most appropriate location of the SERVER to get the best and effective
connectivity. Justify your answer.
(ii) Suggest the best wired medium and draw the cable layout (location to location) to
efficiently connect various locations
(iii) Which hardware device will you suggest to connect all the computers within each
location?
(iv) Suggest a system (hardware/software) to prevent unauthorized access to or from
the network.
(v) Which type of network out of the following is formed by connecting the computers
of New Delhi Head Office and Sanand Town Units?
a) LAN b) MAN c) WAN d) PAN