PRE-BOARD EXAMINATION (2024-25)
CLASS-XII
COMPUTER SCIENCE(083)
TIME: 03:00 HOURS MM: 70
GENERAL INSTRUCTIONS
This Question paper contain 09(Nine) printed pages.
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.
QNO SECTION -A (21 x 1=21 Marks) Marks
State True or False-
1 1
“continue keyword skips remaining part of an iteration in a loop”
State the correct output of the following code-
S1= “India is on the Moon”
A=S1.split("o",3)
print(A)
2 1
a) ['India is ', 'n the M', ' ', 'n']
b) 'India is ', 'n the M', ' ', 'n'
c) ['India is n ', 'the ', ' ', 'Mn']
d) [„India is‟, „the‟, „n‟]
Identify the output of the following code snippet:
text = "PYTHONPROGRAM"
text=text.replace('PY','#')
print(text)
3 1
a) #THONPROGRAM
b) ##THON#ROGRAM
c) #THON#ROGRAM
d) #YTHON#ROGRAM
str1=" Programming "
str2=" is My Junoon"
str3=str1.strip()+str2.replace("J", "j").lstrip()
print(str3.partition("My"))
4 a) ('Programmingis ', 'My', ' junoon') 1
b) ['Programmingis ', 'My', ' junoon']
c) ['Programming is ', 'My', ' Junoon']
d) (('Programmingis ', 'My', ' Junoon')
1/8
What will be the output of the following code snippet?
5 message= "Olympics 2024" 1
print(message[-2::-4])
Given the following tuple-
T1= (10,30,20,50,40)
6 Which of the following statement will result an error? 1
a) print(T1[0]) b) print(len(T1)) c) print(T1[-4:3]) d) print(T1.insert(2,3))
If dict1 is a dictionary defined below, then which of the following will raise an
exception?
dict1={“Dhoni”:95,”Virat”:99,”Rohit”:100}
7 1
a) print(str(dict1))
b) dict1.get(“Virat”)
c) print(dict1([“Dhoni”,”Rohit”])
d) dict1[“Rohit”]=158
What does this statement will do in python
>>>L1=[10,20,30] # Statement 1
>>>L1.insert(-3,1) # Statement 2
>>>print(L1) # Statement 3
8 1
a) The statement 2 will insert the element -3 at index 1
b) The statement 2 will insert the element 1 at index -3
c) The statement 2 will insert the element 1 after the value 10
d) The statement 2 will insert the element -3 after the value 30
If a table which has one Primary key and two alternate keys. How many Candidate
keys will this table have?
9 1
a) 1 b) 2 c) 3 d) 4
Which of the following modes keeps the file offset position at the end of file?
10 1
a) r b) w c) a d) r+
In a try-except block with multiple except blocks, which block will be executed if an
Exception matches multiple except blocks?
11 a) The first matching except block encountered from top to bottom 1
b) All matching except blocks simultaneously
c) The last matching except block encountered from top to bottom
d) None of the above
What will be output of the following code?
X=10
def exam(Y=20):
X=30
12 Z=X+Y 1
print(X,Z,end=”#”)
exam(30)
print(X,end=”$”)
a) 30 60#10$ b) 30 60 $10# c) 30 10#10$ d) 30 50#10$
13 Which SQL command is used to change the name of a column? 1
2/8
What will be output of the following SQL command?
SELECT * FROM EMP WHERE EMPNAME LIKE “%S_”
14 a) details of all employee whose name begin with S 1
b) name of all employee whose name ends with S
c) details of all employee whose name second last character is S
d) name of all employee whose name second last character is S
In which data type the value stored is padded with spaces to fit the specified length?
15 1
a) DATE b) VARCHAR c) FLOAT d) CHAR
How many primary key can be defined in a relation/table in mysql?
16 1
a) 1 b) 2 c) as much as required in a relation d) 0
Which protocol is used to send and receive email?
17 1
a) HTTPS b) FTP c) SMTP d) PPP
Paheli is having an internet connection between her office and server room through
an Ethernet cable (i.e. twisted pair) but the network speed is very poor and need to
amplify/boost the signal. Which of the following device is required as a booster to
18 1
amplify the signal?
a) Gateway b) router c) modem d) repeater
Which switching technique use dedicated physical connection is to be established
between the source and destination?
19 1
a) Packet Switching c) Message Switching
b) Circuit Switching d) Hybrid Switching
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
Assertion(A): if an existing file whose size was 40 Byte is opened in write mode
and after writing another 40 Byte into file it is closed. The file size is 80 Byte after
closing.
20 1
Reason(R):File size will remain 40 Byte as it was not opened in the append mode
so old content be lost
Assertion (A): A SELECT command in SQL can have both WHERE and HAVING
clauses.
21 1
Reasoning (R): WHERE and HAVING clauses are used to check conditions,
therefore, these can be used interchangeably.
Q No Section-B ( 7 x 2=14 Marks) Marks
Give two examples of each of the following-
22 a) Logical operator b) Relational operator 2
Mani Ayyar, a python programmer, is working on a project which requires him to
define a function with name CalculateInterest().
23 2
He defines it as:
def CalculateInterest(Principal,Rate=.06, Time): # Code
3/8
But this code is not working; Can you help Mani Ayyar to identify the error in the
above function and with the solution?
a) Write the Python statement of each of the following task using BUILT-IN
function/methods only-
i) To delete an element 20 from the list lst1
ii) To replace the string “That” with “This” in the string str1.
24 2
OR
b) A dictionary dict2 is copied into the dictionary dict1 such that the common keys
values get updated. Write the python command to do the task and after that
empty the dictionary dict1
What possible output(s) are expected to be displayed on screen at the time of
execution of the program from the following code? Also specify the minimum values
that can be assigned to each of the variables BEGIN and LAST.
import random
VALUES=[10,20,30,40,50,60,70,80]
BEGIN=random.randint(1,3)
25 2
LAST=random.randint(BEGIN,4)
for I in range (BEGIN, LAST+1):
print (VALUES[I],"-",)
a) 30 - 40 - 50 - c) 30 - 40 - 50 - 60 -
b) 10 - 20 - 30 - 40 – d) 30 - 40 - 50 - 60 - 70 –
The given Python code to print all Prime numbers in an interval (range) inclusively.
The given code accepts 02 number (low & high) as arguments for the function
Prime_Series() and return the list of prime numbers between those two numbers
inclusively. Observe the following code carefully and rewrite it after removing all
syntax and logical errors. Underline all the corrections made.
def Prime_Series(low, high)
primes = [ ]
for i in range(low, high + 1):
flag = 0
if i < 2:
continue
if i =2:
26 2
primes.append(2)
continue
for x in range(2, i):
if i % x == 0:
flag = 1
break
if flag == 0:
primes.appends(i)
return primes
low=int(input("Lower range value: "))
high=int(input("High range value: ")
print(Prime_Series())
4/8
(I) Attempt either A or B.
a) Bhojo wants to create a table in Mysql, in which he want only unique value
not even NULL , what constraint Bhojo should use.
OR
b) What constraint should be applied on a table column so that NULL is not
allowed in that column, but duplicate values are allowed.
27 2
(II) Attempt either A or B.
a) Write an SQL command to remove column empcontact from emp table
OR
b) Write an SQL command to make the column B_ID the Primary Key of an
already existing table, named BSTORE.
Give one difference between web browser and webserver.
OR
28 Expand the following terms- 2
a) VoIP b) SMTP c) SLIP d) TCP/IP
Q No Section-C ( 3 x 3 = 9 Marks) Marks
a) Write a method/function CNTWORDS() in python to read contents from a text file
PROCURE.TXT, to count and return the occurrences of those words, which are
having 4 or more characters.
b) Write a method/function LINECOUNT() in Python to read lines from a text file
CONTENT.txt, and display those lines, which have #anywhere in the line.
For example, If the content of the file is-
29 Had an amazing time at the Vidyalaya Annual function last night with #MusicLovers. 3
Excited to announce the launch of our KVS new website !
KVS # G20
The method/function should display-
Had an amazing time at the Vidyalaya Annual function last night with #MusicLovers.
KVS # G20
a) Paheli has created a dictionary D, containing names and salary as key value
pairs of 5 employees. Write separate functions to perform the following
operations:
● PUSH(HS, D), where HS is the stack and D is the dictionary which containing
names and salaries. Push the keys (name of the employee) of the dictionary into
a stack, where the corresponding value (salary) is greater than ₹75,000.
● POP(HS), where HS is the stack. Pop and display the content of the stack.
● PEEK(HS),This function displays the topmost element of the stack without
30 deleting it. If the stack is empty, the function should display 'None'. 3
OR
b) Write the following user defined functions with reference to STACK-
Write the definition of a user-defined function PUSH_ODD(N) which accepts
a list of integers in a parameter `N` and pushes all those integers which are
odd from the list `N` into a Stack named `OddNumbers`.
For example- If the integers input into the list `VALUES` are:
[10, 5, 8, 3, 12,11]
Then the stack `OddNumbers` should store: [5,3,11]
5/8
Write function POP_ODD() to pop the topmost number from the stack and
returns it. If the stack is already empty, the function should display "Empty".
Write function DISP_ODD() to display all element of the stack without
deleting them. If the stack is empty, the function should display 'None'.
Predict the output of the following code
OR
31 3
Predict the output of the following Code-
Q No Section-D ( 4 x 4 = 16 Marks) Marks
Consider the table MSTORE as given below
M_Id M_Company M_Name M_Price M_Mf_Date M_qty
MB001 Samsung Galaxy 15000 12-02-2013 5
MB003 Nokia N1100 12500 15-04-2011 2
MB004 Micromax Unite 3 5500 17-10-2016 3
32 MB005 Sony Unite 3 25000 20-11-2017 2 4
MB006 Oppo SelfieEx 18500 21-08-2010 1
MB007 Samsung Galaxy 20000 14-09-2022 3
MB008 Nokia N1100 30000 11-08-2023 5
Note: The table contains many more records than shown here.
6/8
A) Write the following queries-
I) Display total quantity(M_qty) of each mobile name(M_name),excluding mobile
name(M_name) with total quantity(M_qty)less than 3.
II) Display maximum and minimum price(M_price) of mobile with
company(M_company)name
III) Display mobile company(M_company),Mobile name(M_name) of those
IV) Display mobile id(M_id) and mobile company(M_company) of those mobiles
whose mobile company(M_company)second character is not n
B) Write the output of the following queries-
I) SELECT M_ID,M_NAME, M_PRICE FROM MSTORE WHERE
M_COMPANY NOT IN (“Samsung”,”Nokia”,”Sony”);
II) UPADTE MSTORE SET M_PRICE=M_PRICE+M_PRICE*0.1 WHERE
M_COMPANY =”NOKIA” OR M_COMPANY=”OPPO”;
III) SELECT M_NAME,SUM(M_PRICE) AS TOTAL_PRICE FROM MSTORE
GROUP BY M_NAME ;
IV) SELECT M_COMPANY,M_PRICE FROM MSTORE ORDER BY
M_COMPANY,M_PRICE DESC;
A CSV file “Employee.csv” contains data of Employees. Each record of the file
contains the following data.
Name of the Employee
Designation of Employee
Salary of the employee
Contact number of the employee
33 For example, a sample record of the file may be: 4
[„NRAMAN‟, “ENGG”, 95000, 3426827]
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 of Employee whose salary is more than 50000.
II) Count the number of records in the file.
7/8
34 4
OR
Display the NATURAL JOIN of these two tables.
A table, named bookdetails ,in bookstore database has the following structure-
Field Type
Bookid int(10)
Bookname varchar(15)
Price float
Qty int(10)
Note the following to establish connectivity between Python and MySQL:
35 Username - root 4
Password - tiger
Host - localhost
Write the following Python function to perform the specified operation-
BOOK_ADD_DISP(): To input details of an item and store it in the table bookdetails.
The function should then retrieve and display all records from the bookdetails table
where the Price is greater than 450.
8/8
Q.No SECTION E (2 X 5 = 10 Marks) Marks
You are programmer in a software company,Your work profile is to manage the
records of various employees. For this you want following information of each
employee to be stored-
Employee_id – integer
Employee_Name – string
Emoployee_job – string
Employee_sal – float
36 As a programmer complete the following task- 5
I) Write a function INPUT_DATA() to input the data of an employee and append
it in a binary file.
II) Write a function UPDATE_SAL() to update the salary of employees by
Rs10000/- whose job is “programmer”.
III) Write a function READ_DATA() to read the data from the binary file and
display the data of all those employees who are not "Engg".
An International Bank has to set up its new data centre in Delhi, India.
It has five blocks of buildings – A, B, C, D and E.
37 5
i) Suggest the most suitable block to host the server. Justify your answer.
ii) Draw the cable layout (Block to Block) to economically connect various blocks
within the Delhi campus of International Bank.
iii) Suggest the placement of the following devices with justification:
a) Repeater b) Hub/Switch
iv) The bank is planning to connect its head office in London. Which type of
network out of LAN, MAN, or WAN will be formed? Justify your answer.
v) Suggest a device/software to be installed in the Delhi Campus to take care of
data security.
*** ALL THE BEST ***
9/8