कें द्रीय विद्यालय संगठन, अहमदाबाद संभाग SET-1/A
KENDRIYA VIDYALAYA SANGATHAN, AHMEDABAD REGION
प्री-बोर्ड परीक्षा:2024-25
PRE-BOARD EXAMINATION: 2024-25
SUBJECT : COMPUTER SCIENCE(083) TIME : 3 HOURS
CLASS : XII MM : 70
----------------------------------------------------------------------------------------------------
सामान्यवनदेश/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.
Q.NO SECTION-A(21x1=21 Marks) MARKS
1 State True or False: (1)
“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 Identify the output of the following code snippet: (1)
T=(100)
print(T*2)
(A) Syntax error
(B) (200,)
(C) 200
(D) (100,100)
3 Given s1=“Hello”. Which of the following statements will give an error? (1)
(A) print(s1[4])
(B) s2=s1
(C) s1=s1[4]
(D) s1[4]= “Y”
4 Write the output of following expression: (1)
5>10 and not(10<15)
5 What is the output of the expression? (1)
Page 1 of 10
s='All the Best'
p=s.split("t")
print(p)
(A) ['All ', 'he Bes', '']
(B) (‘All ', 'he Bes', '')
(C) ['All ', 't', 'he', 'Bes', 't']
(D) Error
6 Given a Tuple tup1= (10, 20, 30, 40, 50, 60, 70, 80, 90). (1)
What will be the output of print (tup1 [-2: -5])?
(A) (80,70,60)
(B) ( )
(C) (60,70,80)
(D) Error
7 What will be the output of the following python dictionary operation? (1)
data = {'A':2000, 'B':2500, 'C':3000, 'A':4000}
print(data)
(A) {'A':2000, 'B':2500, 'C':3000, 'A':4000}
(B) {'A':2000, 'B':2500, 'C':3000}
(C) {'A':4000, 'B':2500, 'C':3000}
(D) It will generate an error.
8 _______ method is used to delete a given element from the list. (1)
9 Which of the following mode in file opening statement results or generates an (1)
error if the file does not exist?
(A) a+
(B) r+
(C) w+
(D) None of the above
10 Which of the following python statement will bring the read pointer to 10th (1)
character from the end of a file containing 100 characters, opened for reading
in binary mode.
(A) File.seek(10,0)
(B) File.seek(-10,2)
(C) File.seek(-10,1)
(D) File.seek(10,2)
11 State whether the following statement is True or False: (1)
An exception may be raised even if the program is syntactically correct.
12 What will be the output of the following code? (1)
V = 50
def Change(N):
Page 2 of 10
global V
V,N = N,V
print(V,N,sep=''#'', end=''@'')
Change(20)
print(V)
(A) 20@50#20
(B) 50@20#50
(C) 20#50@20
(D) 50#50#50
13 In SQL, which operator is used to check if the column has null value/no (1)
value?
14 Consider the following statement: (1)
SELECT emp_no, name FROM emp ________ designation;
Which of the following option will be used to display the employee number
and names of similar designations together?
(A) FIELD()
(B) GROUP BY
(C) ORDER BY
(D) Both (B) and (C)
15 In which datatype the data will consume the same number of bytes as (1)
declared and is right padded?
(A) DATE
(B) VARCHAR
(C) CHAR
(D) None of these
16 Which of the following aggregate functions ignore NULL values? (1)
(A) max()
(B) count()
(C) avg()
(D) All of these
17 Which of the following is used to view emails when internet is not available? (1)
(A) SMTP
(B) POP3
(C) PPP
(D) VoIP
18 Fill in the blank: (1)
The modem at the sender’s computer end acts as a ____________.
(A) Model
(B) Modulator
Page 3 of 10
(C) Demodulator
(D) Convertor
19 Which of the following transmission media has the highest bandwidth? (1)
(A) Co axial cable
(B) Fiber optic cable
(C) Twisted pair cable
(D) None of these
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): To use a function from a particular module, we need to import (1)
the module.
Reasoning (R): import statement can be written anywhere in the program,
before using a function from that module.
21 Assertion (A): COUNT function ignores DISTINCT (1)
Reasoning (R): DISTINCT ignores the duplicate values.
Q.NO SECTION-B(7x2=14 Marks) MARKS
22 Predict the output of the Python code given below: (2)
List1 = list("Examination")
List2 =List1[1:-1]
new_list = []
for i in List2:
j=List2.index(i)
if j%2==0:
List1.remove(i)
print(List1)
23 Difference between compile time and run time error. (2)
24 (A)Given is a Python string declaration: (2)
myexam="@@PRE BOARD EXAMINATION 2024@@"
Write the output of: print(myexam[::-2])
OR
(B)Write the output of the code given below:
my_dict = {"name": "Aman", "age": 26}
my_dict['age'] = 27
my_dict['address'] = "Delhi"
print(my_dict.items())
25 Find the correct output(s) of the following code. Also write the maximum and (2)
Page 4 of 10
minimum values that can be assigned to variable Y.
import random
X=random.random()
Y=random.randint(0,4)
print (int(X),":",Y+int(X))
(A) 0:0
(B) 1:6
(C) 2:4
(D) 0:3
26 A programmer has written a code to input a number and check whether it is (2)
prime or not. However the code is having errors. Rewrite the correct code and
underline the corrections made.
def prime():
n=int(input("Enter number to check :: ")
for i in range (2, n//2):
if n%i=0:
print("Number is not prime \n")
break
else:
print("Number is prime \n’)
27 (I) A) Write the SQL command to see the list of tables in a database. (2)
OR
B) Write the SQL command to insert a new record in the table.
(II) A) What constraint should be applied on a table column so that NULL is
not allowed in that column, but duplicate values are allowed.
OR
B) What constraint should be applied on a table column so that duplicate
values are not allowed in that column, but NULL is allowed.
28 (a) Write the full forms of the following: (i) POP (ii) HTTPS (2)
OR
(b) Name the protocol used for : (i)remote login (ii) file transferring
Q.NO SECTION-C(3x3=9 Marks) MARKS
29 Write a method SHOWLINES() in Python to read lines from text file (3)
‘EXAMCS.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.
Page 5 of 10
The SHOWLINES() function should display the output as:
We all pray for everyone’s safety.
OR
Write a function RainCount() in Python, which should read the content of a
text file “RAIN.txt” and then count and display the count of occurrence of
word rain (case-insensitive) in the file.
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: Rain – 2
30 A list contains following record of a customer: (3)
[Customer_name, Phone_number, City]
Write the following user defined functions to perform given operations on the
stack named status:
(i) Push_element() - To Push an object containing name and Phone number of
customers who live in Goa to the stack.
(ii) Pop_element() - To Pop the objects from the stack and display them. Also,
display “Stack Empty” when there are no elements in the stack.
OR
Write a function in Python, Push(SItem) where , SItem is a dictionary
containing the details of stationary items– {Sname:price}.
The function should push the names of those items in the stack who have
price greater than 75. Also display the count of elements pushed into the
stack.
For example:
If the dictionary contains the following data:
Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain:
Notebook
Pen
The output should be:
The count of elements in the stack is 2
31 Predict the output of the following code: (3)
s="All The Best"
n = len(s)
m=""
for i in range(0, n):
Page 6 of 10
if (s[i] >= 'a' and s[i] <= 'm'):
m = m +s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m +s[i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m +'#'
print(m)
OR
Predict the output of the following code:
F1="WoNdERFUL"
F2="StuDenTS"
F3=""
for I in range(0,len(F2)+1):
if F1[I]>='A' and F1<='F':
F3=F3+F1[I]
elif F1[I]>='N' and F1[I]<='Z':
F3=F3+F2[I]
else:
F3=F3+"*"
print(F3)
Q.NO SECTION-D(4x4=16 Marks) MARKS
32 Write the output of the queries (i) to (iv) based on the table, TECH_COURSE (4)
given below:
A) Write the following queries:
(i) To display the details of the courses with names starting with ‘D’.
(ii) To display the fees of courses in descending order.
(iii) Display the sum of fees of all the courses for which TID is not null.
(iv) To display the course name with fees less than 15000.
OR
B) Write the output of following queries:
(i) SELECT DISTINCT TID FROM TECH_COURSE;
Page 7 of 10
(ii) SELECT TID, COUNT(*), MIN(FEES) FROM TECH_COURSE GROUP BY TID
HAVING COUNT(TID)>1;
(iii) SELECT CNAME FROM TECH_COURSE WHERE FEES>15000 ORDER BY
CNAME;
(iv) SELECT AVG(FEES) FROM TECH_COURSE WHERE FEES BETWEEN 15000
AND 17000;
33 Write a program in Python that defines and calls the following user defined (4)
functions:
a) ADD() – To accept and add data of an employee to a CSV file ‘record.csv’.
Each record consists of a list with field elements as empid, name and mobile
to store employee id, employee name and employee salary respectively.
b) COUNTR() – To count the number of records present in the CSV file named
‘record.csv’.
34 Modern Public School is maintaining fees records of students. The database (4)
administrator Aman decided that-
Name of the database -School
Name of the table – Fees
The attributes of Fees are as follows:
Rollno - numeric
Name – character of size 20
Class - character of size 20
Fees – Numeric
Qtr – Numeric
Answer the following questions:
(i) Identify the attribute best suitable to be declared as a primary key.
(ii) Write the degree of the above table if table contains 4 rows.
(iii) Insert the following data into the attributes Rollno, Name, Class, Fees and
Qtr in fees table.
(iv) (A) Aman want to remove the table Fees table from the database School.
Which command will he use from the following:
a) DELETE FROM Fees;
b) DROP TABLE Fees;
c) DROP DATABASE Fees;
d) DELETE Fees FROM Fees;
OR
(iv) (B) Now Aman wants to display the structure of the table Fees, 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.
Page 8 of 10
35 A table named student, in school database, has the following structure: (4)
RollNo – integer
Name – string
Class – integer
Marks – integer
Write the following Python function to perform the specified operation:
DataDisplay(): To input details of student and store it in the table. The
function should then retrieve and displays only those records who have marks
greater than 75.
Note the following to establish connectivity between Python and MYSQL:
Username is root , Password is tiger.
Q.NO SECTION-E(2x5=10 Marks) MARKS
36 A binary file “Book.dat” has structure [BookNo, Book_Name, Author, Price] (5)
i. Write a user defined function CreateFile() to input data for a record and add
to Book.dat .
ii. 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 binary file “Book.dat”
37 Reha Medicos Center has set up its new center in Dubai. It has four buildings (5)
as shown in the diagram given below:
Distance between various building are as follows:
Page 9 of 10
As a network expert, provide the best possible answer for the following
queries:
i) Draw the cable layout to efficiently connect various buildings.
ii) Suggest the most appropriate location of the server. Justify your choice.
iii) Suggest the placement of the following device with justification:
a) Repeater b) Hub/Switch
iv) Suggest a system (hardware/software) to prevent unauthorized access to
or from the network.
v) A) Which cable is best suited for above layout.
OR
B) What type of network (PAN, LAN, MAN, or WAN) will be set up
among the computers connected with each other?
************
Page 10 of 10