0% found this document useful (0 votes)
123 views251 pages

Class XII Computer Science Pre-Board 2024-25

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views251 pages

Class XII Computer Science Pre-Board 2024-25

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

केन्द्र�य �वद्यालय संगठन आगरा संभाग

प्रथम प्री बोडर् पर��ा 2024-25

KENDRIYA VIDYALAYA SANGATHAN AGRA REGION


First Pre-Board Examination-2024-25

CLASS XII -COMPUTER SCIENCE (083)


अ�धकतम समय : घंटे अ�धकतम अंक : 70
Max. Time –3 hours Max. marks – 70
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.

[Link] SECTION-A (21 x 1 = 21 MARKS) Marks


1 State True or False 1
Variable declaration is implicit in python.

2 Predict the output of the following code snippet 1


Marks = { ‘Manoj’: 92, ‘Suresh’: 79, ‘Vaibhav’:88 }
print ( list( [Link]( ) ) )
a. ‘Manoj’ , ’Suresh’, ‘Vaibhav’
b. 92, 79, 88
c. [‘Manoj’, ‘Suresh’, ‘Vaibhav’]
d. (‘Manoj’, ‘Suresh’, ‘Vaibhav’)
3 Write the output of the following python expression: 1
print ( (20 >25) and (5==5 ) or ( 18 < 12) )

4 Find the output of the following code snippet 1


S=9, (2, 13, 8), 5, (1, 6)
print ( len (S) )
a. 4
b. 7
c. 6
d. Error
5 Select the correct output of the code: 1
a=’assistance’
a=[Link](‘a’)

Page 1 of 12
b=a[0] + ‘-‘ + a[1] + ‘-‘ + a[2]
print(b)
a. -a-ssistance
b. -a-ssist-nce
c. a-ssist-nce
d. -a-ssist-ance

6 Which of the following operations on a string will generate an error ? 1


a. ‘python’ * 2
b. ‘python’ + 2
c. ‘python’ + ’2’
d. ‘python’ + ’python’

7 Identify the invalid statement for list L=[1,2,3,4] 1


a. [Link](3)
b. [Link](3)
c. [Link](3)
d. del L[3]

8 Write a python dictionary named record with keys 12101, 12102, 12103 and 1
corresponding values as ‘krishna’ , ’prarabdh’ , ’shorya’ respectively.

9 Which of the following types of table constraints will prevent the entry of 1
duplicate rows and NULL value?
a. unique
b. distinct
c. not null
d. primary key

10 Consider the Python statement: [Link](10, 1) 1


Choose the correct statement from the following:
a. file pointer will move 10 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.

11 What will be the output of the following code snippet. 1


def divide(a,b):
try:

Page 2 of 12
result=a/b
except ZeroDivisionError:
print('You Cannot divide by zero')
except ValueError:
print('Invalid Input')
except:
print('An error occurred')
finally:
print('The end of the program')
divide(10,0)
a. You Cannot divide by zero
Invalid Input
An error occurred
The end of the program
b. You Cannot divide by zero
Invalid Input
The End of the program
c. You Cannot divide by zero
An error occurred
The end of the program
d. You Cannot divide by zero
The end of the program

12 Consider the code given below and find correct output: 1


x=5
def function1( ):
global x
y=x+x*2
print(y, end=”,”)
x=7
function1()
print(x)
Output:
a. 21 , 7 b. 15 , 5
c. 21 , 5 d. 15, 7

Page 3 of 12
13 A table has initially 5 columns and 8 rows. Consider the following sequence of 1
operations performed on the table –
i. 8 rows are added
ii. 2 columns are added
iii. 3 rows are deleted
iv. 1 column is added
What will be the cardinality and degree of the table at the end of above
operations?
a. 8,13 b. 13,8 c. 14,5 d. 5,8

14 Which statement in MySql will display all the tables in a database? 1


a. SELECT * FROM TABLES;
b. USE TABLES;
c. DESCRIBE TABLES;
d. SHOW TABLES;

15 Fill in the blank: 1


_________________command is used to remove the tuple from the table in
SQL.
a. del b. delete
c. alter d. remove

16 GROUP BY clause is used to sort data 1


a. In ascending order
b. In descending order
c. Both A & B
d. None of the Above

17 Which is the smallest network? 1


a. WAN b. LAN
c. MAN d. PAN

18 MAC address is assigned to the 1


a. Router b. Switch
c. NIC Card d. Graphic Card

19 For communication, data in a network is divided into smaller chunks 1


called_____________________________
a. packets b. parcels
c. photons d. slice

Page 4 of 12
Q20 and 21 are ASSERTION AND REASONING 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):- If the arguments in a function call statement match the number 1
and order of arguments as defined in the function definition, such arguments are
called positional arguments.
Reasoning (R):- During a function call, the argument list first contains default
argument(s) followed by positional argument(s).

21 Assertion (A): In SQL, the aggregate function avg() calculates the average value 1
on a set of values and produces a single result.
Reason (R): The aggregate functions are used to perform some fundamental
arithmetic tasks such as min(), max(), sum() etc

[Link] SECTION – B ( 7 * 2 = 14 Marks) Marks

22 Identify the data type of each of the following values. 2


a. True
b. ‘ True ’
c. 10/2
d. 10 % 2

23 Predict the output for the following python snippet 2


def calc (p , q = 3 ):
ans=1
for x in range ( q ) :
ans=ans*p
return ans
print(calc(3) )
print(calc(3,2) )

24 A. Write the python statement for each of the following tasks using BUILT-IN 2
functions/methods only:
1. To check whether all the characters in the string S1 are digits or not.
2. To delete the elements from index no 3 to 7 in the list L1.
OR

Page 5 of 12
B. Consider the following list exam and write python built in function for the
following questions
Exam=[‘hindi’,’english’,’maths’,’science’]
1. To insert subject ‘computer science’ as last element.
2. To sort the list in reverse alphabetical order.

25 What possible outputs(s) are expected to be displayed on screen at the time of 2


execution of the program from the following code? Also specify the maximum
AND minimum values that can be assigned to the variable Num when P = 7.
import random as r
val = 35
P=7
Num = 0
for i in range(1, 5):
Num = val + [Link](0, P - 1)
print(Num, " $ ", end = "")
P=P-1
(a) 41 $ 38 $ 38 $ 37 $
(b) 38 $ 40 $ 37 $ 34 $
(c) 36 $ 35 $ 42 $ 37 $
(d) 40 $ 37 $ 39 $ 35 $

26 Rewrite the following Python program after removing all the syntactical errors 2
(if any), underlining each correction:
def checkval:
x = input("Enter a number")
if x % 2 =0:
print (x, "is even")
elseif x<0:
print (x, "should be positive")
else:
print (x, "is odd")

Page 6 of 12
27 1. In a database there is a table cabinet. The data entry operator is not able 2
to put NULL in a column of cabinet? what may be the possible reason(s)?
2. In a database there is a table cabinet. The data entry operator is not able
to insert duplicate values in a column of cabinet ? what may be the
possible reason(s)?
OR
1. There is a column C1 in a table T1. The following two statements
Select count(*) from T1; and Select count(C1) from T1;
Are giving different outputs. What may be the possible reason?
2. How are NULL values treated by aggregate functions?

28 A. Write the full form of the following: 2


1. POP 2. HTTPS
B. how is hub different from switch
OR
A. Write the full form of following
1. VoIP 2. FTP
B. define the term protocol with respect to networks.

[Link] SECTION – C ( 3 * 3 = 9 Marks) Marks

29 Write a function Show_words( ) in python to read the content of a text file 3


‘[Link]” and display the entire content in capital letters. Example if the file
contains:
“This is a test file”
Then the function should display the output as:
THIS IS A TEST FILE
OR
Write a user defined function read_story( )in python that displays the words that
ends with the character ‘H’ or ‘h’ in the text file ‘[Link]’

30 [Link] has created a list of elements. Help him to write a program in python with 3
functions, PushEl(element) and PopEl() to add a new element and delete an
element from a List of elements, considering them to act as push and pop
operations of the Stack data structure. Push the element into the stack only when
the element is divisible by 4.
For eg:if L=[2,5,6,8,24,32]
then stack content will be 32 24 8

Page 7 of 12
OR
Tushar received a message(string) that has uppercase and lowercase letters. He
wants to extract all the upper case letters from the string and push them into a
stack. Help him to do this task by performing the following user defined functions
in python.
a. Push the uppercase alphabets of the string into a stack.
b. Pop and display the content of the stack. Once the stack is empty it should
display the message ‘End of Stack’
For example: If the message is
“All the Best for your Pre-Board Examination”
The output should be: EBPBA
End of Stack

31 Find & write the output of the following python code: 3


def makeNew(mystr):
newstr=’’
count=0
for i in mystr:
if count%2 != 0:
newstr=newstr+str(count)
else:
if [Link]():
newstr=newstr+[Link]()
else:
newstr=newstr+i
count+=1
newstr=newstr+mystr[:1]
print(‘The new string is : ‘, newstr)
makenew(‘sTUdeNT’)
OR
s="PREboardCS*2024!"
j=2
for i in [Link]('*'):
k=i[:j]
if [Link]():
j=j+1
elif [Link]():

Page 8 of 12
j=j+2
else:
j=j+3
print(s [ j : : j ] )

[Link] SECTION – D ( 4 * 4 = 16 Marks) Marks


32 (Write a output for SQL queries (i) to (iii), which are based on the table: 4
SCHOOL and ADMIN given below:

A. Write the following queries


B. Write the output

Write the output:


a. select sum(periods), subject from school group by subject ;
b. select teachername, gender from school, admin where
designation=’coordinator’ and [Link]=[Link];
c. select count(distinct subject) from school
d. select * from school where periods between 24 and 27.
OR
Write the query:
a. Display the subject wise total no of teachers.
b. Display the name and experience of teachers whose name starts from ‘P’
and ends on ‘I’
c. Add the following record in the school table
(1743, ‘Manoj’, ‘Computer Science’, 10/05/2004, 20, 6)
d. Display the subject and HOD of all departments.

33 A csv file [Link] contains the details of events organized by firm M/s 4
MakeMyEvents. Each record of the file contains the following data
Id of the Event

Page 9 of 12
Event description
Venue of the event
Total No of Guest invited
Total cost of organizing the event
Write the following functions in Python to perform the specific operations on this
file :
(i) Search( ) – To display the details of those events having more than
1000 guests.
(ii) CountR( ) – To calculate and display the average cost of event.
• Assume the first row of the file [Link] have headers
For example
Event_id Description Venue Guests Cost
1001 Birthday BigBites 250 150000
1002 Marriage RajMandir 1100 1250000

34 Consider the tables given below. 4


Table : STOCK
Itcode Itname Dcode Qty UnitPrc StkDate
444 Drawing Copy 101 10 21 31-June-2009
445 Sharpener Camlin 102 25 13 21-Apr-2010
450 Eraser Natraj 101 40 6 11-Dec-2010
452 Gel Pen Montex 103 80 10 03-Jan-2010
457 Geometry Box 101 65 65 15-Nov-2009
467 Parker Premium 102 40 109 27-Oct-2009
469 Office File 103 27 34 13-Sep-2010

Table : DEALERS
Dcode Dname Location
101 Vikash Stationers Lanka Varanasi
102 Bharat Drawing Emporium Luxa Varanasi
103 Banaras Books Corporation Bansphatak Varanasi

a. To display all the information about items containing the word “pen” in the
field Itname in the table STOCK.
b. List all the itname sold by Vikash Stationers.
c. List all the Itname and StkDate in ascending order of StkDate.

Page 10 of 12
d. List all the Itname, Qty and Dname for all the items for the items quantity
more than 40.
OR
e. List all the details of the items for which UnitPrc is more than 10
and <= 50.
35 Virat has created a table named TRAVELS in MySQL: 4
The fields of the table are
Tour_id-string
Destination – string
Geo_Cond=string
Distance-integer(In KM)
Note the following to establish connectivity between Python & MySQL :
UserName = root
Password=bharat
The table TRAVELS exists in a MYSQL database named TOUR.
Virat wants to display All records of TRAVELS relation whose Geographical
condition is hilly area and distance less than 1000 KM. Help Virat to write
program in python

[Link] SECTION – E ( 2 * 5 = 10 Marks) Marks

36 Vedansh is a Python programmer working in a school. For the Annual Sports 5


Event, he has to created a binary file ‘[Link]’ with Student_Id, St_Name,
Game_Name and Result to store the results of students in different sports
events. As a python expert help Vedansh to.
1. Write a function to input the details of all the participants in the binary file
[Link].
2. display the records of those students who won the game, which is
inserted in the Result field with ‘Won’ and ‘Loss’ data.

37 TCS decided to open a new AI innovation center at Delhi. The center consists 5
of Five Buildings and each contains number of computers. The details are
shown below.

Building-2
Building-1 Building-3

Building-5 Building-4

Page 11 of 12
Distance between the buildings
Building No of computers
Building 1 and 2 20 Meters
1 40
Building 2 and 3 50 Meters
2 45
Building 3 and 4 120 Meters
3 110
Building 3 and 5 70 Meters
4 70
Building 1 and 5 65 Meters
5 60
Building 2 and 5 50 Meters

Computers in each building are networked but buildings are not networked so
far. The Company has now decided to connect building also.
I. Suggest a cable layout for connecting the buildings
II. Do you think anywhere Repeaters required in the campus? Why
III. The company wants to link this office to their head office at Mumbai
a. Which type of transmission medium is appropriate for such link?
b. What type of network would this connection result into?
IV. Where server is to be installed? Why?
V. Suggest the wired Transmission Media used to connect all buildings
efficiently.
OR
Which device will you suggest to be placed/installed in each of these buildings to
efficiently connect all the computers within these buildings.

----All The Best ----

Page 12 of 12
केन्द्र�य �वद्यालय संगठन
प्रथम प्री बोडर् पर��ा-2024-25
KENDRIYA VIDYALAYA SANGATHAN
AGRA REGION
First - Pre Board Examination-2024-25
क�ा XII (COMPUTER SCIENCE)
Max. Time – 3 hours Max. Marks – 70

अ�धकतम समय - 3 घंटे अ�धकतम अंक – 70

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 (21 x 1 = 21 Marks) Marks

1. State True or False: (1)


As a Dictionary is mutable, both Key & Value are also mutable.

2. Identify the output of the following code snippet: (1)


remark = "SQL - Structured Query Language"
note = remark[2:18].split()
print(note)
(A) ['L', '-', 'Structured', 'Qu']
(B) ['L', '-', 'Structured', ' ']
(C) ['L', '-', 'Structured', 'Q']
(D) 'L – Structured Q'

3. Write the output of the following python expression: (1)

PAGE NO. 1 OF 14
print ((4>5) and (2!=1) or (4<9))
(A) Run Time Error
(B) Logical Error
(C) False
(D) True

4. What is the output of the expression? (1)


STR=”trip@split”
print([Link](“t”))
(A) rip@spli
(B) trip@spli
(C) rip@split
(D) rip@spli

5. What will be the output of the following code snippet? (1)


gist=”Old is Gold”
X=[Link](“s”)
print(X[-1:-3])
(A) ()
(B) (' Gold')
(C) (' Gold', 'is')
(D) None of the above

6. What will be the output of the following code? (1)


MainList = ["One", ["2", "3"], "4"]
CheckList = [ MainList[1] ]
print(CheckList)
(A) [“2”]
(B) [“2”, ”3”]
(C) [ [“2”,”3”] ]
(D) Syntax Error

7. If “dict” is a dictionary as defined below, then which of the following (1)


statements will raise an exception?
dict = {'Rose': 10, 'Lily': 20, 'Sunflower': 30}
(A) [Link]('Sunflower')

PAGE NO. 2 OF 14
(B) print(dict['Rose', 'Lily'])
(C) dict['Rose']=40
(D) print(str(dict))

8. Identify the invalid python statement from the following: (1)


(A) t=(100)
(B) t=tuple()
(C) t=(100,)
(D) None of the above

9. Choose the correct statement from the following about a primary key (1)
column:
(A) Cannot have NULL values and can have UNIQUE values.
(B) Can have NULL as well as UNIQUE values.
(C) Cannot have NULL and cannot have UNIQUE values.
(D) Can have NULL but not UNIQUE values.

10. Consider the following python statement: (1)


F=open(“[Link]”)
Which of the following is an invalid statement in python?
(A) [Link](0)
(B) [Link](“PASS”)
(C) [Link]()
(D) None of the above

11. State whether the following statement is True or False: (1)


“More than one exception is not allowed in a single try block.”

12. What will be the output of the following code: (1)


Local=100
def Update(Global=0):
global Local
Local += Global
print(Local, ”#”, Global)

Update(50)
Update()

PAGE NO. 3 OF 14
13. Which SQL command can decrease Cardinality of a Relation? (1)

14. What will be the output of the query? (1)


“SELECT name FROM student WHERE name like ‘%ar%’;
(A) Display name of students whose name ends with ‘ar’.
(B) Display details of students whose name ends with ‘ar’.
(C) Display name of students whose name has ‘ar’ anywhere in name.
(D) Display details of students whose name has ‘ar’ anywhere in name.

15. Ms. Meera(a database administrator) is thinking to create a column in (1)


a table in which she wants to give the DATA TYPE in such a manner
that column contains maximum of 20 characters but memory of ONLY
of the actual values/characters entered by the user is occupied. Which
data type she should prefer for the column from the following?
(A) LONG
(B) CHAR
(C) VARCHAR
(D) DATE

16. Which one of the following SQL clauses is always used in the end of (1)
any SQL query?
(A) WHERE
(B) ORDER BY
(C) HAVING
(D) GROUP BY

17. Which protocol is used for downloading & uploading files over the (1)
Internet?
(A) HTTP
(B) VoIP
(C) FTP
(D) SMTP

18. Which network device is used to make coming weak signals into (1)
strong and then forward?
(A) HUB
(B) SWITCH

PAGE NO. 4 OF 14
(C) MODEM
(D) REPEATER

19. ________________ is the structure/arrangement of computers connected (1)


in a network.

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): Default arguments in a function are used to assign values to (1)
such parameters in which values are not passed at the time of function call.
Reason(R): It is mandatory to have default values to all parameters coming
on right side of any default parameter in the function header.

21. Assertion(A): A column size may be updated in an already created (1)


relation.
Reason(R): The size of the column may be increased by using UPDATE
SQL command.

Q. No. Section-B ( 7 x 2=14 Marks) Marks

22. What is the use of “in” operator? Identify from the following in which “in” (2)
operator may be used:-
“ONE”, (1), [1,2,3], 23

`23. Consider the following python code snippet: (2)


for C in range(1,10): # Statement-1
if C>5: # Statement-2
print(C ,end="") # Statement-3
break # Statement-4
Write the output of the above code in the following 2 cases:
1. Statement-4 is a comment &
2. Statement-4 is not a comment.

24. Consider the given below Lists L1 & L2 and answer the following (2)
using built-in function only:

PAGE NO. 5 OF 14
L1 = [10, 10, 20, 10, 30, 20]
L2 = [0, 1, 2, 1, 2, 0, 1]
1. (a) Write python command to delete last element from list L2.
OR
(b) Write python command to count 20 from list L1.
2. (a) Write python command to add [1, 0, 2] in the end of list L2.
OR
(b) Write python command to sort list L1 in ascending order.

25. What possible outputs(s) are expected to be displayed on screen at (2)


the time of execution of the program from the following code? Also
specify the maximum values that can be assigned to each of the
variables BEG and END.

(A) 30@
(B) 10@20@30@40@50@
(C) 20@30
(D) 40@30@

26. Rewrite the following code in Python after removing all syntax (2)
error(s). Underline each correction done in the code.

Y=integer(input(“Enter 1 or 10”))
if Y==10
for Y in range(1,11):
print(Y)
elseif Y<10:
for m in range(5,0,-1):
print(thank you)

PAGE NO. 6 OF 14
27. 1. (a) What constraint should be applied on a table column so that (2)
value entered by the user in that column must be in a specified range
of values not outside it?
OR
(b) What constraint should be applied on a table column so that the
column must not have NULL values & duplicate values?
2. (a) Write the SQL command to list the names of all the tables already
created in the database.
OR
(b) Write the SQL command to list the details(all column names, data
type, size, constraint) of a table “PLAYER”.

28. (A) Expand MODEM. Write the use of MODEM in networking. (2)
OR
(B) Expand XML. Write one benefit of XML over HTML.

Q. No. Section-C ( 3 x 3 = 9 Marks) Marks

29. Write a function COUNTLINES_ET() in python to read lines from a text (3)
file [Link] and COUNT those lines which are starting either
with ‘E’ and ‘T’ respectively. And display the Total count separately.

For example: if [Link] consists of


“ENTRY LEVEL OF PROGRAMMING CAN BE LEARNED FROM
PYTHON. ALSO, IT IS VERY FLEXIBLE LANGUGAE. THIS WILL BE
USEFUL FOR VARIETY OF USERS.”

Then, Output will be:


No. of Lines with E: 1
No. of Lines with T: 1
OR

Write a function SHOW_TODO() in python to read contents from a text


file [Link] and display those lines which have occurrence of the
word ‘‘TO’’ or ‘‘DO’’.

PAGE NO. 7 OF 14
For example : If the contents of the file are:
“THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT OF
HARD WORK. WE ALL ARE EXPECTED TO DO HARD WORK. AFTER
ALL, EXPERIENCE COMES FROM HARDWORK.”

The function should display lines:


• THIS IS IMPORTANT TO NOTE THAT SUCCESS IS THE RESULT
OF HARD WORK.
• WE ALL ARE EXPECTED TO DO HARD WORK.

30. (A) A stack named Emp_Stack that contains records of Employees. Each (3)
Employee record is represented as a list containing
[Emp_No, Emp_Name, Salary]
Write the following user-defined functions in Python to perform the specified
operations on the stack Emp_Stack:
(I) Push_Emp(Emp_Stack, New_Emp): This function takes the
stack Emp_Stack and a new employee record New_Emp as
arguments and pushes the new employee record onto the stack.
(II) Pop_Emp(Emp_Stack): This function pops the topmost
employee record from the stack and returns it. If the stack is
already empty, the function should display "Underflow".
(III) Peep(Emp_Stack): This function displays the topmost element
of the stack without deleting it. If the stack is empty, the function
should display 'None'.
OR
(B) A dictionary named D_STATE contains the record in the following
format:
{ Country : State }
Also, a stack name STATE(a list) will store the names of the states.

Define the following functions with the given specifications:

PAGE NO. 8 OF 14
(I) Push_State(D_STATE): It takes the dictionary as an argument
and pushes all the states in the stack STATE whose state name
is less than 10 characters.
(II) Pop_State(): This function pops the topmost state from the stack
STATE and returns it. Also, if the stack is already empty, the
function should display "Empty".
(III) Disp_State(): To display all elements of the stack STATE
without deleting them. If the stack is empty, the function should
display 'None'.

31. Predict the output of the following code: (3)


Msg="CompuTer"
Msg1=””
for I in range(0, len(Msg)):
if Msg[I].isupper():
Msg1=Msg1+Msg[I].lower()
elif I%2==0:
Msg1=Msg1+'*'
else:
Msg1=Msg1+Msg[I].upper()
print(Msg1)
OR
tuple1 = (11, 22, 33, 44, 55 ,66)
list1 =list(tuple1)
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)

Q. No. Section-D ( 4 x 4 = 16 Marks) Marks

PAGE NO. 9 OF 14
32. Consider the table SURGERY as given below: (4)
SID SNAME FEES STARTDATE OTNO
S301 HEART 15000 2021-11-15 302
S302 LIMBS 9000 2021-10-20 NULL
S303 LEVER 10000 2023-07-02 301
S304 KIDNEY 5000 2024-08-01 NULL
S305 STOMOCH 18000 2024-03-25 302

(A) Write SQL queries for the following:


I. To display contents of SURGERY table sorted by STARTDATE in
descending order.
II. To display the sum of FEES of all the SURGERYs for which the
OTNO is NULL.
III. To display the SURGERY ID & FEES of SURGERYs whose name
starts with “D”.
IV. To display the no. of SURGERYs whose FEES is less than 12000
and OTNO is not “301”.
OR
(B) Write the output of the given below SQL queries:-
I. SELECT DISTINCT OTNO FROM SURGERY;
II. SELECT OTNO, COUNT(*), MIN(FEES) FROM SURGERY
GROUP BY OTNO HAVING COUNT(OTNO)>1;
III. SELECT SNAME FROM SURGERY WHERE FEES>=15000
ORDER BY SNAME;
IV. SELECT AVG(FEES) FROM SURGERY WHERE FEES BETWEEN
15000 AND 19000;

33. A csv file "[Link]" contains the population data of various cities. (4)
Each record of the file contains the following data:
● ID of the city
● Name of the city
● Population of the city
● Area(in sq. mtrs.) of the city

PAGE NO. 10 OF 14
For example, a sample record of the file may be:
[‘C001’, ‘Jaipur’, 697000, 5000]
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 for which the population is more than 200000.
(II) Count & display the number of cities whose data is stored in the
file.

34. Write SQL commands for the following queries (i) to (iv) based on the (4)
relations TRAINER & COURSE given below:

I. Display all details of Trainers who are living in city CHENNAI.


II. Count and Display the number of Trainers in each city.
III. Display the Course details which have Fees more than 12000 and
name ends with ‘A’.
IV. (A) Display the Trainer Name & Course Name from both tables
where Course Fees is less than 10000.
OR
(B) Display the Cartesian Product of above two tables.

35. A table, named PRODUCT, in PRO_DB database, has the following (4)
structure:
Attribute Name Data Type

PAGE NO. 11 OF 14
PID int(6)
PNAME Varchar(20)
COMPANY Varchar(20)
PRICE Float

Write the following Python function to perform the specified operation:


AddNewProduct(): To input details of Product and store it in the table
PRODUCT. The function should then retrieve and display all records from
the PRODUCT table where the Price is less than 250.

Assume the following for Python-Database connectivity:


(Host: localhost, User: root, Password: Time)

Q. No. SECTION E (2 X 5 = 10 Marks) Marks

36. Manan, an Exam in-charge of a college is planning to keep record of (5)


various Tests which are going to be held. For this, he wants the
following information of each Test to be stored:
• TestId – integer
• Subject – string
• MaxMarks – integer
• ScoredMarks – integer
You, as a programmer of the college, have been assigned to do this
job for Manan. A binary file named “[Link]” has some records of
the structure [TestId, Subject, MaxMarks, ScoredMarks]

(I) Write a function named NewTest() to input the data of a TEST


and append it in [Link] binary file.
(II) Write a function named UpdateMM(Sub) that will update the
MaxMarks of Tests by 10 of Subject entered as argument in
function.
(III) Write a function in Python named DisplayAvgMarks(Sub) that
will accept a subject as an argument and read the contents of

PAGE NO. 12 OF 14
[Link]. The function will calculate & display the Average of
the ScoredMarks of the passed Subject on screen

37. “VidyaDaan” an NGO is planning to setup its new campus at Nagpur for its (5)
web-based activities. The campus has four(04) UNITS as shown below:

 Distances between above UNITs are given as under:


UNIT-1 UNIT-2 DISTANCE(In mtrs.)
ADMIN TRAINING 65
ADMIN RESOURCE 120
ADMIN FINANCE 100
FINANCE TRAINING 60
FINANCE RESOURCE 40
TRAINING RESOURCE 50

 No. of Computers in various UNITs are:


UNIT NO. OF COMPUTERS
ADMIN 150
FINANCE 25
TRAINING 90
RESOURCE 75

I. Suggest an ideal cable layout for connecting the above UNITs.


II. Suggest the most suitable place i.e. UNIT to install the server for the
above NGO.

PAGE NO. 13 OF 14
III. Which network device is used to connect the computers in all
UNITs?
IV. Suggest the placement of Repeater in the UNITs of above network.
V. (A) NGO is planning to connect its Regional Office at Kota,
Rajasthan. Which out of the following wired communication, will you
suggest for a very high-speed connectivity?
(a)Twisted Pair cable (b) Ethernet cable (c) Optical Fiber
OR
(B) What type of network (PAN, LAN, MAN, or WAN) will be set up
among the computers connected in the NAGPUR campus?
***************

PAGE NO. 14 OF 14
केन्द्र�य �वद्यालय संगठन

आगरा संभाग

प्रथम प्री बोडर् पर��ा-2024-25

KENDRIYA VIDYALAYA SANGATHAN


AGRA REGION
First Pre Board Examination-2024-25

क�ा XII (COMP SC)

Max. Time –3 hours Max. marks – 70

अ�धकतम समय -3 घंटे अ�धकतम अंक – 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.
[Link]./ Part-A Marks
प्रश्न भाग- अ अंक
संख्या
1 State True or False: 1
None is same as 0 or Empty String

2 Write the output:- 1


myTuple =("John", "Peter", "Vicky")
x = "#".join(myTuple)
Page 1 of 12
print(x)
(a) #John#Peter#Vicky
(b) John#Peter#Vicky
(c) John#Peter#Vicky#
(d)#John#Peter#Vicky#
3 Which of the following expressions evaluates to TRUE. 1
(a) not(True) or not (False))
(b) print(True and False)
(c) print(not(False and True))
(d) print(not (True) and False)
4 1
Select the correct output of the code:
s = "Question paper 2024-25"
s= [Link]('2')
print(s)
(a) ['Question paper ', '0', '4', '-', '5']
(b) ('Question paper ', '0', '', '-', '')
(c) ['Question paper ', '0', '4-', '5']
(d) ('Question paper ', '0', '4', '', '-', '5')
5 What will be the output of the following code snippet? 1
message= "Tea City"
print(message[-1::-1])
6 What will be the output of the following code? 1
tuple1 = (1, 2, 4, 3)
tuple2 = (1, 2, 3, 4)
print(tuple1 < tuple2)
(A) True
(B) False
(C)tuple1
(D)Error
7 If one_dict is a dictionary as defined below, then which of the following 1
statements will raise an exception
one_dict = {'shoes': 1000, 'bag': 1200, 'specs': 500}
Page 2 of 12
(a) one_dict.get('specs')
(b) print(one_dict['shooes'])
(c ) k=one_dict.keys()
(d ) print(str(one_dict))
8 What does the [Link](a) method do in Python? 1
(A) Deletes the element at index a from the list
(B) Deletes the first occurrence of value a from the list
(C) Deletes all occurrences of value a from the list
(D) Deletes the last occurrence of value a from the list
9 If a table which has one primary key and two unique constraints. How 1
many Primary keys will this table have?
(A) 1 (B) 2 (C) 3 (D) 4
10 Consider the Python statement: 1
[Link](10, 1)
Choose the correct statement from the following:
(a) file pointer will move 10 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
11 In a try...expect block, there is a certain block that if specified, will be 1
executed regardless if the try block raises an error or not. What is the
name of this block? (a) finally (b) last (c) always
12 What will be the output of the following code? 1
value = 10
def show(n):
global value
value=25
if value%2==0:
value = value + n
else:

Page 3 of 12
value = value - n
print(value,end='#')
show(20)
print(value,end='%')
(A) 12%15#
(B) 10#5%
(C) 12#15%
(D) 12%15#
13 Which SQL command can change the data type of already present 1
attribute of an existing relation?
14 What will be the output of the query? 1
SELECT AVG(SALARY) FROM EMPLOYEE WHERE CITY LIKE ‘%R’;
(A) Average of salary for cities whose names start with 'R'
(B) Average of salary for cities whose names end with 'R'
(C) Salary for cities whose names end with 'R'
(D) Salary for cities whose names starts with ‘R’
15 To store the grade of students, which of the following data type will be 1
used?
(a) Char (b)Int (c )Date (d) float
16 The following command 1
Select count(*) from employee;
Will show (a) degree (b) cardinality (c) domain
17 Suggest a protocol that is used to transmit E-mail over internet.
(A) HTTP (B) FTP (C) VoIP (D)SMTP
18 Which network device is used to connect two networks that use same 1
protocols?
(A) Modem (B) Gateway (C)Switch (D)Bridge
19 Which switching technique follows the store and forward mechanism? 1
(a) Circuit switching (b) message switching
(c) packet switching (d) All of these
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the
correct choice as:

Page 4 of 12
(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): A variable declared as global inside a function is visible 1
with changes made to it outside the function.
Reasoning (R): All variables declared outside are not visible inside a
function till they are redeclared with global keyword
21 Assertion (A): Aggregate functions operate on groups of rows and return 1
a single result for each group.
Reasoning (R): It can be used with WHERE and HAVING clauses only.
Ques. PART B Marks
No.
22 How is a mutable object different from an immutable object in Python? 2
Identify one mutable object and one immutable object from the following:
{21:12,12:21}, (21,12), [12,21], ‘1231’
23 Give two examples of each of the following: 2
(I) Logical operators (II) Relational operator
24 Given is a Python List declaration: 2
lst1= [39, 45, 23, 15, 25, 60]
(Answer using built in functions only)
(a) Insert value 90 at index 3
(b) Display elements of list in reverse
OR
(a) Add another list [2,3,4] at end of lst1
(b) Find sum of elements of list
25 What possible output(s) are expected to be displayed on screen at the 2
time of execution of the program from the following code? Find
maximum and minimum value of begin.
import random
points=[30,50,20,40,45]
begin=[Link](1,3)

Page 5 of 12
last=[Link](2,4)
for c in range(begin,last+1):
print(points[c],"#")
(a) 20#50#30# (b) 20#40#45
(c) 50#20#40# (d) both (b) and (c)
26 There are syntax and logical errors in the code. Rewrite it after removing 2
all errors. Underline all the corrections made.
def find_sum(tup1,tup2)
newtup=tup1+tup2
return newtup

result= find_sumI((1, 2, 3, 4)+ (9))


print("sum of newly formed tuple: ", len(result))
27 (I) 2
A) What constraint should be applied on a table column so that different
values are allowed in that column, but NULL is not allowed.
OR
B) What constraint should be applied on a table column so that NULL and
duplicate values are not allowed in that column
OR
(II)
A) Write an SQL command to remove the column ADD_PHONE_NO
from a table, named STUDENT.
OR
B) Write an SQL command to change the data type of the column
PHONE_NO as VARCHAR(10) of table, named STUDENT.

28 A) List one advantage and one disadvantage of BUS topology. 2


OR
B) Expand the term FTP. What is the use of FTP.
Ques. PART C Marks
No.

Page 6 of 12
29 Write a function capit() in Python to read content of a text file 3
‘[Link]’ and display the entire content in capital letters.
OR
Write a function Disp_Lines() in Python which should read lines from a
text file [Link] and display the lines starting with the alphabet T.
30 A) You have a stack named ItemsStack that contains records of 3
Items.
Each Item record is represented as a list containing Item_title,
name, and price. Write the following user-defined functions in
Python to perform the specified operations on the stack
ItemsStack:
(I) push_Item(ItemsStack, new_Item): This function takes the
stack ItemsStack and a new Item record new_Item as
arguments and pushes the new Item record onto the stack.
(II) pop_Item(ItemsStack): This function pops the topmost Item
record from the stack and returns it. If the stack is already
empty, the function should display "Underflow".
(III) (III) peep(ItemsStack): This function displays the topmost
element of the stack without deleting it. If the stack is empty,
the function should display 'None'.
OR
(B) Write the definition of a user-defined function `push_div(N)` which
accepts a list of integers in a parameter `N` and pushes all those integers
which divisible by 5 from the list `N` into a Stack named `Numbers`.
Write function pop_div() 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_div() to display all element of the stack without
deleting them. If the stack is empty, the function should display 'None'
For example: If the integers input into the list VALUES are: [15, 25, 28,
23, 20] Then the stack `Numbers` should store: [15, 25, 20]
31 Predict the output of the following code : 3

Page 7 of 12
d={"IND":"DEL","SRI” :"COL","CHI":"BEI"}
str1=""
for i in d:
str1=str1+str(d[i])+"@"
str2=str1[:–1]
print (str2)
OR
L=[1,2,3,4,5]
Lst=[]
for i in range(len(L)):
if i%2==1:
t=(L[i],L[i]**2)
[Link](t)
print(Lst)
Ques. PART D Marks
No.
32 Consider the table CHIPS as given below: 4

TABLE: CHIPS

BRAND_NAME FLAVOUR PRICE QTY

LAYS ONION 10 5
BIKANO TOMATO 20 12
UNCLE CHIPS SPICY 12 10
KALEVA PUDINA 10 12
HALDIRAM SALTY 10 20
HALDIRAM TOMATO 25 30

Write the following queries:


a) To display the total Quantity for each Brand_name.
b) To display the table sorted by price in ascending order.
c) To display the distinct flavour from the Chips table

Page 8 of 12
d) To display names of those brands whose name have anywhere ‘K’
in their Brand_name .
OR

(i) Select max(price) from CHIPS;

(ii) Select count( distinct (BRAND_NAME)) from CHIPS;

(iii) Select price , price *1.5 from CHIPS where FLAVOUR =


“PUDINA”;

(iv) Select BRAND_NAME, count(*) from CHIPS group by


BRAND_NAME;
33 A csv file "[Link]" contains the data of a book. 4
(i) ADD() – To accept and add data of an student to a CSV file
‘[Link]’. Each record consists of a list with field elements as bookid,
name, qty to store in ‘[Link]’.
(ii) COUNTR() – To count the number of records present in the CSV
file named ‘[Link]’ for those books having qty more than 25.
34 Write the outputs of the SQL queries (i) to (iv) based on the 4

relations Teacher and Placement given below:


Table : Teacher
T_ID Name Age Department Date_of_join Salary Gender
1 Arunan 34 Computer Sc 2019-01-10 12000 M
2 Saman 31 History 2017-03-24 20000 F
3 Randeep 32 Mathematics 2020-12-12 30000 M
4 Samira 35 History 2018-07-01 40000 F
5 Raman 42 Mathematics 2021-09-05 25000 M
6 Shyam 50 History 2019-06-27 30000 M
7 Shiv 44 Computer Sc 2019-02-25 21000 M
8 Shalakha 33 Mathematics 2018-07-31 20000 F
Table : Placement
P_ID Department Place
1 History Ahmedabad

Page 9 of 12
2 Mathematics Jaipur
3 Computer Sc Nagpur

(i) SELECT Department, max(salary) FROM Teacher


GROUP BY Department;
(ii) SELECT MAX(Date_of_Join),MIN(Date_of_Join) FROM
Teacher;
(iii) SELECT Name, Salary, [Link], Place FROM
Teacher T, Placement P WHERE [Link] =
[Link] AND [Link]='History';
(iv) SELECT Name, Place FROM Teacher natural join
Placement where Gender='F';
OR
To display the Cartesian Product of these two tables
35 4
(b) Write a function adds a new column in the table Student, updates
the data into it and displays the content of the table.
Student table details are as follows:
Rollno – integer
Name – string
Marks – integer

Note the following to establish connectivity between Python and MYSQL:


• Username is root
• Password is sys
• The table exists in a MYSQL database named school.
Write the following Python function to perform the specified operation:
InsertAndShow(): To input details of student and store it in the table
STUDENT. The function should then retrieve and display all records from
the STUDENT table where the Marks is greater than 75.
Ques. PART E Marks
No.

Page 10 of 12
36 Write a Program in Python that defines and calls the following user 5
defined functions:
• ADD() – To accept and append data of an item to a binary file
‘[Link]’. Each record of the file is a list [Fur_id, Description,
Price, and Discount]. Fur_Id and Description are of str type, Price
is of int type, and Discount is of float type.
• UPDATE() – To change discount as 5000 for furniture item whose
Description is ‘Computer Table’.
• COUNTR() – To count the number of records present in
‘[Link]’ whose price is less than 5000.
37 Total-IT Corporation, a Karnataka based IT training company, is planning 5

to set up training centers in various cities in next 2 years. Their first


campus is coming up in Kodagu district. At Kodagu campus, they are
planning to have 3 different blocks, one for AI, IoT and DS (Data
Sciences) each. 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.

Distance between various blocks/locations:


Block Distance
IT to DS 28 m
IT to IoT 55 m
DS to IoT 32 m

Page 11 of 12
Kodagu Campus to Coimbatore Campus 304 km

Number of computers:
Block Number of Computers
IT 75
DS 50
IoT 80

(i) Suggest the most appropriate block/location to house the


SERVER in the Kodagu campus (out of the 3 blocks) to get the
best and effective connectivity. Justify your answer.
(ii) Suggest the best wired medium and draw the cable layout (Block
to Block) to most efficiently connect various blocks within the
Kodagu Campus.
(iii) Suggest the placement of the following devices with appropriate
reasons: a) Switch/Hub b) Router
(iv) Is there a requirement of a repeater in the given cable layout?
Why/ Why not?
(v) Suggest a protocol that shall be needed to provide Video
Conferencing solution between Kodagu Campus and Coimbatore
Campus.
OR
What type of network (PAN, LAN, MAN, or WAN) will be set up
among the computers connected in the Kodagu campus.

Page 12 of 12
कें द्रीय विद्यालय संगठन, अहमदाबाद संभाग 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.

[Link] 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=[Link]("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) [Link](10,0)
(B) [Link](-10,2)
(C) [Link](-10,1)
(D) [Link](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.
[Link] 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=[Link](i)
if j%2==0:
[Link](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=[Link]()
Y=[Link](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
[Link] SECTION-C(3x3=9 Marks) MARKS
29 Write a method SHOWLINES() in Python to read lines from text file (3)
‘[Link]’ 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 “[Link]” 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)
[Link] 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 ‘[Link]’.
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
‘[Link]’.
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.
[Link] SECTION-E(2x5=10 Marks) MARKS
36 A binary file “[Link]” has structure [BookNo, Book_Name, Author, Price] (5)
i. Write a user defined function CreateFile() to input data for a record and add
to [Link] .
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 “[Link]”
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
KENDRIYA VIDYALAYA SANGATHAN: BHUBANESWAR REGION
FIRST PRE-BOARD EXAMINATION 2024-25
CLASS XII - COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 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.

SECTION-A (21 x1=21M)


1 State True or False: 1
A string can be surrounded by three sets of single quotation marks or by three sets of double
quotation marks.
2 If following will be executed then what will be the output- 1
s="Kendriya Vidyalaya Sangathan"
L=[Link]()
S1=L[0].upper() + ‘-‘+L[1].lower()+ ‘@’+L[2].capitalize()
a) KENDRIYA-vidyalaya@Sangathan
b) KENDRIYA-VIDYALAYA@SANGATHAN
c) Kendriya-Vidyalaya@Sangathan
d) KENDRIYA-vidyalaya@sangathan
3 What will be the output of the following expression if the value of a=0, b=1 and c=2? 1
print(a and b or not c )
(a) True (b) False (c) 1 (d) 0
4 Consider the statements given below and then find the correct output . 1
pride="Malayalam@3"
print(pride[-2:2:-2])
5 What will be the output of the following Python code? 1
T1=(1,2,[1,2],3)
T1[2][1]=3.5
print(T1)
(a) (1,2,[3.5,2],3) (b) (1,2,[1,3.5],3) (c) (1,2,[1,2],3.5) (d) Error Message
6 What will be the output of the following Python statements? 1
D={‘BHUSHAN’:90, ‘SAKSHI’:96,’RANJIT’:85}
print(‘RANJIT’ in D, 96 in D, sep=’@’)
a. True@True
b. False@True
c. True@False
d. False@False
7 What will be the output of the following code? 1
s = [3,0,[2,1,2,3],1]
print(s[s[len(s[2])-2][1]])
a.0 b. 1 c. [2,1,2,3] d. 2
8 Which of the following statement(s) will raise an exception? 1
Sales = {"Printer":25000,"Mouse":750 } # Statement 1
print (Sales[750]) # Statement 2
Sales ["Printer"]=12500 # Statement 3
print ([Link]()) # Statement 4
print (Sales) # Statement 5
(a) Statement 2
(b) Statement 3
(c) Statement 4
(d) Statements 2 and 4
9 State whether the following statement is True or False: 1
An exception may be raised even if the program is syntactically correct.
10 Which of the following will delete key-value pair for key = “Red” from a dictionary COLOR? 1
a. delete COLOR("Red") b. del COLOR["Red"]
c. [Link]["Red"] d. [Link]["Red"]
11 tell() is a method of: 1
(a) pickle module (b) csv module (c) file object (d) seek( )
12 def func(S): 1
m= ‘ ‘
for i in range(0,len(S)):
if S[i].isalpha( ):
m=m+S[i].upper( )
elif S[i].isdigit( ):
m=m+’0’
else:
m=m+”#”
print(m)
func(“Python 3.9”)
(i) python0#0#
(ii) Python0#0#
(iii) PYTHON#0#0
(iv) PYTHON0#0#
13 The structure of the table/relation can be displayed using __________ command. 1
(a) view (b) describe (c) show (d) select
14 Fill in the blank: 1
Number of records/ tuples/ rows in a relation or table of a database is referred to as ________
(a) Domain (b) Degree (c) Cardinality (d) Integrity
15 Choose correct SQL query which is expected to delete all rows of a table emp without deleting its 1
structure.
a)DELETE TABLE;
b)DROP TABLE emp;
c)REMOVE TABL emp;
d)DELETE FROM emp;
16 Which command is used to change table structure in SQL? 1
17 Shanu wants to transfer pictures from her mobile phone to her laptop. She uses Bluetooth 1
Technology to connect two devices. Which type of network will be formed in this case?
a. PAN b. LAN c. MAN d. WAN
18 What out of the following, will you use to have an audio-visual chat with an expert sitting in a far- 1
away place to fix-up a technical issue?
(a) VoIP (b) email (c) FTP (d) SMTP
19 Which devices modulates digital signals into analog signals that can be sent over traditional 1
telephone lines?
No. 20 and 21 are ASSERTION ( A ) and REASONING ( 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 correct explanation for A.
c. A is true but R is false.
d. A is false but R is true.
20 Assertion(A):Key word arguments are related to the function calls 1
Reason(R): When you use keyword arguments in a function call, the caller identifies the
arguments by the parameter name
21 Assertion (A): A foreign key in the relational data model is a set of attributes in one 1
relation that references the primary key of another relation.
Reason (R): Foreign keys are used to establish relationships between tables.

SECTION-B (7 x 2 =14M)

22 Rewrite the following code in python after removing all syntax errors. Underline each 2
correction done in the code:
Def Calc(a):
for i in (0,a):
if i%2 =0:
s=s+1
else if i%5= =0
m=m+2
else:
n=n+i
print(s,m,n) Calc(15)
23 Give two examples of each of the following: 2
(I) keywords (II) Mutable Datatypes
24 Write a suitable Python statement for each of the following tasks using built-in 2
functions/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
a)To insert an element 100 at the Second position, in the list L 1
b) To sort the elements of list L1 in ascending order.
25 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 BEG and END.
import random
heights=[10,20,30,40,50]
beg=[Link](0,2)
end=[Link](2,4)
for x in range(beg,end):
print(heights [x],end=’@’)
(a) 30 @
(b) 10@20@30@40@50@
(c) 20@30
(d) 40@30@
26 Explain the Relational Database Management System terminologies- Degree and Attribute of 2
a relation. Give example to support your answer
OR
Explain the use of ‘Foreign Key’ in a Relational [Link] an example to support your
answer.
27 Give difference between DROP and DELETE command in SQL 2
OR
Name the aggregate functions which work only with numeric data, and those that work with
any type of data.
28 Differentiate between Star Topology and Bus Topology. Write two points of difference. 2
OR
(i) Expand the following terms:
POP3 , URL
(ii) Give one difference between XML and HTML.
SECTION-C (3 x 3 = 9 M)

29 Write a user defined function in python that displays the number of lines starting with word 'It' 3
in the file [Link]
OR
write a user defined function Transfer() that copies a text file "[Link]" onto “[Link]"
barring the lines starting with # sign.
30 A list named as Record contains following format of for students: [student_name, class, city]. 3
Write the following user defined functions to perform given operations on the stack named
‘Record’:
(i) Push_record(Record) – To pass the list Record = [ ['Rahul', 12,'Delhi'],
[‘Kohli',11,'Mumbai'], ['Rohit',12,'Delhi'] ] and then Push an object containing Student name,
Class and City of student belongs to ‘Delhi’ to the stack Record and display and return the
contents of stack
(ii) Pop_record(Record) – To pass following Record [[“Rohit”,”12”,”Delhi”] [“Rahul”, 12,”Delhi”]
] and then to Pop all the objects from the stack and at last display “Stack Empty” when there
is no student record in the stack. Thus the output should be: -
[“Rohit”,”12”,”Delhi”]
[“Rahul”, 12,”Delhi”]
Stack Empty
OR
Mr. Rakesh has created a list of elements. Help him to write a program in python with
functions, PushElement(element) and PopElement(element) to add a new element and
delete an element from a List of element Description, considering them to act as push and
pop operations of the Stack data structure . Push the element into the stack only when the
element is divisible by 7.
For eg:if LIST=[1,9,12,48,56,63]
then stack content will be 63 56
31 Ridhi is working in a mobile shop and assigned a task to create a table MOBILES with record 3
of mobiles as Mobile code, Model, Company, Price and Date of Launch. After creation of the
table, she has entered data of 5 mobiles in the MOBILES table.
MOBILES

MCODE MODEL COMPANY PRICE DATE_OF_LAUNCH


M01 9PRO REALME 17000 2021-01-01
M02 NOTE11 MI 21000 2021-10-12
M03 10S MI 14000 2022-02-05
M04 NARZO50 REALME 13000 2020-05-01
M05 iPHONE12 APPLE 70000 2021-07-01
Based on the data given above answer the following questions:
(i) Identify the most appropriate column, which can be considered as Primary key.
(ii) Write the degree and cardinality of the above table, after removing one column
and two more record added to the table.
(iii) Add a new column GST with data type integer to the table.
OR
i) Insert the value of GST in the new column as 18% of PRICE
ii) To insert a new record of mobile as MobileCode – M06, Company Apple, Model-
iPHONE13, Price-110000 and Date of launch – ‘2022-03-01’.
iii) To delete the record of mobile with model as NARZO50.

SECTION-D (4 x 4 = 16 M)

32 i. When is TypeError exception raised in Python?


ii. Give an example code to handle TypeError ? The code should display the message "
Invalid input. Please Input a valid number " in case of TypeError exception, and the
message "Some error occurred" in case of any other exception.
OR
[Link] is the use of a raise statement ?
[Link] a code to accept two numbers and display the quotient. Appropriate exception should
be raised if the user enters the second number (denominator) as zero (0).
33 A CSV file ‘[Link]’ consists of a list with field elements as Eid, Ename, Salary and 4
City to store employee id , employee name, employee salary and city. Write a Program in
Python that defines and calls the following user defined functions:
SEARCH()- To display the records of the employees whose salary is more than 25000.
COUNTROW() – To count the number of records present in the CSV file named
‘[Link]’.
34 Consider the following tables and answer the questions a and b: 4
Table: Garment
GCode GName Rate Qty CCode

G101 Saree 1250 100 C03


G102 Lehanga 2000 100 C02
G103 Plazzo 750 105 C02
G104 Suit 2000 200 C01
G105 Patiala 1850 105 C01

Table: Cloth
CCode CName
C01 Polyester
C02 Cotton
C03 Silk
C04 CottonPolyester
Write SQL queries for the following:
i. Display unique quantities of garments.
ii. Display sum of quantities for each CCODE whose numbers of records are more than 1.
iii. Display GNAME, CNAME, RATE whose garments name starts with S.
iv. Display average rate of garment whose rate ranges from 1200 to 2000 (both values
included)
35 A table named `EMPLOYEES` is created in a database named `COMPANY`. The table
contains multiple columns whose details are as shown below:
- `EmpID` (Employee ID) - integer
- `EmpName` (Employee Name) - string
- `Salary` (Employee Salary) - float
- `Department` (Employee Department) - string
Note the following to establish connectivity between Python and MySQL:
- Username: root
- Password: school123
- Host: localhost
Write the following Python function to perform the specified operation: ChecknDisplay():
To input details of an employee and store it in the table EMPLOYEES. The function should
then retrieve and display all records display details of all such employees from the table
EMPLOYEES whose salary is more than 50000.

SECTION-E (2 x 5 = 10 M)

36 Shivam Sen is a programmer in school , He needs to manage the records of various 5


students. For this he wants the following information of each student to be stored:
i. Mention any two difference between binary and csv files ?
ii. AddStudents() is a function to input the data of a students and append it in the file
[Link] containing student information – roll number, name and marks (out of 100)
of each student.
[Link]() is a function Write a function to read the data from the file to display the
name and percentage of those students who have a percentage greater than 75. In case
there is no student having percentage > 75, the function displays an appropriate message.
37 Anant National University is setting up its academic blocks at Ahmedabad and is planning to 5
set up a network. The University has 3 academic blocks and one Human Resource Center
as shown in the diagram below: Study the following structure and answer questions (a) to (e)

Technology Block Business Block

HR Center Law Block

Center to Center distances between various blocks/center is as follows:


Law Block to business Block - 40m
Law block to Technology Block - 80m
Law Block to HR center - 105m
Business Block to technology Block - 30m
Business Block to HR Center - 35m
Technology block to HR center - 15m

Number of computers in each of the blocks/Center is as follows:


BLOCK [Link] COMPUTERS
Law Block 15
Technology Block 40
HR center 115
Business Block 25

a) Suggest the most suitable place (i.e., Block/Center) to install the server of this University
with a suitable reason.
b) Suggest an ideal layout for connecting these blocks/centers for a wired connectivity.
c) Which device will you suggest to be placed/installed in each of these blocks/centers to
efficiently connect all the computers within these blocks/centers?
d) Suggest the placement of a Repeater in the network with justification.
e) The university is planning to connect its admission office in Delhi, which is more than
1250km from university. Which type of network out of LAN, MAN, or WAN will be formed?
Justify your answer.
KENDRIYA VIDYALAYA SANGATHAN CHANDIGARH REGION
PRE-BOARD 1 - EXAMINATION - 2024-25
CLASS XII
COMPUTER SCIENCE (Code: 083)

Time allowed: 3 Hours Maximum Marks: 70


General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in
somequestions. 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 (21 x 1 = 21 Marks) Marks

1. State True or False:


“A variable name can start with an underscore character.” (1)

2. Identify the output of the following code snippet:


text = "HELLOWORLD"
text=[Link]('HE','@')
print(text)
(A) @LLOWORLD (1)
(B) @LLOWORLD@
(C) HE@
(D) HE@LLOWORLD

3. Which of the following expressions evaluates to True?


(A) not(False) and False
(B) not(True) or False (1)
(C) not(False and True)
(D) not(True) and not(False)

4. What is the output of the expression?


country='National'
print([Link]("a"))
(A) ['N', 'tion', 'l'] (1)
(B) ('N', 'tion', 'l')
(C) ['Na', 'tiona', 'l']
(D) Error

Page: 1/11
5. What will be the output of the following code snippet?
message= "Good Morning" (1)
print(message[2::2])

6. What will be the output of the following code?


tuple1 = (1, 2, 3)
tuple2 = tuple1
tuple1 += (4,)
print(tuple1 == tuple2) (1)
(A) True
(B) False
(C) tuple1
(D) Error

7. If dict is a dictionary as defined below, then which of the following


statements will raise an exception?
dict = {'name': ‘kiran’, 'age': 20, 'sal': 30000}
(A) print(dict['name', 'age']) (1)
(B) [Link]('name')
(C) dict['age']=21
(D) print(str(dict))

8. Which of the following will delete key-value pair for key = “Name” from a dictionary
D1?
(A) delete D1("Name")
(1)
(B) del D1["Name"]
(C) del.D1["Name"]
(D) [Link]["Name"]
9. If a table which has two Primary key and five candidate keys. How
many alternate keys will this table have?
(A) 1
(1)
(B) 2
(C) 3
(D) 4

10. Write the missing statement to complete the following code:


file = open("[Link]", "r")
data = [Link](100)
#Move the file pointer to the (1)
beginning of the file
next_data = [Link](50)
[Link]()

11. State whether the following statement is True or False:


The finally block in Python is executed only if no exception occurs
in the try block. (1)

Page: 2/11
12. What will be the output of the following code?
g = 20
def add():
global g
g = g + 5
print(g,end='#')
add() (1)
g=45
print(g,end='%')

(A) 25#45%
(B) 5#20%
(C) 25#25%
(D) 50%20#
13. Which SQL command can remove a column from an existing relation? (1)

14. What will be the output of the query?


SELECT * FROM student WHERE name LIKE'%Singh%';
(A) Details of all students whose names start with 'Singh'
(B) Details of all students whose names end with ' Singh ' (1)
(C) Details of all students whose name contains ' Singh '
(D) Details of all students whose names is ' Singh'

15. In which datatype the value stored is padded with spaces to fit the specified
length.
(A) DATE
(1)
(B) VARCHAR
(C) FLOAT
(D) CHAR

16. Which of the following is not an aggregate function?


(A) total()
(B) count() (1)
(C) avg()
(D) max()

17. Which protocol is used in videoconferencing?


(A) HTTP
(B) FTP
(C) VoIP
(D) HTTPS (1)

18. Which network device is used to convert analog signal to digital signal
and vice versa?
(A) Modem
(B) Gateway (1)
(C) Switch
(D) Repeater
Page: 3/11
19. In case of _____________ switching, before a communication starts, a
dedicated path is identified between the sender and the receiver (1)

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): Positional arguments in Python functions must be passed in


the exact order in which they are defined in the function
signature. (1)
Reasoning (R): This is because Python functions automatically assign
default values to positional arguments.

21. Assertion (A): DROP command in SQL is DDL command.

(1)
Reasoning (R): DROP and DELETE are used to delete rows and
columns, therefore, these can be used interchangeably.
Q No Section-B ( 7 x 2=14 Marks) Marks

22. How is a list object different from tuple object in Python?


(2)
Identify list object and tuple object from the following:
(1,2), [1,2], {1:1,2:2}, ‘123’

23. Give two examples of each of the following:


(2)

(I) Identity operators (II) Membership operators

24. If L1=[10,20,30] and L2=[100,200,300], then


(Answer using builtin functions only)
(I)
A) Write a statement to concatenate list L1 and L2. (2)
OR
B) Write a statement to reverse the order of the list L1.

(II)
A) Write a statement to insert all the elements of L2 at the end of L1.
OR
Write a statement to remove all the elements from list L2.

Page: 4/11
25. Identify the correct output(s) of the following code. Also write the minimum
and the maximum possible values of the variable b.
import random
a="Chandigarh"
b=[Link](1,6) (2)
for i in range(0,b):
print(a[i],end='#')
(A) C# (B) C#h#a#n#

(C) C#h#a# (D) C#h#a#n#d#i#g#a#

The code given below accepts a number as an argument and returns the
26. reverse number. Observe the following code carefully and rewrite it after
removing all syntax and logical errors. Underline all the corrections made..

(2)

27. (I)
A) What constraint should be applied on a table column to
ensure that the values in a column satisfy a specific condition.
OR
B) What constraint should be applied on a table column that is a
combination of NOT NULL and UNIQUE. (2)

(II)
A) Write an SQL command to remove the Primary Key constraint
from a table, named STUDENT. S_ID is the primary key of the
table.
OR
Write an SQL command to make the column S_ID the PrimaryKey of an
already existing table, named STUDENT.

Page: 5/11
28. A) List one advantage and one disadvantage of ring topology.
OR (2)
B) Expand the term HTTPS. What is the use of HTTPS?

Q No. Section-C ( 3 x 3 = 9 Marks) Marks

29. A) Write a Python function that displays all the words containing @gmail
from a text file "[Link]".
(3)
OR
B) Write a Python function that finds and displays all the words having 5
characters from a text file "[Link]".

30. A) You have a stack named Books that contains records of books. Each
book record is represented as a list containing book_title,
author_name, and publication_year.
Write the following user-defined functions in Python to perform the
specified operations on the stack Books:
(I) push_book(Books, new_book): This function takes the stack
BooksStack and a new book record new_book as arguments and
pushes the new book record onto the stack.
(II) pop_book(Books): This function pops the topmost book record from
(3)
the stack and returns it. If the stack is already empty, the function
should display "Underflow".
(III) peep(Books): This function displays the topmost element of the
stack without deleting it. If the stack is empty, the function should
display 'None'.

OR
(B) 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

Page: 6/11
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

(3)
31 Predict the output of the following code:

OR
Predict the output of the following code:
line=[14,18,12,16]
for I in line:
for j in range(1,I%5):
print(j,"@",end="")
print()

Page: 7/11
Q No. Section-D ( 4 x 4 = 16 Marks) Marks

32.

(4)

Write SQL queries for the following:


(i) Display total UPrice from the table PRODUCT for each BID.
(ii) Display the structure of the table PRODUCT.
(iii) Display the average rating of all products.
(iv) Display the name, price, and rating of products in descending order of
rating.

OR

Write the outputs of the SQL queries (i) to (iv) based on the relation 4
BOOK given below:

TABLE : BOOK
BNO BNAME TYPE
F101 THE PRIEST FICTION
L102 GERMAN EASY LITERATURE
C101 TARZAN IN THE LOST WORLD COMIC
F102 UNTOLD STORY FICTION
C102 WAR HEROES COMIC

a. SELECT COUNT(DISTINCT TYPE) FROM BOOK;


b. SELECT TYPE,COUNT(*) FROM BOOK GROUP BY
TYPE ;
c. SELECT BNAME FROM BOOK WHERE TYPE NOT
IN ("FICTION", "COMIC");
d. SELECT * FROM BOOK WHERE BNAME LIKE
“%LOST%”.

Page: 8/11
33. A csv file "[Link]" contains the data of a survey. Each record of thefile
contains the following data:
● Name of a country
● Population of the country
● Sample Size (Number of persons who participated in the survey in
that country)
● working (Number of persons who are working)
(4)
For example, a sample record of the file may be:
[‘Ireland’, 5673000, 5000, 3426]
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 for which the population is more than 5000000.
(II) Count the number of records in the file.

34. Shekhar has been entrusted with the management of Law University
Database. He needs to access some information from FACULTY and
COURSES tables for a survey analysis. Help him extract the following
information by writing the desired SQL queries as mentioned below.

Table: FACULTY
F_ID FName LName Hire_Date Salary
102 Amit Mishra 12-10-1998 12000
(4)
103 Nitin Vyas 24-12-1994 8000
104 Rakshit Soni 18-5-2001 14000
105 Rashmi Malhotra 11-9-2004 11000
106 Sulekha Srivastava 5-6-2006 10000

Table: COURSES
C_ID F_ID CName Fees
C21 102 Grid Computing 40000
C22 106 System Design 16000
C23 104 Computer 8000
Security
C24 106 Human Biology 15000
C25 102 Computer 20000
Network
C26 105 Visual Basic 6000

Page: 9/11
35. A table, named EDUCATION, in SUPPLY database, has the following
structure
Field Type
itemNo int(11)
itemName varchar(15)
price float
qty int(11)

Write the following Python function to perform the specified operation: (4)
AddAndDisplay(): To input details of an item and store it in the table
EDUCATION. The function should then retrieve and display all records
from the EDUCATION table where the Price is greater than 150.

Assume the following for Python-Database connectivity:


Host: localhost, User: root, Password: Pencil

[Link]. SECTION E (2 X 5 = 10 Marks) Marks

36. Raman is an HR working in a recruitment agency. He needs to managethe


records of various candidates. For this, he wants the following information
of each candidate to be stored:
- Candidate_ID – integer
- Candidate_Name – string
- Designation – string
- Experience – float (5)

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.

Page: 10/11
(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. STAR Enterprises is an event planning organization. It is planning to set up


its India campus in Mumbai with its head office in Delhi. The Mumbai
campus will have four blocks/buildings - ADMIN, FOOD, MEDIA,
DECORATORS. You, as a network expert, need to suggest the best
network-related solutions for them to resolve the issues/problems
mentioned in points (I) to (V), keeping in mind the distances between
various blocks/buildings and other given parameters.

Block to Block distances (in Mtrs.)


From To Distance
ADMIN FOOD 42 m (5)
ADMIN MEDIA 96 m
ADMIN DECORATORS 48 m
FOOD MEDIA 58 m
FOOD DECORATORS 46 m
MEDIA DECORATORS 42 m
Distance of Delhi Head Office from Mumbai Campus = 1500 km
Number of computers in each of the blocks/Center is as follows:

ADMIN 30
FOOD 18
MEDIA 25
DECORATORS 20
DELHI HEAD
OFFICE 18

Page: 11/11
(I) Suggest the most appropriate location of the server inside the
MUMBAI campus. Justify your choice.
(II) Where hub/switch should be placed? Justify your answer.
(III) Draw the cable layout to efficiently connect various buildings
within the MUMBAI campus. Which cable would you suggest for
the most efficient data transfer over the network?
(IV) Is there a requirement of a repeater in the given cable layout?
Why/ Why not?
(V) A) What would be your recommendation for enabling live visual
communication between the Admin Office at the Mumbai campus
and the DELHI Head Office from the following options:
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN, or WAN) will be set up
among the computers connected in the MUMBAI campus?

Page: 12/11
KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION
CLASS: XII SESSION: 2024-25
PREBOARD
COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 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 (21 x 1 = 21 Marks) Marks


1 State True or False 1
In Python, a dictionary is an ordered collection of items(key:value pairs).
2 State the output of the following 1
L1=[1,2,3] i) [1,3,7]
L2=L1
ii) [2,3,7]
[Link](7)
[Link](2,14) iii) [1,14,3,7]
[Link](1) iv) [2,14,3,7]
print(L1)
3 The following expression will evaluate to 1
print(2+(3%5)**1**2/5+2)
i) 5 ii) 4.6 iii) 5.8 iv) 4

4 What is the output of the expression? 1


Food=’Chinese Continental’
print([Link](‘n’))
i) ('', 'hinese ', 'ontinental')
ii) ['', 'hinese ', 'ontinental']
iii) ('hinese ', 'ontinental')
iv) ['hinese ', 'ontinental']
5 What will be output of the following code snippet? 1
Msg=’Wings of Fire!’
print (Msg[-9: :2])
6 What will be the output of the following: 1
T1=(10)
print(T1*10)
i) 10 ii) 100 iii)(10,10) iv(10,)
7 If farm is a t as defined below, then which of the following will cause an exception? 1
farm={‘goat’:5,’sheep’:35,’hen’=10,’pig=’7’}
i) print(str(farm))
ii) print(farm[‘sheep’,’hen’])
iii) print([Link](‘goat))
iv) farm[‘pig’]=17
8 What does the replace(‘e’,’h’) method of string does? 1
i) Replaces the first occurrence of ‘e’ to ‘h’
ii) Replaces the first occurrence of ‘h’ to ‘e’
iii) Replace all occurrences of ‘e’ to ‘h’
iv) Replaces all occurrences of ‘h’ to ‘e’
9 If a table has 1 primary key and 3 candidate key, how many alternate keys will be in 1
the table.
i) 4 ii) 3 iii)2 iv)1
10 Write the missing statement to complete the following code 1
file = open("[Link]")
t1 = [Link](10)
_________________________#Move the file pointer to the beginning of the file
t2= [Link](50)
print(t1+t2)
[Link]()
11 Which of the following keyword is used to pass the control to the except block in 1
Exceptional handling?
i) pass ii) finally iii) raise iv)throw
12 What will be the output of the following code: 1
sal = 5000
def inc_sal(per):
global sal i) 5000%6000$
inc = sal * (per / 100) ii) 5500.0%6000$
sal += inc iii) 5000.0$6000%
inc_sal(10) iv) 5500%5500$
print(sal,end='%')
sal=6000
print(sal,end='$')
13 State the sql command used to add a column to an existing table? 1
14 What will be the output of the following query? 1
Mysql> SELECT * FROM CUSTOMER WHERE CODE LIKE ‘_A%’
A) Customer details whose code’s middle letter is A
B) Customers name whose code’s middle letter is A
C) Customers details whose code’s second letter is A
D) Customers name whose code’s second letter is A
15 Sushma created a table named Person with name as char(20) and address as 1
varchar(40). She inserted a record with “Adithya Varman” and address as “Vaanam
Illam, Anna Nagar IV Street”. State how much bytes would have been saved for this
record.
i)(20,34) ii)(30,40) iii)(14,40) iv)14,34)
16 _____ gives the number of values present in an attribute of a relation. 1
a)count(distinct col) b)sum(col) c)count(col) d)sum(distinct col)
17 The protocol used identify the corresponding url from ip address is _____ 1
a)IP b)HTTP c)TCP d)FTP
18 The device used to convert analog signal to digital signal and vice versa is .. 1
a)Amplifier b)Router c)Modem d)Switch
19 In ___________ switching technique, data is divided into chunks of packets and 1
travels through different paths and finally reach the destination.
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) : A function can have multiple return statements 1
Reason (R) : Only one return gets executed Values are returned as a tuple.
21 Assertion (A) : Truncate is a DML command 1
Reason(R ) : It is used to remove all the content of a database object

Q No. Section-B ( 7 x 2=14 Marks) Marks


22 Differentiate list and tuple with respect to mutability. Give suitable example to 2
illustrate the same .
23 Give two examples of each of the following 2
a) Assignment operators b) Logical operators
24 If L1 = [13,25,41,25,63,25,18,78] and L2= [58,56,25,74,56] 2
(i) A) Write a statement to remove fourth element from L1
Or
B) Write the statement to find maximum element in L2

(ii) (A) write a statement to insert L2 as the last element of L1


OR
(B) Write a statement to insert 15 as second element in L2
25 Identify the correct output(s) of the following code. Also write the minimum and the 2
maximum possible values of the variable Lot

import random
word='Inspiration'
Lot=2*[Link](2,4)
for i in range(Lot,len(word),3):
print(word[i],end='$')

i) i$a$i$n$ ii) i$n$


iii) i$t$n$ iv) a$i$n$

26 Identify Primary Key and Candidate Key present if any in the below table name 2
Colleges. Justify
Streng
Cid Name Location Year AffiUniv PhoneNumber
th
University
St. Xavier's
1 Mumbai 1869 10000 of 022-12345678
College
Mumbai
Loyola University
2 Chennai 1925 5000 044-87654321
College of Madras
Hansraj Delhi
3 New Delhi 1948 4000 011-23456789
College University
Christ Christ
4 Bengaluru 1969 8000 080-98765432
University University
Lady Shri
Delhi
5 Ram New Delhi 1956 2500 011-34567890
University
College
27 (I) 2
(A) What constraint/s should be applied to the column in a table to make it as
alternate key?
OR
(B) What constraint should be applied on a column of a table so that it becomes
compulsory to insert the value
(II)
(A) Write an SQL command to assign F_id as primary key in the table named flight
OR
(B)Write an SQL command to remove the column remarks from the table name
customer.
28 List one advantage and disadvantage of star and bus topology 2
OR
Define DNS and state the use of Internet Protocol.

Q No. Section-C ( 3 x 3 = 9 Marks) Marks


29 (A) Write a function that counts no of words beginning with a capital letter from 3
the text file [Link]
Example:
If you want to Walk Fast,
Walk Alone.
But - if u want to Walk Far,
Walk Together
Output:
No of words starting with capital letter : 10

OR
(B) Write a function that displays the line number along with no of words in it
from the file [Link]
Example :
None can destroy iron, but its own rust can!
Likewise, none can destroy a person, but their own mindset can
The only way to win is not be afraid of losing.
Output:
Line Number No of words
Line 1: 9
Line 2: 11
Line 3: 11
30 (A) There is a stack named Uniform that contains records of uniforms Each record 3
is represented as a list containing uid, uame, ucolour, usize, uprice.
Write the following user-defined functions in python to perform the specified
operations on the stack Uniform :
(I) Push_Uniform(new_uniform):adds the new uniform record onto the stack
(II) Pop_Uniform(): pops the topmost record from the stack and returns it. If
the stack is already empty, the function should display “underflow”.
(III) Peep(): This function diplay the topmost element of the stack without
deleting [Link] the stack is empty,the function should display ‘None’.
OR
(a) Write the definition of a user defined function push_words(N) which accept
list of words as parameter and pushes words starting with A into the stack
named InspireA
(b) Write the function pop_words(N) to pop topmost word from the stack and
return it. if the stack is empty, the function should display “Empty”.

31 Predict the output of the Python code given below: 3


Con1="SILENCE-HOPE-SUCCEss@25"
Con2=""
i=0
while i<len(Con1):
if Con1[i]>='0' and Con1[i]<='9':
Num=int(Con1[i])
Num-=1
Con2=Con2+str(Num)
elif Con1[i]>='A' and Con1[i]<='Z':
Con2=Con2+Con1[i+1]
else:
Con2=Con2+'^'
i+=1
print(Con2)

Q Section-D ( 4 x 4 = 16 Marks) Mar


No. ks
32 Consider the following table named Vehicle and state the query or state the output 4
Table:- Vehicle
VID LicensePlate VType Owner Contact State
Cost
1 MH12AB1234 Car Raj Kumar 65 9876543210 Maharastra
2 DL3CDE5678 Truck Arjith Singh 125 8765432109 New Delhi
3 KA04FG9012 Motor cycle Prem Sharma 9123456789 Karnataka
4 TN07GH3456 SUV Shyad Usman 65 9987654321 Tamil Nadu
5 KA01AB1234 Car Devid jhon 65 9876543210 Karnataka
6 TN02CD5678 Truck Anjali Iyer 125 8765432109 Tamil Nadu
7 AP03EF9012 Motor cycle Priya Reddy 9123456789 Andhra Pradesh
(A)
(i) To display number of different vehicle type from the table vehicle
(ii) To display number of records entered vehicle type wise whose minimum cost is above 80
(iii)To set the cost as 45 for those vehicles whose cost is not mentioned
(iv) To remove all motor cycle from vehicle
OR
(B)
(i) SELECT VTYPE,AVG(COST) FROM VEHICLE GROUP BY VTYPE;
(ii) SELECT OWNER ,VTYPE,CONTACT FROM VEHICLE WHERE OWNER LIKE
“P%”;
(iii)SELECT COUNT(*) FROM VEHICLE WHERE COST IS NULL;
(iv) SELECT MAX(COST) FROM VEHICLE;
33 A CSV file “[Link]” contains data of movie details. Each record of the file contains the 4
following data:
[Link] id
[Link] name
[Link]
[Link]
[Link] date
For example, a sample record of the file may be:
["tt0050083",’ ‘12 Angry Men is’,’Thriller’.’Hindi’,’12/04/1957’]
Write the following functions to perform the specified operations on this file
(i) Read all the data from the file in the form of the list and display all those records for
which language is in Hindi.
(ii) Count the number of records in the file.
34 Salman has been entrusted with the management of Airlines Database. He needs to access some 4
information from Airports and Flights tables for a survey. Help him extract the following
information by writing the desired SQL queries as mentioned below.
Table - Airports
A_ID A_Name City IATACode
1 Indira Gandhi Intl Delhi DEL
2 Chhatrapati Shivaji Intl Mumbai BOM
3 Rajiv Gandhi Intl Hyderabad HYD
4 Kempegowda Intl Bengaluru BLR
5 Chennai Intl Chennai MAA
6 Netaji Subhas Chandra Bose Intl Kolkata CCU
Table - Flights
F_ID A_ID F_No Departure Arrival
1 1 6E 1234 DEL BOM
2 2 AI 5678 BOM DEL
3 3 SG 9101 BLR MAA
4 4 UK 1122 DEL CCU
5 1 AI 101 DEL BOM
6 2 6E 204 BOM HYD
7 1 AI 303 HYD DEL
8 3 SG 404 BLR MAA
i) To display airport name, city, flight id, flight number corresponding flights whose
departure is from delhi
ii) Display the flight details of those flights whose arrival is BOM, MAA or CCU
iii) To delete all flights whose flight number starts with 6E.
iv) (A) To display Cartesian Product of two tables
OR
(B) To display airport name,city and corresponding flight number
35 A table named Event in VRMALL database has the following structure: 4

Field Type
EventID int(9)
EventName varchar(25)
EventDate date
Description varchar(30)
Write the following Python function to perform the specified operations:
Input_Disp(): to input details of an event from the user and store into the table Event. The
function should then display all the records organised in the year 2024.

Assume the following values for Python Database Connectivity


Host-localhost, user-root, password-tiger

Q No. Section-E ( 2 x 5 = 10 Marks) Marks


36 Ms Joshika is the Lab Attendant of the school. She is asked to maintain the project 5
details of the project synopsis submitted by students for upcoming Board Exams.
The information required are:
-prj_id - integer
-prj_name-string
-members-integer
-duration-integer (no of months)
As a programmer of the school u have been asked to do this job for Joshika and define
the following functions.
i) Prj_input() - to input data of a project of student and append to the binary
file named Projects
ii) Prj_update() - to update the project details whose member are more than 3
duration as 3 months.
iii) Prj_solo() - to read the data from the binary file and display the data of all
project synopsis whose member is one.
37 P&O Nedllyod Container Line Limited has its headquarters at London and regional 5
office at Mumbai. At Mumbai office campus they planned to have four blocks for HR,
Accts, Logistics and Admin related work. Each block has number of computers
connected to a network for communication, data and resource sharing
As a network consultant, you have to suggest best network related solutions for the
issues/problems raised in (i) to (v), keeping in mind the given parameters

REGIONAL OFFICE MUMBAI

HR ADMIN
London Head
Head Head
Office
Accts Logistics

Distances between various blocks/locations:


Admin to HR 500m
Accts to Admin 100m
Accts to HR 300m
Logistics to Admin 200m
HR to logistics 450m
Accts to logistics 600m
Number of computers installed at various blocks are as follows:
Block No of computers
ADMIN 95
HR 70
Accts 45
Logistics 28
i) Suggest the most appropriate block to place the sever in Mumbai office.
Justify your answer.
ii) State the best wired medium to efficiently connect various blocks within
the Mumbai Office.
iii) Draw the ideal cable layout (block to block) for connecting these blocks
for wired connectivity.
iv) The company wants to conduct an online meeting with heads of regional
office and headquarter. Which protocol will be used for the effective voice
communication?
v) Suggest the best place to house the following
a) Repeater b) Switch
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=[Link]("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=[Link]('PY','#')
print(text)
3 1
a) #THONPROGRAM
b) ##THON#ROGRAM
c) #THON#ROGRAM
d) #YTHON#ROGRAM
str1=" Programming "
str2=" is My Junoon"
str3=[Link]()+[Link]("J", "j").lstrip()
print([Link]("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([Link](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) [Link](“Virat”)
c) print(dict1([“Dhoni”,”Rohit”])
d) dict1[“Rohit”]=158
What does this statement will do in python
>>>L1=[10,20,30] # Statement 1
>>>[Link](-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=[Link](1,3)
25 2
LAST=[Link](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
[Link](2)
continue
for x in range(2, i):
if i % x == 0:
flag = 1
break
if flag == 0:
[Link](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
[Link], 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
[Link], 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 “[Link]” 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
[Link] 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
PRE-BOARD EXAMINATION (2024-25)
CLASS-XII
COMPUTER SCIENCE(083)
TIME: 03:00 HOURS 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


State True or False
1 „In Python delimiters and operators are the same‟ (1)

Identify the output of the following code snippet-

text = „COMPUTER SCIENCE IS FUN‟


text=[Link]('C')
print(text)
2 (1)
(A) „COMPUTER SCIENCE IS FUN‟
(B) [„OMPUTER S‟, „IEN‟, „E IS FUN‟]
(C) [„COMPUTER‟,‟SCIENCE‟, „IS‟, „FUN‟]
(D) [„‟, „OMPUTER S‟, „IEN‟, „E IS FUN‟]

The ________ statement in SQL deletes all the content of a table.


3 (A) DEL * FROM TABLE (B) DROP TABLE (1)
(C) TRUNCATE TABLE (D) None of the above
What will be the output of the following code snippet?

txt = „I could eat bananas all day‟


x = [Link] („bananas‟)
4 print(x) (1)

(A) „I could eat all day‟ (B) [„I could eat „,‟ all day‟]
(C) („I could eat „, „ all day‟) (D) („I could eat „, „bananas‟, „ all day‟)
What will be the output of the following code?
5 message=‟I Love Python‟ (1)
print(message[-1::-2]
True or False?
6 „The „else‟ block in “try: except: else:” always executes.” (1)
What possible output(s) is expected from the following code?

import random
count=[„ONE‟, ‟TWO‟, ‟THREE‟, „FOUR‟]
for k in range(3):
7 r=[Link](k+1,3) (1)
print(count[r],end=‟#‟)

(A) ONE#TWO#THREE# (B) TWO#THREE#


(C) THREE#FOUR# (D) ONE#TWO#

Which of the following statement is False?

(A) [Link]() removes the last element of a list.


8 (B) [Link](x) removes the element x from a list. (1)
(C) [Link](l2) adds all the elements of list l2 to a list.
(D) [Link]() sorts all the elements of the list.

9 Which SQL command can display the cardinality of a table? (1)


Which of the following statement(s) would give an error after executing
the following code?
emp={„Rajiv‟:102, „Megan‟:123,‟Trevor‟:128} #S1
print(emp[102]) #S2
10 (1)
emp[„John‟]=121 #S3
print([Link]()) #S4
(A) S1 (B) S2 (C) S3 (D) S2 and S4

In SQL, which clause is used to filter the rows returned by a query?


11 (A) WHERE (B) HAVING (C) SELECT (D) GROUP BY (1)

In Python, default arguments are assigned-

12 (A) From left to right (B) From right to left (1)


(C) In alphabetical order (D) Default arguments are not allowed
In Python, what is the use of the “is” keyword?

(A) To check for equality


13 (B) To check if two variables refer to the same object in memory (1)
(C) To define a class
(D) To declare a function
What is the output of the following code snippet?

def add(a, b=10):


14 (1)
return a + b
print(add(5))

(A) 5 (B) 10 (C) 15 (D) Error

What will be the output of the following code?


f = open("[Link]", "w")
[Link]("Welcome")
[Link](0)
[Link]("Hi")
15 [Link]() (1)
f = open("[Link]", "r")
print([Link]())
[Link]()

(A) Hi (B) ComeHi (C) HiCome (D) Hiome

The SQL command ALTER TABLE is used to –

(A) Delete a table


16 (1)
(B) Modify the structure of an existing table
(C) Insert new rows into a table
(D) Drop an index

What is the purpose of the GROUP BY clause in SQL?


(A) To order the result set
17 (1)
(B) To group rows that have the same values in specified columns
(C) To filter rows based on a condition
(D) To delete rows from the table

What does DNS stand for in computer networking?


18 (A) Domain Network System (B) Digital Network Service (1)
(C) Domain Name System (D) Data Name Service

Which of the following is NOT an internet service provider (ISP)?


19 (1)
(A) Airtel (B) Jio (C) Google (D) BSNL

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): The PRIMARY KEY constraint ensures that each value
20 in a column is unique and not null. (1)
Reasoning (R): The PRIMARY KEY constraint allows duplicate values
in the column.

Assertion (A): A star topology is more reliable compared to a bus


21 topology. (1)
Reasoning (R): In star topology, failure of the central hub results in
network failure.

Q No Section-B (7 x 2=14 Marks) Marks

Explain the concept of a 'loop' in programming. How does a 'for loop'


22 (2)
differ from a 'while loop'?

(A) Define and differentiate between URL and domain name with the
help of an appropriate example
23 (2)
OR
(B) Differentiate between Switch and Gateway.

If L1=[1,2,3,5,8,11,12,15, . . . ], and L2=[10,20,30, . . .] are two lists,


then:

24 Write a program to count the odd numbers in L1. (2)


OR
a) Write a statement to sort the elements of list L1 in descending order.
b) Write a statement to insert all the elements of L2 at the end of L1.
(Answer using builtin functions only)

Write an SQL query to retrieve all columns from a table named Students
where the Grade is 'A'.
25 (2)
OR
What is the purpose of the JOIN clause in SQL? Explain with a brief
example.
The following Python code is intended to calculate the sum of all even
numbers in a given list. Identify and correct the errors in the program.
Rewrite the correct program underlining all the corrections.
numbers = [1, 2, 3, 4, 5, 6, 7, 8]
sum even = 0
26 (2)
for num in numbers
if num % 2 = 0:
sum even += num

print "Sum of even numbers:", sum_even


Identify the correct output(s) of the following code. Also write the
minimum and the maximum possible values of the variable b.

import random

# Generate a list of 3 random numbers between 1 and 12


random_numbers = [[Link](1, 12)%8+1 for _ in range(3)]
27 print("Random numbers:", random_numbers) (2)

(A) [1,8,9] (B) [2,7,4]


(C) [0,6,7] (D) [3,1,6]

# Find and print the maximum number in the list


b = max(random_numbers)
print("Maximum number:", b)

Write a user defined function in Python named showGrades (S) which


takes the dictionary Sas an argument. The dictionary, S contains
Name: [Eng, Math, Science] as key:value pairs. The function displays
the corresponding grade obtained by the students according to the
following grading rules-
Average of Eng, Math, Science Grade
>=90 A
<90 but >=60 B
28 <60 C (2)

For example: Consider the following dictionary


S={"AMIT": [92,86,64], "NAGMA": [65,42,43], "DAVID": [92,90,88]}
The output should be:
AMIT - B
NAGMA - C
DAVID – A

Q No Section-C (3 x 3 = 9 Marks) Marks

A dictionary, StudRec, contains the records of students in the following


pattern-
{admno: [m1, m2, m3, m4, m5]}

i.e., Admission No. (admno) as the key and 5 subject marks in the list
29 (3)
as the value.
Each of these records is nested together to form a nested dictionary.

Write the following user-defined functions in the Python code to perform


the specified operations on the stack named BRIGHT.
(i) Push_Bright(StudRec): it takes the nested dictionary as an
argument and pushes a list of dictionary objects or elements
containing data as {admno: total (sum of 5 subject marks)} into
the stack named BRIGHT of those students with a total mark
>350.
(ii) Pop_Bright(): It pops the dictionary objects from the stack and
displays them. Also, the function should display “Stack is Empty”
when there are no elements in the stack.
For Example: if the nested dictionary StudRec contains the following
data:
StudRec={101:[80,90,80,70,90],102:[50,60,45,50,40],103:[90,90,99,98,90]}

Then Stack BRIGHT Should contain: [{101: 410}, {103: 467}]


The Output Should be:
{103: 467}
{101: 410}
If the stack BRIGHT is empty then display: Stack is Empty

Write a Python function that displays all the lines containing the word
“excellent” from a text file “[Link]”
30 OR (3)
Write a Python function that find and displays all the words beginning
with „w‟ or „W‟ from a text file “[Link]”.

Predict the output of the Python code given below-

def fun_para(x=5,y=10,z=1005):
z=x/2
res=y//x+z
31 return res (3)
a,b,c=20,10,1509
print(fun_para(),fun_para(b),sep='#')
res=fun_para(10,20,6015)
print(res, "@")
print(fun_para(z=999,y=b,x=5), end="#@")
Q No Section-D (4 x 4 = 16 Marks) Marks
Consider the following table FACULTY.

32 (4)
A) Write the following queries:

(i) To display the Salary of each Faculty, excluding those with salary
less than 12000.
(ii) To display all of the records sorted by Hire_date in descending
order.
(iii) To display all the Fname from the table without repetition.
(iv) Write a query to increase the salary of all the employees by 10%.

OR
B) Write the output of:
(i) Select * from FACULTY where salary > 12000;
(ii) Select Fname from FACULTY WHERE Hire_date between 01-01-
2000 and 31-12-2006;
(iii) Select AVG(SALARY) from FACULTY;
(iv) Select * from FACULTY where Fname like “R%”;

A csv file “[Link]” contains the details of Employees like:


 EmpID
 EmpName
 Desig
 Dept
33 Write the following Python functions to perform the specified operations (4)
on this file:

i) Write the header row and records of five employees into the file.
ii) Appends a new record in the CSV file.

Consider the tables PRODUCT and BRAND given below:

34 (4)
Write SQL queries for the following-
(i) Display product name and brand name from the tables PRODUCT
and BRAND.
(ii) Display the structure of the table PRODUCT.
(iii) Display the average rating of Medimix and Dove brands
(iv) Display the name, price, and rating of products in descending
order of rating.
Kabir wants to write a program in Python to insert the following record in
the table named „Student‟ in MYSQL database, „SCHOOL‟ -
 rno(Roll number )- integer
 name(Name) - string
 DOB (Date of birth) – Date
 Fee – float
35 Note the following to establish connectivity between Python and MySQL: (4)
 Username - root
 Password - tiger
 Host - localhost
The values of fields rno, name, DOB and fee has to be accepted from
the user. Help Kabir to write the program in Python.
Q No Section-E ( 5 x 2 = 10 Marks) Marks
Manoj is working in a sports college. He needs to manage the records of
the teams in each Sport. For this, he wants the following information of
the students to be stored in the binary file [Link]-
 SportName
 TeamName
 No_Players
You, as a programmer of the company, have been assigned to do this
36 job for the college. (5)
i) Create the binary file [Link]
ii) Write a function AddTeam to input the details and add a record to
the file.
iii) Write a function, copyData(), that reads contents from the file
[Link] and copies the records with Sport name as “Basket
Ball” to the file named [Link]. The function should also
return the total number of records copied to the file [Link].
MyPace University is setting up its academic blocks at Naya Raipur and
is planning to set up a network. The University has 3 academic blocks
and one Human Resource Centre as shown in the diagram below.

37 (5)
Distances between various blocks/centre are as follows-

Law Block to business Block 40m


Law block to Technology Block 80m
Law Block to HR Center 105m
Business Block to technology Block 30m
Business Block to HR Center 35m
Technology block to HR Center 15m

Number of computers in each of the blocks/Center is as follows-

Law Block 15
Technology Block 40
HR Center 115
Business Block 25

a) Suggest the most suitable place (i.e., Block/Center) to install the


server of this University with a suitable reason.
b) Suggest an ideal wired layout for connecting these blocks/centers.
c) Which device will you suggest to be placed/installed in each of
these blocks/centers to efficiently connect all the computers within
these blocks/centers?
d) Suggest the placement of a repeater in the network with
justification.
e) The university is planning to connect its admission office in Delhi,
which is more than 1250 km from university. Which type of network
out of LAN, MAN, or WAN will be formed? Justify your answer.

*** ALL THE BEST ***


Pre-Board Exam (2024-25)
Class –XII Set- 3
Time :3 hours Subject – CS (083) MM-70
Instructions:
1. This question paper contains 37 questions.
2. This Question Paper is divided into 5 sections from A to E
3. Section A has 21 questions carrying 01 mark each.
4. Section B has 07 questions carrying 02 marks each.
5. Section C has 03 questions carrying 03 marks each.
6. Section D has 04 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. Please Give the
correct answer

SECTION - A
1. State True or False 1
“Divide by zero is an exception or runtime error”.
2. Find the output of the following code- 1
msg=“ this is wonderful”
L=[Link](‘is’)
print(L)
a. 1 b. 2 c. 3 d. 4
3. Consider the given expression: 1
not True and False or True
Which of the following will be correct output if the given expression is evaluated?
(a) True (b) False (c) NONE (d) NULL
4. What is the output of the expression? 1
S=’This is wow world’
print([Link](‘wow’))
a. 6 b. 7 c. 8 d. 9
5. What is the output of the following python code – 1
st=”hello”
print(st[ : 3]+st[ 3: ])
a. “hello” b. “hell” c. “olleh” d. None of these

6. Identify the output of the following code – 1


T=(10,20,30)
T1=T+40
print(T1)
(10,20,30,40) b. (10,20,30) c. (40,10,20,30) d. error

7. Which command of SQL is used to change the degree of a table - 1


(a) Insert (b)Drop (c) Alter (d) Update
8. What does the [Link]( ) method do in Python? 1
(a) Removes the first element from the list
(b) Removes the last element from the list

1
(c) Removes all the elements from the list
(d) Removes first and last element from the list.

9. If two tables T1 and T2 have 3 and 5 rows respectively, what is the cardinality of T1xT2 1
resultant table.
a. 8 b. 15 c. 2 d. 35
10. Write the missing statement to complete the following code for counting the number of lines 1
of a text file.
file = open("[Link]", "r")
data = ______________ # to read the file in form of list.
lcount=len(data)
[Link]()
11. State whether the following statement is True or False: 1
The finally block in Python is executed whether any exception occurs in the try block or not.
12. What will be the output of the following code? 1
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) 50#50 (B) 50#5(C) 50#30(D) 5#50
13. Which two constraints can make a primary key of a table – 1
NOT NULL, Default b. NULL, Unique c. NOT NULL, Unique d. None of these
14. Write SQL statement used to find the total number of NULL values in “Salary” column of 1
“Employee” table.
a. Select Count(*) from Employee;
b. Select Count(Salary) from Employee;
c. Select Count(*)-Count(Salary) from Employee;
d. Select Count(Salary)-Count(*) from Employee;
15. Which clause is used in Mysql to eliminate redundant data of a column from a table. 1
a. Desc b. Distinct c. order by d. Group by
16. Which SQL command is used to change the cardinality of a table. 1
a. Delete b. Update c. Insert d. both a and c
17. The hardware or software that prevents unauthorized access to or from a private network.
a. Cookies b. Firewall c. Repeater d. Gateway
18. Which protocol is used for Video conferencing – 1
a. IP b. VoIP c. SMTP d. FTP
19. Which switching technique allow data to be routed entirely from source node to destination 1
node and there is no physical path is established.
Q.20 and Q.21 are ASSERTION AND REASONING based questions. Mark the correct 1
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

2
20. Assertion (A):- The Pickle module is import for Binary files in Python Language. 1
Reasoning (R):- For using load() and dump() function in our Python program.
21. Assertion (A):- The Drop command is used to remove the data as well as structure of a table 1
Reasoning (R):- The Syntax of drop table is – Drop <tablename>;
SECTION - B

22 If L1=[1,3,5] and L2=[2,4,6,8] then write built functions for the following- 1+1
a. To add all elements of L2 at the end of L1.
b. Remove the last element of L1.
23. Write short note on – 1+1
a. two examples of Logical operators b. Unpacking of tuples
24. a. Write one example of mutable and immutable objects each. 1+1
b. Write the output of the code given below:
city = {"name": "Dehradun", "state": “UK”}
city[“state”] = "Delhi"
print([Link]())
25. Write possible output(s) of the following code- 2
import random
AR=[20,30,40,50,60,70]
Lower=[Link](1,3)
Upper=[Link](2,4)
for k in range(Lower,Upper+1):
print(AR[k],end=”#”)
a. 10#40#70# b. 30#40#50# c. 50#60#70# d. 40#50#70#
26. Identify the syntax error and logical error in the following code and rewrite the correct code 1+1
to add an element at the end of a tuple.
Def tup_add(T)
T1=T+40
print(T1)
Tp=(10,20,30)
Tup_add(Tp)
27. a. Write the reason why count(*) and count(marks) are giving 10, 8 as output for the 1+1
following SQL command-
Select count(*) from student;
Select count(marks) from student;
b. Write an SQL command to make column “Empid” the Primary key of an already
created table “Employee”.
28. a. Write the full form of Wi-fi, WLL. 1+1
b. Write one example of Client side scripting language and Server side scripting language
each.
SECTION – C
29. Write a user defined function in Python that displays the number of lines starting with “J” in 3
a text file named as “[Link]”.
30. A list contains following record of an Employee: 1+1
[Name, Salary, Department] +1
Write the following user defined functions to perform given operations on the stack named
‘mystk’:
(i) Push_element() - To Push an object containing Name, Salary and department of
employees to the stack .

3
(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.
(iii) Peek_element()- To show the topmost element of the stack without deleting it.
31. Predict the possible output(s) of the following code.. Also specify the maximum and 1+1
minimum value that can be assigned to the variable R when K is assigned value as 2. +1
import random
Signal=[‘stop’,’wait’,’go’]
for K in range(2,0,-1):
R=randrange(K)
print(Signal[R],end=”#”)
a. Stop#wait#go# b. wait#stop# c. go#wait# [Link]#stop#

SECTION – D
32. Consider the following table “Client”- 1+1
+2
Cid Name City Bal_due
C01 Ivan Mumbai 150
C02 Henry Delhi NULL
C03 Smith Goa 350
C04 John Delhi 120
a. Write SQL query based on Client table for the following –
1. Drop the column “City”.
2. Change the city from “Mumbai” to “Kolkata”.
b. Write the output of the queries (i) to (iv) based on the table ”Client” :
i. Select count(Bal_due) from Client;
ii. Select City from Client where City like ‘%i’;
iii. Select name from Client order by City desc;
iv. Select distinct city from Client;

33. A csv file “[Link]” contains data of staff of an organization. Each record contains 4
following information- Empid, Name , Salary , Department
For example a sample record of file may be-
[101,’lokesh’,12000,’HR’]
Write the following python functions to perform the specified operations on this file-
a. Read all records from the file and display all those records that having salary>10000.
b. Count the number of records in the file.
34. (a) Write the SQL queries for (i) to (iv) based on the relations Employee and Manager given 4
below:
Table: Employee
Empid Name Salary Mngid
101 Amit 12000 M02
102 Aman 21000 M01
103 Jay 18000 M03
Table : Manager
Mngid Mname Dept
M01 Jerry Marketing
M02 Andrew HR
M03 Jack Finance
i. Display name of employee with their corresponding manager name.

4
ii. Display the name of employee and their department that having salary more than
12000.
iii. List the name of employee with their salary and department who belongs to “HR”
department.
iv. To display the highest and lowest salaries of the employee .

35. In database “Details”, there is a table named as “student” having the following structure- 4
Column Type
Rno Integer
Name Varchar(20)
Percent float
Write a python function named as Display() to add one record and show all records of the
student [Link] the following for Python Database Connectivity-
Host: localhost, User: root, Password : xyz

SECTION – E
36. Ajay has written a code and created a binary file [Link] with pid, name, brand and cost. 5
The file contains 10 records. Help him to do the following task –
a. Write a function to input data of product and append in the binary file.
b. Write a function to update the data of product whose cost is more than 200 and
change their brand as “sony”.
c. Write a function to read all the data from binary file and display those products
whose brand is not “LG”.
37. Bright Future University is planning to set up a network for its Academic schools at 5
Dehradun. The university has 3 academic schools (Law School, Business School and
Technology School) and 1 admin center building in their campus.
The distance between the buildings and number of computers in each building are given
below
The distance between the buildings::
Law School to Business School 60 m
Law School to Technology School 90 m
Law School to Admin center 115 m
Business School to Technology School 40 m
Business School to Admin center 45 m
Technology School to Admin center 25 m
Number of computers in each building::
Law School 25
Technology School 50
Admin Center 125
Business School 35
1. Suggest the most suitable place to install server.
2. Suggest a device for data security for the campus.
3. Draw an ideal cable layout for campus.
4. Suggest a device to connect all the computers in each building.
5. University is planning to connect its admission center in the closest city which is 350
km apart from Campus. Which type of network (LAN/MAN/WAN) will be formed.
Justify your answer.
*********

5
6
Code: - KVS (DR)/2024/JI
KENDRIYA VIDYALAYA SANGTHAN, DELHI REGION
Pre-Board-1 Examination 2024-25
Class: XII Subject: Computer Science (083)
M.M.: 70 Time: 3 hours
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
SECTION – A (21X1=21 MARKS) Marks
No.
1 State True or False : “ In Python tuple is mutable datatype” 1
2 What will the output of the following code 1
S = "text#next"
print([Link]("t"))
(A) ext#nex (B) ex#nex
(C) text#nex (D) ext#next
3 What will be the output of the following statement : 1
print( 3 – 2 ** 2 ** 2 + 77 / 11 )
(A) 6 ( B) 6.0 (C) -6.0 (D) Error
4 Consider a list L = [‘H’, ‘U’, ‘L’, ‘K’]. Which of the following operations will 1
result in an error?
(A) L * 2 (B) L + [2]
(C) L * [2] (D) 2 * L
5 Consider the statements given below and then choose the correct output 1
from the given options :
Game="World Cup 2023"
print(Game[-6::-1])
(A) CdrW (B) ce o (C) puC dlroW (D) Error
6 Consider the tuple in python named sub=( “cs”, “phy”, “mat”). 1
Identify the invalid statement(s) from the given below statements:
(A) s=sub[1] (B) print(sub[2])
(C) sub[0]= “ip” (D) list=list(sub)
7 If my_dict is a dictionary as defined below, then which of the following 1
statements will raise an exception?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
(A) my_dict.get('orange')
(B) print(my_dict['apple', 'banana'])
(C) my_dict['apple']=20
(D) print(str(my_dict))

Page 1 of 9
8 Which keyword is used for function in python? 1
(A) Fun (B) def (C) DEFINE (D) Function
9 Mr. Ravi is creating a field that contains alphanumeric values and fixed 1
lengths. Which MySQL data type should he choose for the same?
(A) VARCHAR (B) CHAR (C) LONG ( D) NUMBER
10 Which is the valid syntax to write an object onto a binary file opened in the 1
write mode?
(A) [Link](<object to be written>, <file handle of open file>)
(B) [Link](<file handle of open file>, <object to be written>)
(C) [Link](<object>, <file handle>)
(D) None of the above
11 The output of the given expression is 1
>>>20 * (20 / 0)
(A) NameEr ror (B) TypeError
(C)OverflowError (D) ZeroDivisionError
12 What will be the output of the following code? 1
a = 15
def update(x):
global a
a += 2
if x%2==0:
a *= x
else:
a //= x
a=a+5
print(a, end="$")
update(5)
print(a)
(A) 20$11 (B) 15$4 (C) 20$4 (D) 22$4
13 The structure of the table/relation can be displayed using ______ command. 1
(A) view (B) describe (C) show (D) select
14 What will be the output of the query? 1
SELECT * FROM products WHERE product_name LIKE 'App%';
(A) Details of all products whose names start with 'App'
(B) Details of all products whose names end with 'App'
(C) Names of all products whose names start with 'App'
(D) Names of all products whose names end with 'App' .
15 Which of the following statements is FALSE about keys in a relational 1
database?
(A) Any candidate key is eligible to become a primary key.
(B) A primary key uniquely identifies the tuples in a relation.
(C) A candidate key that is not a primary key is a foreign key.
(D) A foreign key is an attribute whose value is derived from the primary
key of another relation.
16 Which aggregate function can be used to find the cardinality of a table? 1
(A)sum() (B)count() (C)avg() (D)max()
17 Which protocol is used to transfer files over the Internet? 1
(A) HTTP (B) Telnet (C) PPP (D)HTTPS

Page 2 of 9
Which network device is used to connect two networks that use different 1
18 protocols?
(A) Modem (B) Gateway (C) Switch (D) Repeater
When you connect two mobile phones using Bluetooth to transfer a picture 1
19 or file which type of network is formed
(A) LAN (B) WAN (C) PAN (D) MAN
Q20 and21 are ASSERTION AND REASONING based questions. Mark the correct
choice as
(A) Both A and R are true and R is the correct explanation for A 4
(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): List is an immutable data type 1
Reasoning(R): When an attempt is made to update the value of an
immutable variable, the old variable is destroyed and a new variable is
created by the same name in memory.
21 Assertion (A): A SELECT command in SQL can have both WHERE and 1
HAVING clauses.
Reasoning (R): WHERE and HAVING clauses are used to check conditions,
therefore, these can be used interchangeably.
SECTION– B (7X2 =14 MARKS)
22 (A) Which of the following is valid arithmetic operator in Python: 2
(i) // (ii) ? (iii) < (iv) and
(B) Write the type of tokens from the following:
(i) if (ii) roll_no

23 (A) Identify the valid declaration of L: 2


L = [1, 23, ‘hi’, 6].
(i)list (ii) dictionary
(iii) array (iv) tuple
(B) Which is the correct form of declaration of dictionary?
(i) Day={1:’monday’,2:’tuesday’,3:’wednesday’}
(ii) Day=(1;’monday’,2;’tuesday’,3;’wednesday’)
(iii) Day=[1:’monday’,2:’tuesday’,3:’wednesday’]
(iv) Day={1’monday’,2’tuesday’,3’wednesday’]
24 (i) Consider the List prices L=[23.811,237.81,238.91] then 2
(Answer using built in function only)
(A) Write a statement to sort the elements of list prices in ascending order
OR
(B) Write the statement to find the minimum or smallest element from list
(ii) Consider the List prices L=[“Jan”,”Feb”,”Mar”] then
(Answer using built in function only)
(A) Add the element “Apr” at the last
OR
Page 3 of 9
(B) Find the index of “Feb”
25 What possible output(s) are expected to be displayed on screen at the time 2
of execution of 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=[Link](1,3)
TO=[Link](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#
26 Kavi has written a function to print Fibonacci series for first 10 element. 2
His code is having errors. Rewrite the correct code and underline the
corrections made. Some initial elements of Fibonacci series are:
def fibonacci()
first=0 second=1
print((“first no. is “, first)
print (“second no. is,second)
for a in range (1,9):
third=first+second
print(third)
first,second=second,third
fibonacci()

27 (i) 2
(A) What is the key which depends on the primary value of another table?
OR
(B) What is the keyword to remove duplicate values from selecting the
record from the table?
(ii)
(A) There is a column hobby in a table contacts. The following two
statements are giving different outputs. What may be the possible reason?
SELECT COUNT (*) FROM CONTACTS;
SELECT COUNT(HOBBY) FROM CONTACTS;
OR
(C) Write an SQL command to make the column M_ID the Primary Key of an
already existing table, named MOBILE.

28 (A) Expand the following terms: 2


i. SMTP ii. TCP/IP
(B) Give one difference between XML and HTML?
OR
Write one advantage and one disadvantage of each –
Page 4 of 9
(i) STAR Topology
(ii) Tree Topology

Section– C (3X3=9 Marks)


29 Write a function in python to count the number of lines in a text file 3
‘[Link]’ which is starting with an alphabet ‘A’.
OR
Write a method/function DISPLAYWORDS() in python to read lines from a
text file [Link], and display those words, which are less than 4
characters.
30 Raju has a list containing 10 integers. You need to help him create a 3
program with separate user defined functions to perform the following
operations based on this list.
➢ Traverse the content of the list and push the even numbers into a stack.
➢ Pop and display the content of the stack.
For example:
If the sample content of the list is as follows:
N=[12,13,34,56,21,79,98,22,35,38]
Sample output of the code should be:
38 22 98 56 34 12
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']
The output should be:
['Columbo', 'Sri Lanka']

Page 5 of 9
['Dubai', 'UAE']
['Naypyidaw', 'Myanmar']
Stack Empty
31 Predict the output of the following code: 3
d = {"apple": 15, "banana": 7, "cherry": 9}
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]
print(str2)
OR
tuple1 = (11, 22, 33, 44, 55 ,66)
list1 =list(tuple1)
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)
SECTION– D (4X4=16 MARKS)
32 Consider the table Graduate 4

[Link] NAME STIPEND SUBJECT AVERAGE DIV


1 KARAN 400 PHYSICS 68 I
2 DIWAKAR 450 COMP Sc 68 I
3 DIVYA 300 CHEMISTRY 62 I
4 REKHA 350 PHYSICS 63 I
5 ARJUN 500 MATHS 70 I
6 SABINA 400 CHEMISTRY 55 II
7 JOHN 250 PHYSICS 64 I
8 ROBERT 450 MATHS 68 I
9 RUBINA 500 COMP Sc 62 I
10 VIKAS 400 MATHS 57 II

(A) Write the following queries


1. List the names of those students who have obtained DIV I sorted by
NAME.
2. Display a report, listing NAME, STIPEND, SUBJECT and amount of
stipend received in a year assuming that the STIPEND is paid every
month.
3. To count the number of students who are either PHYSICS or
COMPUTER SC graduates.
4. To insert a new row in the GRADUATE table: 11,”KAJOL”, 300,
“computer sc”, 75, 1
OR
Page 6 of 9
(B) Give the output of following sql statement based on the above table
1. Select MIN(AVERAGE) from GRADUATE where SUBJECT=”PHYSICS”;
2. Select SUM(STIPEND) from GRADUATE WHERE div=2;
3. Select AVG(STIPEND) from GRADUATE where AVERAGE>=65;
4. Select COUNT(distinct SUBJECT) from GRADUATE;
33 Sangeeta is a Python programmer working in a computer hardware 4
company. She has to maintain the records of the peripheral devices. She
created a csv file named [Link], to store the details.
The structure of [Link] is:
[P_id,P_name,Price]
where
P_id is Peripheral device ID (integer)
P_name is Peripheral device name (String)
Price is Peripheral device price (integer)
Sangeeta wants to write the following user defined functions so help her
out by creating the following user defined functions :
Add_Device() : to accept a record from the user and add it to a csv file,
[Link]
Count_Device() : To count and display number of peripheral devices whose
price is less than 1000.
34 Consider the following tables FACULTY and COURSES. Write SQL 4
commands for the statements (1) to (4)
FACULTY
F_ID Fname Lname Hire_date Salary
102 Amit Mishra 12-10-1998 12000
103 Nitin Vyas 24-12-1994 8000
104 Rakshit Soni 18-5-2001 14000
105 Rashmi Malhotra 11-9-2004 11000
106 Sulekha Srivastava 5-6-2006 10000

COURSES

C_ID F_ID Cname Fees


C21 102 Grid Computing 40000
C22 106 System Design 16000
C23 104 Computer Security 8000
C24 106 Human Biology 15000
C25 102 Computer Network 20000
C26 105 Visual Basic 6000

[Link] display details of those Faculties whose salary is greater than 12000.
2. To display the details of courses whose fees is in the range
of 15000 to 50000 (both values included).

Page 7 of 9
3. To increase the fees of all courses by 500 of “System Design” Course.
4. (A) To display details of those courses which are taught by ‘Sulekha’ in
descending order of courses?
OR
(B) Identify the Primary Key in FACULTY and COURSES table
35 Sumit wants to write a code in Python so help him by writing the code to 4
display all the details of the passengers from the table flight in MySQL
database, Travel. The table contains the following attributes:

F_ code : Flight code (String)


F_name: Name of flight (String)
Source: Departure city of flight (String)
Destination: Destination city of flight (String)

Consider the following to establish connectivity between Python and


MySQL:
• Username : root
• Password : airplane
• Host : localhost
SECTION– E (2X5=10 MARKS)
36 (i) Differentiate between r+ and w+ file modes in Python. 5
(ii) A Binary file, [Link] has the following structure: (2+3)
[ TNO, TNAME, TTYPE ]
Where TNO – Train Number TNAME – Train Name TTYPE is Train Type.
Write a user defined function, findType(ttype), that accepts ttype as
parameter and displays all the records from the binary file [Link], that
have the value of Train Type as ttype.
37 Roorkee University is setting up its academic blocks at Naya Raipur and is 5
planning to set up a network. The University has 3 academic blocks and one
Human Resource Center and Head Office at Mumbai as shown in the
diagram below:
Naya Raipur Mumbai
BUSINESS BLOCK TECHNOLOGY Head Office
BLOCK
LAW BLOCK HR CENTRE

Center to Center distances between various blocks/center is as follows :

Law Block to business Block 40m


Law block to Technology Block 80m
Law Block to HR center 105m
Business Block to technology Block 30m

Page 8 of 9
Business Block to HR Center 35m
Technology block to HR center 15m
Mumbai Head Office to Raipur 800 km

Number of computers in each of the blocks/Center is as follow:


.

BUSINESS BLOCK 25
TECHNOLOGY BLOCK 40

LAW BLOCK 15
HR CENTRE 115

Write the Answers:


1. Suggest the most suitable place (i.e., Block/Centre) to install the server of
this University with a suitable reason.
2. Suggest an ideal layout for connecting these blocks/center for a wired
connectivity.
3. Which device will you suggest to be placed/installed in each of these
blocks/centers to efficiently connect all the computers within these
blocks/centers
4. Suggest the placement of a Repeater in the network with justification.
5.
(A) The university is planning to connect its admission office in Delhi,
which is more than 1250km from university. Which type of network out of
LAN, MAN, or WAN will be formed? Justify your answer
OR
(B) What would be your recommendation for enabling live visual
communication between the Admin Office at the Mumbai campus and the
DELHI Head Office from the following options:
a) Video Conferencing b) Email c) Telephony d) Instant Messaging

Page 9 of 9
कोड(Code)-KVS(DR)/2024/AN

KENDRIYA VIDYALAYA SANGATHAN, DELHI REGION


Pre- Board-I Examination -2024-25
Class -XII Subject: Computer Science
M.M. – 70 Time- 3hr .
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 SelecSat
• 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
Q No. Section-A (21 x 1 = 21 Marks) Marks
cas
1. State True or False: (1) e
A string is immutable in Python. Every time when we modify the string, Python of
Always create a new String and assign a new string to that variable. MC
Q,
2. What is the output of the following code? (1) tex
listOne = [20, 40, 60, 80] t of
listTwo = [20, 40, 60, 80] the
print(listOne == listTwo) cor
rec
t
ans
we
r
sho
uld
als
o
be
wri
tte
n.
print(listOne is listTwo)

a) True b) True c) False d) False


5. Which of the following statement prints hello\example\[Link]? (1)
True False True False
a) print(“hello\example\[Link]”)
b) print(“hello\\example\\[Link]”)
3. What is the output of the following code? (1)
c) print(“hello\”example\”[Link]”)
var= "James Bond"
d) print(“hello”\example”\[Link]”)
print(var[2::-1])
6. Is the following Python code valid? (1)
a) Jam b)dno c) maJ d) dnoB semaJ
>>> a=(1,2,3)
>>> b=[Link](4,)
4. What is the output of the following code? (1)
a) Yes, a=(1,2,3,4) and b=(1,2,3,4)
var = "James" * 2 * 3
b) Yes, a=(1,2,3) and b=(1,2,3,4)
print(var)
c) No because tuples are immutable
d) No because wrong syntax for update() method
a) JamesJamesJamesJamesJamesJames
b) JamesJamesJamesJamesJames
7. What will be the output of the following Python code snippet? (1)
c) Error: invalid syntax
total={}
d) None
def insert(items):
if items in total:
total[items] += 1
else:
total[items] = 1
insert('Apple')
insert('Ball')
insert('Apple')
print (len(total))
a) 3 b) 1 c) 2 d) 0
8. What will be the output of the following Python code? (1)
s="a@b@c@d"
a=list([Link]("@"))
print(a)
b=list([Link]("@",3))
print(b)
a) [‘a’,’b’,’c’,’d’] b)[‘a’,’@’,’b’,’@’,’c’,’@’,’d’]
[‘a’,’b’,’c’,’d’] [‘a’,’b’,’c’,’d’]

c) [‘a’,’@’,’b@c@d’] d) [‘a’,’@’,’b@c@d’]
[‘a’,’b’,’c’,’d’] [‘a’,’@’,’b’,’@’,’c’,’@’,’d’]

9. Which of the following functions ignore NULL values? (1)


a) MAX b) COUNT c) SUM d)All of the above

10. Which of the following is not an exception handling keyword in Python? (1)
a) try b) except c) accept d) finally
11. What will be the output of the following Python code? (1)
a=10
b=20
def change():
global b
a=45
b=56
change()
print(a)
print(b)
a) 10 b) 45 c) 10 d) Syntax Error
56 56 20
12. Which device connects an organization's network with the outside world of the (1)
Internet?
a) Hub b) Modem c) Gateway d) Repeater

13. Which data type has a fixed length in the database. (1)
a)Varchar(5) b) Char(n) c) Longchar(n) d) None of the above.

14. What will be the output of the following Python code? (1)
def display(b, n):
while n > 0:
print(b,end="")
n=n-1
display('z',3)
a) zzz b) zz c) An exception is executed d) Infinite loop

15. Which of the following allows you to connect and login to a remote computer? (1)
a) SMTP b) HTTP c) FTP d) Telnet

16. Consider the following query (1)


SELECT name FROM stu WHERE subject LIKE “ ------ Computer Science”;
Which of the following has to be added into the blank space to select the subject
which has computer Science as its ending string ?
a) $ b) _ c) II d) %

17. Which address is used by the router to forward packets? (1)


a) IP address b) MAC address c) Port address d) TCP header

18. Which of the following will you use in the following query to display the unique (1)
values of the column dept_name?
SELECT _________ dept_name FROM Company;

a)All b) Unique c) Distinct d) Name

19. A Database Administrator needs to display the average pay of workers from each (1)
departments with more than five employees. Which SQL query is correct for this
task?
a) SELECT DEPT, AVG(SAL) FROM EMP WHERE COUNT(*) > 5 GROUP BY DEPT;
b) SELECT DEPT, AVG(SAL) FROM EMP HAVING COUNT(*) > 5 GROUP BY DEPT;
c) SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT WHERE COUNT(*) >5;
d) SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT HAVING COUNT(*)> 5;

Q 20 and 21 are ASSERTION AND REASONING 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): Python overwrites an existing file or creates a non- existing file (1)
when we open a file with ‘w’ mode.
Reason(R): a+ mode is used only for writing operations
21. Assertion ( A): In SQL, the aggregate function Avg() calculates the average value (1)
on a set of values and produces a single result.
Reason ( R): The aggregate functions are used to perform some fundamental
arithmetic tasks such as Min(), Max(), Sum() etc
Q No Section-B ( 7 x 2=14 Marks) Marks

22. What will be the output of the following code: (2)


i=1
while True:
if i%7 == 0:
break
print(i)
i += 1

23. Predict the output of the Python code given below: (2)
a=tuple()
a=a + tuple(“Python”)
print(a)
print(len(a))
b=(10,20,30)
print(len(b))

24. A) Consider the following list of elements and write Python statement to print (2)
the
output of each question.
elements=['apple',200,300,'red','blue','grapes']
i) print(elements[3:5])
ii) print(elements[::-1])
OR
B) Consider the following list exam and write Python statement for the following
questions:
exam=[‘english’,’physics’,’chemistry’,’cs’,’biology’]
i) To insert subject “maths” as last element
ii) To display the list in reverse alphabetical order

25. Predict the output of the following: (2)


def Display(str):
m=""
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%3==0:
m=m+str[i-1]
else:
m=m+"$"
print(m)
Display('HarryPotter@9.0')

26. Rewrite the following code in python after removing all syntax error(s). (2)
Underline each correction done in the code.
25 = Num
WHILE Num<=100:
if Num=>50:
print(Num)
Num=Num+10
else
print(Num*2)
Num=Num+5

27. A) Identify the type of topology from the following: (2)


(i) Each node is connected with the help of a single cable.
(ii) Each node is connected with central switching through independent
cables.
OR
B) Write one advantage and one disadvantage of bus topology.

28. A) A table Employee has 8 columns but no row. Later, 8 new rows are inserted (2)
and 2 rows are deleted in the table. And another table Dept has 5 rows and 4
columns. What is the degree and cardinality of the Cartesian Product of tables
Employee & Dept? (Employee X Dept)
OR
B) Consider the following two commands with reference to a table, named
Employee, having a column named D_name:
(a) Select count(D_Name)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?

Q No. Section-C ( 3 x 3 = 9 Marks) Marks

29. A) The file “[Link]” stores the name of few selected cities with the Pincode. (3)
Write a function Display() to read data and display only those city with the
Pincode whose first letter is not a vowels.
Sample Output:
New Delhi 110005
Mumbai 400001
OR
B) The file “[Link]” stores the name of all the students of Class XII. Write a
function “Count()” to read the records from the file. Count and display all the
uppercase and lowercase letters separately available in file.

30. A) Each node of a stack named CITY contained the following information: (3)
• Pin code of a city
• Name of city
Write the following user-defined functions in Python to perform the specified
operations on the stack CITY:
i) PUSH_CITY(CITY, new_city): This function takes the stack CITY and a
new city record new_city as arguments and pushes the new city
record onto the stack.
ii) POP_CITY(CITY): This function pops the topmost city record from the
stack and returns it. If the stack is already empty, the function should
display "Underflow".
iii) DISPLAY(CITY): This function takes the stack CITY and display all its
elements If the stack is empty, the function should display 'None'.

OR
B) Write the definition of a user-defined function `PUSH_NUM(L)` which accepts
a list of integers in a parameter `L` and pushes all those integers which are either
multiple of 3 or 5 from the list `L` into a Stack named `NUMBERS`. Write function
POP_NUM() 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_NUM() to display all element of the stack without deleting them. If the stack
is empty, the function should display 'None'.

For example:
If the integers input into the list `L` are:
[4,10, 15, 8, 14, 12]
Then the stack `NUMBERS` should store:
[10, 15, 12]

31. Predict the output of the Python code given below: (3)
def product(L1,L2):
p=0
for i in L1:
for j in L2:
p=p+i*j
return p
LIST=[1,2,3,4,5,6]
l1=[]
l2=[]
for i in LIST:
if(i%2!=0):
[Link](i)
else:
[Link](i)
print(product(l1,l2))
OR
Predict the output of the Python code given below:
tuple1 = (31, 22, 43, 54 ,65)
list1 =list(tuple1)
for i in list1:
new_list = []
for j in range(i%10):
new_list.append(i%10)
new_tuple = tuple(new_list)
print(new_tuple, end="@")
print("")

Section-D ( 4 x 4 = 16 Marks)
Q No. Marks
32. Consider a Table LOANS: (4)

Acc Cust_Name Amount Install Int_Rate Start_Date Interest


No ment
1 R.K. Gupta 300000 36 12.00 19-07-2009 1200
2 S.P. Sharma 500000 48 10.00 22-03-2008 1800
3 K.P. jain 300000 36 Null 08-03-2009 1600
4 M.P. Yadav 800000 60 10.00 06-12-2008 2250
5 S.P. Sinha 200000 36 12.50 03-01-2010 4500
6 P. Sharma 700000 60 12.50 05-06-2008 3500
7 K.S. Dhall 500000 48 Null 05-03-2008 3800

A) Write the following queries:


(i) Display the sum of all Loan Amounts whose Interest rate is greater than
10.
(ii) Display the Maximum Interest from Loans table.
(iii) Display the count of all loan holders whose name ends with ‘Sharma’.
(iv) Display the count of all loan holders whose Interest rate is Null.

OR

B) Write the Output of the following:

i) Select Avg(Interest) from Loans group by Installment;


ii) Select * from Loans where amount between 200000 and 500000 order by
Start_date desc;
iii) Select count (Int_rate)from Loans where installment <60;
iv) Select min(Amount) from Loans;
33. A CSV file with the name “[Link]” is already available in the system that (4)
contains two fields Country and Capital. A function Capital() is defined to access
information from the field and display all the country names along with their
capitals where country name is more than five characters long. In the code, there
are some places left blank to be filled with expression/function.
The code is written below as:
# A Python Code to read data from a csv file
import ____________ # Line 1
def Capital():
fr = open(“[Link]”,”r”)
reader = _______________ # Line2
next(______________) # Line 3
print(“Country Name which contains more than five characters: ”)
for a in reader:
if(____________): #Line 4
print(a)
[Link]()
With reference to the given code, answer the following questions:
a) What module/function will be filled in the blank marked with Line 1?
b) What function will be filled in blank marked with Line 2?
c) What variable will be filled in the blank marked with Line 3?
d) What condition will be filled in the blank marked with Line 4?

34. Consider the following tables Stationary and Consumer. Write SQL commands for (4)
the statement (i) to (iv):
Table: Stationary
S_ID StationaryName Company Price
DP01 Dot Pen ABC 10
PL02 Pencil XYZ 6
ER05 Eraser XYZ 7
PL01 Pencil CAM 5
GP02 Gel Pen ABC 15

Table: Consumer
C_ID ConsumerName Address S_ID
01 Good Learner Delhi PL01
06 Write Well Mumbai GP02
12 Topper Delhi DP01
15 Write & Draw Delhi PL02
16 Motivation Banglore PL01

(i) To display the details of those consumers whose Address is Delhi.


(ii) To display the details of Stationary whose Price is in the range of 8 to
15. (Both Value included)
(iii) To display the ConsumerName, Address from Table Consumer, and
Company and Price from table Stationary, with their corresponding
matching S_ID.

(iv) To increase the Price of all stationary by 2.


OR
To display the details of those stationary whose customer address is
delhi.

35. A table BOOK in LIBRARY database, has the following structure: (4)
Field Type
Book_id Int(7)
B_Nmae Varchar(35)
Price Float
Type Varchar(20)

Write the following Python function to perform the specified operations:


ADD_BOOK() : To input the details of Book and store ot in the BOOK table.
FIND_BOOK() : The function should find and display details all those books
whose type is literature from table BOOK.
Assume the following for Python-Database connectivity:
Host: localhost, User: root, Password: Lib@123

SECTION E (2 X 5 = 10 Marks)
Q No. Marks
36. A file “[Link]” has already been created with the record containing index (5)
number, name, marks and grade as sub-lists of the list. Later on, the user realised
that he has made wrong entry of the grades in all the records.
i) Define a function Update() to open the file in “rb+” mode to read and
update the grades in all the records as per the criteria mentioned
below:
Marks Grade
90 and above A
>=80 and <90 B
Else C

ii) Write a function to read the data from the binary file and display the data of
all those candidates who grade id ‘A’.
37. A company in Mega Enterprises has 4 wings of buildings in Mumbai Campus as (5)
shown in the diagram :

Centre to centre distances between various Buildings:


Number of computers in each of the wing:

Computers in each wing are networked but wings are not networked. The
company has now decided to connect the wings also.
(i) Suggest a most suitable cable layout for the above connections and
specify the topology.
(ii) Suggest the most suitable wing to place the server by giving suitable
reason.
(iii) Suggest the placement of the following devices with justification if the
company wants minimized network traffic : (a) Repeater (b) Hub /
switch
(iv) The organization is planning to link its sale counter situated in various
part of the same city. Which type of network out of LAN, WAN, MAN
will be formed? Justify.
(v) The company is planning to link its head office situated in New Delhi
with the offices in hilly areas. Suggest a way to connect it economically.
OR
What would be your recommendation for enabling live visual
communication between the Office at the Mumbai campus and the
DELHI Head Office.
12PB24CS04
KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION
PRE-BOARD EXAMINATION
CLASS: XII COMPUTER SCIENCE (083) Time allowed: 3 Hours
Maximum Marks: 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 (21 x 1 = 21 Marks) Marks
1 State True or False 1
“Dictionaries in Python are mutable but Strings are immutable.”

2 str="R and Data Science" 1


z=[Link]()
newstr="=".join([z[2].upper(),z[3],z[2]+z[3],z[1].capitalize()])
newstr is equal to
a) 'DATA=Science=DataScience=And' b) 'DATA=DataScience=And'
c) 'DATA=Science=And' d) 'DATA=Science==DataScience=And'

3 Consider the given expression: 1


True and not AAA and not True or True
Which of the following will be correct output if the given expression is evaluated
with AAA as False?
(a) True (b) False (c) NONE (d) NULL

4 What shall be the output of the following statement? 1


“TEST”.split(‘T’,1)
(a) [ ‘ ‘, ’ ES ’ ,’ ‘ ] (b) [ ‘T’, ’ ES ’ ,’T’] (c) [ ‘ ‘, ‘ EST ’] (d) Error

5 What shall be the output for the execution of the following statement? 1
“ANTARTICA”.strip(‘A’)
(a) NTRCTIC (b) [‘ ‘, ‘NT’, ‘RCTIC’, ‘ ‘] (c)NTARTIC (d) Error

6 Consider The following: t=(12,13,14,16,[2,3]) 1


What changes will be made in t after the execution of the following statement?

1
[Link](4)
(a) t=(12,13,14,16,[2,3],4) (b) t= (12,13,14,16,[2,3,4])
(c) t=(4,12,13,14,16,12,3) (d) It will give an error

7 What will be the output? 1


test = {1:'A', 2:'B', 3:'C'}
del test[1]
test[1] = 'D'
del test[2]
print(len(test))
(a) 0 (b) 1 (c) 2 (d) Error
8 Predict the output of following code snippet: 1
Lst = [10,20,30,40,50,60,70,80,90]
print(Lst[::3])

9 Fill in the blanks: 1


------------------command is used to remove attribute from the table in SQL
(i) Update (ii) Remove (iii) Alter (iv) Drop

10 Which of the following options is the correct Python statement to read and display the 1
first 10 characters of a text file “[Link]”?
(a) F=open(‘[Link]’)
print([Link](10))
(b) F=open(‘[Link]’)
print([Link](10))
(c) F=open(‘[Link]’)
print([Link](10))
(d) F=open(‘[Link]’,)
print([Link](10))

11 When will the else part of try-except-else be executed? 1


a) always b) when an exception occurs
c) when no exception occurs d) when an exception occurs in to except block

12 Find and write the output of following python code: 1


a=100
def show():
global a
a=-80

def invoke(x=5):
global a
a=50+x

2
show()
invoke(2)
invoke()
print(a)
13 Fill in the blank: 1
__________command is used for changing value of a column in a table in SQL.
(a) update (b) remove (c) alter (d) drop

14 What will be the output of the query? 1


SELECT * FROM products WHERE product_name LIKE 'BABY%';
(a) Details of all products whose names start with 'BABY'
(b) Details of all products whose names end with 'BABY'
(c) Names of all products whose names start with 'BABY'
(d) Names of all products whose names end with 'BABY'
15 To fetch the multiple records from the result set you may use___ method in SQL? 1
a) fetch() b) fetchmany() c) fetchmultiple () d) None of the mentioned

16 Which function is used to display the total no of records from a table in a database? 1
(a) total () (b) total(*) (c) count(*) (d) count()

17 Fill in the blank: 1


______________is a communication medium, classified as long-distance high speed
unguided medium.
(a) Optical fiber (b) Microwave (c) Satellite Link (d)WIMAX

18 A system designed to protect unauthorized access to or from a private network is 1


called-------------.
(a) Password (b) Firewall (c) Access wall (d) Network Security

19 Which of the following establishes PAN? 1


(a) Bluetooth (b) WWW (c) Telephone (d) Modem

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): CSV (Comma Separated Values) is a file format for data storage 1
that looks like a text file.
Reason (R): The information is organized with one record on each line and each
field is separated by a comma.

21 Assertion(A). Data conversion is necessary during reading and writing in text file 1
Reasoning. (R) Binary files store data in a binary format, which can be directly

3
read and written without the need of the data conversion

Q No Section-B ( 7 x 2=14 Marks) Marks


22 How are list different from dictionaries. Write two points. 2
23 Give two examples of each of the following: 2
(I) Membership operators (II) Identity operators

24 Given a list L=[10,9,8,7,6] 2


(Answer using built-in functions only)
(I) A) Write a statement to arrange the list in descending order and store it in another
list L1.
OR
B) To display the first three elements.
(II) A) Write a statement to display the total number of elements in the list.
OR
B) Write a statement to reverse the elements of the list and store it in another list L1.

25 What possible outputs are expected to be displayed on screen at the time of execution 2
of the program from the following code? Select correct options from below.

import random
arr=['10','30','40','50','70','90','100']
L=[Link](1,3)
U=[Link](3,6)
for i in range(L,U+1):
print(arr[i],"$",end="@")
a)30 $@40 $@50 $@70 $@90
b)30 $@40 $@50 $@70 $@90 $@
c) 30 $@40 $@70 $@90 $@
d) 40 $@50 $@

26 2
Sona has written the following code to check whether the number is divisible by3. She
could not run the code successfully. Rewrite the code and underline each correction
done in the code.
x=10
for i range in (a):
if i%3=0:
print(i)
else: pass
x = 10
for i in range(x):
if i % 3 == 0:
print(i)

4
else:
pass
27 (I) A) Differentiate ORDER BY and GROUP BY with an example. 2
OR
B) Classify the following statements into DDL and DML
a) delete b) drop table c) update d) create table

(II) A) What do you understand by VARCHAR datatype in a table? Give a suitable


example and differentiate the same with the data type CHAR.
OR
B) Categorize the following commands as Group by /Math function:
count (), pow (), round (), avg ()

28 A) Expand the following terms: i) MAN ii) HTML 2


OR
B) What is URL?

Q No. Section-C ( 3 x 3 = 9 Marks) Marks


29 A) Write a function linecount () in python which read a file ‘[Link]’ and count 3
number of lines starts with character ‘P’.
OR
B) Write a function in python to count number of words ending with ‘n present in a
text file “[Link]” If [Link] contains “A story of a rich man and his son”, the output
of the function should be Count of words ending with ‘n’ is 2

30 A) A list, items contain the following record as list elements [itemno, itemname, 3
stock]. Each of these records are nested to form a nested list.
Write the following user defined functions to perform the following on a stack
reorder .
i. Push(items)- it takes the nested list as its argument and pushes a list object
containing itemno and itemname where stock is less than 10
ii. Popitems() -It pops the objects one by one from the stack reorder and also displays
a message ‘Stack empty’ at the end.
OR
(B) Write a function RShift(Arr) in Python, which accepts a list Arr of numbers and
places all even elements of the list shifted to left.
Sample Input Data of the list Arr= [10,21,30,45,12,11],
Output Arr = [10, 30, 12, 21, 45, 11]

31 Predict the output of the following code: 3


d = {"apple": 15, "banana": 7, "cherry": 9}

5
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + "\n"
str2 = str1[:-1]
print(str2)

OR

Predict the output of the following code:


mylist = [2,14,54,22,17]
tup = tuple(mylist)
for i in tup:
print(i%3, end=",")

Q No. Section-D ( 4 x 4 = 16 Marks) Marks


32 Consider the table EMPLOYEE as given below 4
pid surname firstname gender city pincode basicsalary

1 Sharma Geeta F Udhamwara 182141 50000

2 Singh Surinder M Kupwara 193222 75000


Nagar

3 Jacob Peter M Bhawani 185155 45000

4 Alvis Thomas M Ahmed 380025 50000


Nagar

5 Mohan Garima M Nagar 390026 33000


Coolangetta

6 Azmi Simi F NewDelhi 110021 40000

7 Kaur Manpreet F Udhamwara 182141 42000


A) Write the SQL Queries for (i) to (iv) based on ITEMS table
(i) Display the SurNames, FirstNames and Cities of people residing in Udhamwara
city.
(ii) Display the Person Ids (PID), cities and Pincodes of persons in descending order
of Pincodes.
(iii) Display the First Names and cities of all the females getting Basic salaries
above 40000.
(iv) Display the highest Basic Salary among all male staff.
OR
B) Write the output
(I) Select city, sum(basicsalary) as Salary from EMPLOYEE group by city;
(II) Select * from EMPLOYEE where surname like '%Sharma%';
(III) Select surname,firstname,city from EMPLOYEE where basicsalary between

6
47000 and 55000;
(IV) Select max(basicsalary) from EMPLOYEE;

33 A csv file "[Link]" contains the details of furniture. Each record of the file 4
contains the following data:
● Furniture id
● Name of the furniture
● Price of furniture
For example, a sample record of the file may be:
[‘T2340’, ‘Table’, 25000]
Write the following Python functions to perform the specified operations on this file:
a. add() – To accept and add data of a furniture to a CSV file [Link]. Each
record consists of a list with field elements as fid, fname, fprice to store furniture id,
furniture name and furniture price respectively
b. search() – To display the records of the furniture whose price is more than 10000.

34 Write the output of the SQL commands for (i) to (iv) on the basis of 4
tables BOOKS and ISSUES.
Table: BOOKS
Book_id BookName AuthorName Publisher Price Qty

L01 Maths Raman ABC 70 20

L02 Science Agarkar DEF 90 15

L03 Social Suresh XYZ 85 30

L04 Computer Sumita ABC 75 7

L05 Telugu Nannayya DEF 60 25

L06 English Wordsworth DEF 55 12


Table: ISSUES
Book_id Qty_issued

L02 13

L04 5

L05 21

(I) To display complete details (from both the tables) of those Books whose quantity
issued is more than 5.
(II) To display the details of books whose quantity is in the range of 20 to 50 (both
values included).
(III) To increase the price of all books by 50 which have "DEF” in their PUBLISHER
names.

7
(IV) (A) To display names (BookName and AuthorName) of all books.
OR
(B) To display the Cartesian Product of these two tables.

35 A table, named STUDENT, in SCHOOL database, has the following structure: 4

Field Type

Rollno integer

Name string

Clas integer

Mark integer

Write the following Python function to perform the specified operation:


AddStudent(): To input details of a student and store it in the table STUDENT.
The function should then retrieve and display all records from the STUDENT table
where the Mark is greater than 80.

Assume the following for Python-Database connectivity:


Host: localhost, User: root, Password:root

[Link]. SECTION E (2 X 5 = 10 Marks) Marks


36 Riya is a student of class 12. Her teacher assigned a task to Riya to create a Binary 5
file named ‘[Link]’ to store the details of books available in the department. The
structure of “[Link]” is
[BookNo,Book_Name,Author,Price]
For maintaining all records of books, Riya wants to write the following user defined
functions:
I) createFile() - to input data for a record and add to the binary file ‘[Link]’.
(II) CountRec(Author)- to accept the Author name as parameter and count and return
the number of books by the given Author stored in the binary file “[Link]”.
(III) displayAbove() to read the data from the binary file and display the data of all
those books whose price is above 1000.
As a Python expert, help her to achieve this task.

37 Vidya for all is an NGO. It is setting up its new campus at Jaipur for its web-based 5
activities. The campus has four buildings as shown in the diagram below

Main Resource

Training Accounts

8
Centre to centre distance between various buildings as per architectural drawings (in
Mtrs.) is as follows:

Main building to Resource building 120m

Main building to Training building 40m

Main building to Accounts building 135m

Resource building to Training building 125m

Resource building to Accounts building 45m

Training building to Accounts building 110m

Number of computers in each building are as follows:


Main building 15

Resource building 25

Training building 250

Training building 10

(I) Suggest a cable layout of connection among the buildings.


(II) Suggest the most suitable place to house the server for this NGO. Also provide a
suitable reason for your suggestion.
(III) Suggest the placement of the following devices with justification:
(a) Repeater (b)Hub/Switch
(IV) Write any one advantage of bus topology
(V) A) Expand MODEM
OR
B) Expand WLL

*************************************

9
AS-07
Please check total printed pages before start : 12
Roll No. :

PRE-BOARD EXAM. -1 2024-25


CLASS : XII
SUBJECT : COMPUTER SCIENCE
Time : 3 Hours Max. Marks : 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.
SECTION-A (21 X 1 = 21 MARKS)
1 State True or False: - “Variable declaration is implicit in Python.” 1
2 Select the correct output of the code: 1
S= “last#ball”
print([Link](“l”))

[P.T.O.]
AS-07 2
(a) ast#ba (b) ast#bal
(c) last#ba (d) ast#ball
3 Evaluate the following expression:
16 - (4 + 2) * 5 + 2**3 * 4
(a) 54 (b) 46 (c) 18 (d) 32 1
4 Select the correct output of the code: 1
Text = “Python Programming”
print([Link](‘P’)
(a) [‘ython’, ‘rogramming’] (b) [‘ ‘, ‘ython ’, ‘rogramming’]
(c) [‘ ‘, ‘ython‘, ‘programming’] (d) [‘python’, ‘rogramming’]
5 What will be the output of the following code snippet:
str = ‘Welcome to Python world”
print(str[: : -3]) 1
6 Which of the following will give an error in Python for a tuple t=(4,
‘a’, 7.8)
(a) print(sum(t)) (b) t=(1,2,3)
(c) a,b,c = t (d) print(len(t)) 1
7 If mdict is a dictionary as defined below, then which of the following
statements will raise an exception? 1
mdict = {‘red’: 100, ‘black’: 200, ‘white’: 300}
(a) [Link](300) (b) mdict[‘red’]=20
(c) print(mdict[‘black’, ‘white’]) (d) print(str(mdict))
8 Predict the output: 1
L = [23,4,7,12,2]
L1 = L. sort ()
L. insert (2,16)
print (L, ‘&’, L1)
(a) [2,4,7,12,16,23] & [2,4,7,12,23]
(b) [2,4,16,7,12,23] & [2,4,16,7,12,23]
(c) [2,4,7,12,16,23] & None

[P.T.O.]
3 AS-07
(d) None of these
9 Predict the output for the following code snippet: 1
t = 4,
print(type(t))
(a) <class ‘int’> (b) <class ‘tuple’>
(c) No output (d) error
10. The syntax of seek () is: 1
file_object.seek (offset [, reference point])
What is the default value of reference_point?
(a) 0 (b) 1 (c) 2 (d) 3
11 State whether the following statement is True or False: 1
“Every syntax error is an exception but every exception cannot be
a syntax error.”
12. Write the output of the following Python code: 1
a = 20
def call (x):
global a
x+ = a
return x
x = 15
print(call (30), end= ‘$’)
(a) 35$ (b) 45$
(c) 50$ (d) 65$
13 Write the SQL query to add a primary key to an existing column
‘ADNO’ in the table ‘SRecord’. 1
14. Fill in the blank: 1
__________clause is used with SELECT statement to display data
in a sorted form with respect to a specified column.
15 Fill in the blank: 1
____________ is a number of tuples in a relation.

[P.T.O.]
AS-07 4
(a) Attribute (b) Degree
(c) Domain (d) Cardinality 1
16 Which SQL statement do we use to find out the total number of
records present in the table ORDERS? 1
(a) Select * from ORDERS;
(b) Select count(*) from ORDERS;
(c) Select find(*) from ORDERS;
(d) Select sum(*) from ORDERS;
17 What does HTTPS stand for?
(a) Hyper Text Protocol Secure
(b) Hypertext Transfer Protocol Secure
(c) Hidden Text Transfer Protocol Station
(d) Hypertext Transfer Protocol Station 1
18 Which of the following options is the correct unit of measurement
for network bandwidth?
(a) KB (b) bit
(c) Hz (d) Km 1
19 Fill in the blank:
TCP/IP stands for ____________________ 1
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 the module.
Reason (R) : import statement can be written anywhere in the
program, before using a function from that module. 1
21 Assertion(A) : In SQL, the aggregate function AVG() calculates the
average value on a set of values and produce a single result.
[P.T.O.]
5 AS-07
Reason(R) : The aggregate functions are used to perform some
fundamental arithmetic tasks such as Min(), Max(), Sum() etc…1
SECTION-B ( 7 X 2=14 MARKS)
22 Mithilesh has written a code to input a number and evaluate its
factorial and then finally print the result in the format: “The factorial
of the <number> is <factorial value>” His code is having errors.
Rewrite the correct code and underline the corrections made.
f = 0
num = input(“Enter a number: ”)
n = num
while num > 1 :
f = f * num
num - = 1
else :
print (“The factorial of: ”, num , “is”, f) 2
23 Predict the output of the following: 2
for i in range (1, 15, 2):
temp = i
if i % 3 = = 0:
temp = i + 1
elif i % 5 = = 0:
continue
elif i = = 11:
break print(temp, end = ‘$’)
24 If L = [3,5,2,7,8,12,2,19] and L1 = [4,6,3,2,7,12,9] then 2
(i) (A) Write a statement to merge both the lists.
OR
(B) Write a statement to sort the elements in place of list L.
(ii) (A) Write a statement to get a new list SL with the elements
of L1 in descending order.
OR

[P.T.O.]
AS-07 6
(B) Write a statement to insert the last element of list L1 in the
list L at 5th index.
25 Identify the correct output(s) of the following code. Also write
the minimum and the maximum possible values of the variable
b.
import random
a=”Wisdom”
b=[Link](1,6)
for i in range(0,b,2):
print(a[i],end=’#’)
(A) W# (B) W # i #
(C) W # s # (D) W # i # s #
26 What is the difference between primary key and alternate key? Give
example of each. 2
27 (i) (A) Write the command to add a column Percentage in the table
Marks. Where the data should be entered as decimal number i.e. 78.3
OR
(B) Write the constraint that will provide value to a column if no
value is inserted in that column.
(ii) (A) Write the command to change the name of a column from
Comm to Commission in the table Product.
OR
(B) Write the constraint that will allow null value but not duplicate
values in the column of a table.
28 Write the full form of the following: 2
(i) SMTP (ii) VOIP
SECTION-C ( 3 X 3 = 9 MARKS)
29 (A) Write a function uld_count() that will display the counting of all
the upper case alphabets, lower case alphabets and digits from a
text file “[Link]”. 3

[P.T.O.]
7 AS-07
For ex – if Para. txt contains the following content
He lives in AB-66, AB Type Quarters.
Then the function should display:
Upper case alphabets – 7
Lower case alphabets – 18
Digits - 2
OR
(B) Write a method/function countwords() in Python to read
contents from a text file ‘[Link]’ to count and return
the occurrence of those worlds which are having 5 or more
characters.
For ex -if [Link] content is :
These days I am reading a motivational book.
The method/function should display
The words having 5 or more characters are 3.
30 (A) A dictionary, d_city contains the records in the following format:
{state:city} 3
Define the following functions with the given specifications:
(i) push_city(d_city) : It takes the dictionary as an argument
and pushes all the cities in the stack CITY whose states are
of more than 4 characters.
(ii) pop_city(): this function pops the cities and displays “Stack
empty” when there are no more cities in the stack.
(iii) peep(d_city) : This function displays the topmost element of
the stack without deleting it. If the stack is empty the function
should display ‘None’.
OR
(B) You have a stack named BooksStack that contains records of
books. Each book record is represented as a list containing
book_title, author_name, and publication_year. Write the
following user-defined functions in Python to perform the
specified operations on the stack BooksStack:
[P.T.O.]
AS-07 8
(I) push_book(BooksStack, new_book): This function
takes the stack BooksStack and a new book record
new_book as arguments and pushes the new book
record onto the stack.
(II) pop_book(BooksStack): This function pops the
topmost book record from the stack and returns it. If the
stack is already empty, the function should display
“Underflow”.
(III) peep(BookStack): This function displays the topmost
element of the stack without deleting it. If the stack is
empty, the function should display ‘None’.
31 Consider the following table:
TABLE : RENT_CAB
Vcode VName Make Color Charges
101 Big car Carus White 15
102 Small Car Ploestar Silver 10
103 Family car Windspeed Black 20
104 Classic Studio White 30
105 Luxury Trona Red 9
Based on the given table, write SQL queries for the following:
(A)
(i) Count the number of cars of different colors.
(ii) Display all the details in the descending order of charges.
(iii) Display the vcode, vname of the cars whose make has letter
‘o’ in their name.
OR
(B) (i) Increase the charges of all the cabs by 10%.
(ii) Delete all the cabs whose maker name is ‘Carus’
(iii) Display the sum of charges of all cars color-wise.
SECTION-D ( 4 X 4 = 16 MARKS)

[P.T.O.]
9 AS-07
32 (A) (i) Explain Catching exceptions using try and except block.
(ii) Give an example code to handle ZeroDivisionError using try
and except block. The code should display the message
“Denominator can’t be zero” in case of ZeroDivisionError
exception, and the message “Some other error occurred” in
case of any other exception.
OR
(B) (i) When is IOError exception raised in Python?
(ii) Give an example code to handle IOError using try and except
block. The code should display the message “File not found”
in case of IOError exception, and the message “Some other
error occurred” in case of any other exception. 4
33 Mr. Mahesh is a Python programmer working in a school. He has
to maintain the records of the sports students. He has created a
csv file named [Link] to store the details. The structure of
[Link] is :[sport_id, competition, prize_won]
Where sport_id is sport id (integer)
Competition is competition name (string)
Prize_won is (“Gold”, “Silver”, “Bronze”)
Mr. Mahesh wants to write the following user defined functions:
Add_details(): to accept the details of student and add to a csv
file, “[Link]”.
Count_Medal(): to display the name the competitions in which
students have won “Gold_medal”.
Help him in writing the code of both the functions. 4
34 Consider the tables Games and Players given below: 4
TABLE GAMES
Gcode GameName Type Number Prize Money
101 Carrom Board Indoor 2 5000
102 Badminton Outdoor 2 12000
103 Table Tennis Indoor 4 Null
104 Chess Indoor 2 9000
105 Lawn Tennis Outdoor 4 25000
[P.T.O.]
AS-07 10
TABLE : PLAYERS
Pcode Name Gcode
1 Nabi Ahmad 101
2 Ravi Sahai 108
3 Jatin 101
4 Nazneen 103
Write SQL queries for the following:
(i) Display the game type and average number of games played
in each type.
(ii) Display prize money, name of the game and name of the
players from the tables games and players.
(iii) Display the type of games without repetition.
(iv) (A) Display the name of the games and prize money of those
games whose prize money is known.
OR
(B) To display the cartesian product of these two tables.
35 Sunil wants to write a function ADRecord() in Python to insert a
record and display the records of the items whose price is between
200 to 300 in the table named Stall in MySQL database named
Maintain .
The table Stall in MySQL contains the following attributes:
I_code: item code (integer)
I_name : name of item (string)
Quan : quantity of the item (integer)
Amount : price of item (integer)
Consider the following to establish connectivity between Python and
MySQL:
Username – Administrator
Password – market
Host – localhost
SECTION-E (2 X 5 = 10 MARKS)
36 Rakesh is working in an educational Institute. He needs to manage
the records of various students. For this he wants the following
[P.T.O.]
11 AS-07
information of each student to be stored:
Student_id – integer
student_Name – string
Father_name – string
Percentage – float
You, as a programmer of the institute, have been assigned to do
this job for Rakesh. Suggest:
(I) What type of file (text file, csv file, or binary file) will you use
to store this data? Give one valid reason to support your
answer.
(II) Write a function to input the data of a student and append it
in the file that you suggested in part (I) of this question.
(III) Write a function to read the data from the file that you
suggested in part (I) of this question and display the data of
all those students whose percentage is more than 85. 5
37 Logistic Technologies Ltd. is a Delhi based organisation which is
expanding its office set-up to Ambala. At Ambala office campus,
they are planning to have 3 different blocks for HR, Accounts and
Logistics related work. Each block has a number of computers,
which are required to be connected to a network for communication,
data and resource sharing.

Ambala Office

Delhi HR Block Accounts Block


Head Office

Logistics Block

As a network consultant, you have to suggest the best network


related solutions for them for issues/problems raised in (i) to (v),
keeping in mind the distances between various block/ locations and
other given parameters.

[P.T.O.]
AS-07 12
Distance between various blocks/locations:
HR block to Accounts blocks 400 meters
Accounts block to Logistics block 200 meters

Logistics block to HR block 150 meters


Delhi head office to Ambala office 220 km
Number of computers installed at various blocks are as follows:
HR block 70
Accounts block 40
Logistics block 30
(i) Suggest the most appropriate block/location to house the
SERVER in the Ambala office. Justify your answer.
(ii) Suggest the best wired medium to efficiently connect various
blocks within the Ambala office compound.
(iii) Draw an ideal cable layout (block to block) for connecting
these blocks for wired connectivity.
(iv) The company wants to schedule an online conference
between the managers of Delhi and Ambala offices. Which
protocol will be used for effective voice communication over
the Internet?
(v) (A) Which kind of network (PAN, LAN, MAN, WAN) will it be
between Delhi office and Ambala office?
OR
(B) Is there a requirement of a repeater in the given cable layout?
Why/ Why not?

[P.T.O.]
3 AS-07

[P.T.O.]
KENDRIYA VIDYALAYA SANGATHAN, HYDERABAD REGION
FIRST PRE-BOARD EXAMINATION (2024 - 25)
Class: XII Time: 3hrs
Subject: COMPUTER SCIENCE (083) Max Marks: 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 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 04 Short Answer type questions carrying 03 marks each.
6. Section D has 02 Long Answer type questions carrying 04 marks each.
7. Section E has 03 questions carrying 05 marks each.
8. All programming questions are to be answered using Python Language only.
SECTION-A
S. Question Marks
No
1 What is the return type of function id? 1
a) int b) float c) bool d) dict
2 What error occurs when you execute the following statement? 1
apple = mango
a) SyntaxError b) NameError c) ValueError d) TypeError
3 Carefully observe the code and give the answer. 1
def example(a):
a = a + '2'
a = a*2
return a
>>>example("hello")
a) indentation Error b) cannot perform mathematical operation on
strings
c) hello2 d) hello2hello2
4 Aryan created a table(Students) with 5 rows and 6 columns. After few days 1
based on the requirement he added 3 more rows to the table. What is the
cardinality and degree of the table?
a) cardinality=6,degree=8 b) cardinality=8,degree=6
c) cardinality=5 degree=8 d) None of the above
5 What is the output of the following? 1
print("xyyzxyzxzxyy".count('xyy', 0, 100))
a) 2 b) 0 c) 1 d) error
6 What is the output of the below program? 1
def func(a, b=5, c=10):
print('a is', a, 'and b is', b, 'and c is', c)
func(3, 7)
func(25, c = 24)
func(c = 50, a = 100)
a) a is 7 and b is 3 and c is 10
a is 25 and b is 5 and c is 24
a is 5 and b is 100 and c is 50
b) a is 3 and b is 7 and c is 10
a is 5 and b is 25 and c is 24
a is 50 and b is 100 and c is 5
c) a is 3 and b is 7 and c is 10
a is 25 and b is 5 and c is 24
a is 100 and b is 5 and c is 50
d) None of the mentioned
7 Which of the following statements are true? 1
a) When you open a file for reading, if the file does not exist, an error occurs
b) When you open a file for writing, if the file does not exist, a new file is created
c) When you open a file for writing, if the file exists, the existing file is
overwritten with the new file
d) All of the mentioned
8 Which of the following is equivalent to [Link](3, 6)? 1
a) [Link]([3, 6]) b) [Link](3, 6)
c) 3 + [Link](3) d) 3 + [Link](4)
9 Entries in a stack are “ordered”. What is the meaning of this statement? 1
a) A collection of stacks is sortable
b) Stack entries may be compared with the ‘<’ operation
c) The entries are stored in a linked list
d) There is a Sequential entry that is one by one
10 Bridge works in which layer of the OSI model? 1
a) Application layer b) Transport layer
c) Network layer d) Data link layer
11 SMTP stands for 1
a) sample mail transfer protocol b) simple message transportation protocol
c) simple mail transfer protocol d) synchronous message transmit protocol
12 Which of the following statement will reverse the list L1? 1
a)L1[::1] b)L1[-1::-1] c)L1[::-1] d)None of the above
13 Out of one or more candidate keys, the attribute chosen by the database 1
designer to uniquely identify the tuples in a relation called______ of that
relation.
a)primary key b)foreign key c)composite primary key d)alternate key
14 The loop else statement is executed when 1
a)the for loop is executed for the last value in the sequence
b)the while loop test condition evaluates to false
c)both a and b
d)none of the above
15 Hub decreases the traffic in the network whereas switch increases the traffic in 1
the network. (Ture/False)
16 Which of the following expressions evaluates to False? 1
a) not(True) and False
b) True or False
c) not(False and True)
d) True and not(False)

17 Which of the following is an invalid identifier? 1


(a)_123 (b) E_e12 (c) None (d) true
18 Which of the following is a DML command? 1
(a) DROP (b) INSERT (c) ALTER (d) CREATE
19 Which aggregate function can be used to find the cardinality of a table? 1
a) sum()
b) count()
c) avg()
d) max()

20 Assertion(A):Python uses immutable types for call by value mechanism 1


Reason (R):in the call by value mechanism, the called function makes a
separate copy of passed values and then works with them.
a) Both A and R are wrong b)A is wrong, but R is right
c)A is right, but R is wrong d)Both A and B are Right
21 Assertion (A): Python automatically flushes the file buffers before closing a 1
file with close () function.
Reason (R): when you open an existing file for writing, it adds the content at
the end of the file.
a) Both A and R are wrong b)A is wrong, but R is right
c)A is right, but R is wrong d)Both A and B are Right
SECTION-B
22 Write the output given by following Python code. 2
x=1
def fun1():
x=3
x=x+1
print(x)

def fun2():
global x
x=x+2
print(x)
fun1()
fun2()
OR
What do you mean by default parameters? Explain with the help of suitable
example.
23 (i) Write the SQL statement to add a field Country_Code(of type Integer) to 1+1
the table Countries with the following fields.
Country_id, Country_name, Continent, Region_id
(ii) Which of the following is not a DML command?
DELETE FROM, DROP TABLE, CREATE TABLE, INSERT INTO
24 What are the possible outcome(s) executed from the following code? Also 2
specify the maximum and minimum values that can be assigned to variable N.
import random
SIDES=["EAST","WEST","NORTH","SOUTH"]
N=[Link](1,3)
OUT=""
for I in range (N,1, –1):
OUT=OUT+SIDES[I]
print (OUT)

(i) SOUTHNORTH
(ii) SOUTHNORTHWEST
(iii) SOUTH
(iv) EASTWESTNORTH
25 Write two points of difference between Bus Topology and Tree Topology. 2

OR
Write two points of difference between Packet Switching and Circuit
Switching techniques?

26 2

Write the output of the queries (a) to (d) based on the table SCHOOLADMIN
given above:
a) SELECT max (DOB) FROM SCHOOLADMIN;
b) SELECT Name FROM SCHOOLADMIN WHERE STREAM<>"Business
Admin" AND SECTION IS NULL;
c) SELECT count (NAME) FROM SCHOOLADMIN WHERE SECTION IS
NOT NULL;
d) SELECT count (NAME) FROM SCHOOLADMIN WHERE SECTION IS
NOT NULL AND STREAM="FINE ARTS";
27 Rewrite the following Python program after removing all the syntactical errors 2
(if any), underlining each correction:
def checkval:
x = input(“Enter a number”)
if x % 2 = 0:
print x,”is even”
else if x<0:
print x,”should be positive”
else;
print x,”is odd”
28 (a) What is the output produced by the following code – 2
d1={“b”:[6,7,8],”a”:(1,2,3)}
print([Link]())
a) { (1,2,3) , [6,7,8] }
b) [[6,7,8],(1,2,3)]
c)[6,7,8,1,2,3]
d) (“b”, “a”)
(b) What is the output of given program code:
list1 = range(100,110)
print( [Link](105))
(a) 4 (b) 5 (c) 6 (d) Error
SECTION-C
29 (a)Write a function in python to count the number of lines in “[Link]” that 3
begins with Upper case character.
OR
Write a function in python to read lines from file “[Link]” and count how
many times the word “INDIA” exists in file.
30 Write a function in Python PUSH(Num), where Num is a list of integer 3
numbers. From this list push all positive even numbers into a stack implemented
by using a list. Display the stack if it has at least one element, otherwise display
appropriate error message.
OR
Write a function in Python POP(cities), where cities is a stack implemented by
a list of city names for eg. cities=[‘Delhi’, ’Jaipur’, ‘Mumbai’, ‘Nagpur’]. The
function returns the value deleted from the stack.
31 (a)Sonal needs to display name of teachers, who have “0” as the third 1+2
character in their name. She wrote the following query.
SELECT NAME FROM TEACHER WHERE NAME = “$$0?”;
But the query is’nt producing the result. Identify the problem.

(b)Write output for (i) & (iv) based on table COMPANY and CUSTOMER.
[Link] COUNT(*) , CITY FROM COMPANY GROUP BY CITY;
[Link] MIN(PRICE), MAX(PRICE) FROM CUSTOMER WHERE
QTY>10;
[Link] AVG(QTY) FROM CUSTOMER WHERE NAME LIKE “%r%;
[Link] PRODUCTNAME, CITY, PRICE FROM COMPANY,
CUSTOMER
[Link] [Link]=[Link] AND
PRODUCTNAME=”MOBILE”;
32 Write a function EVEN_LIST(L), where L is the list of elements passed as 3
argument to the function. The function returns another list named ‘evenList’
that stores the indices of all even numbers of L.
For example:
If L contains [12,4,3,11,13,56]
The evenList will have - [0,1,5]
SECTION-D
33 Write a python program to create a csv file [Link] and write 10 records in it 4
with the following details: Dvdid, dvd name, qty, price.
Display those dvd details whose dvd price is more than 25.
34 Consider the tables below to write SQL Queries for the following: 4
[Link] display TEACHERNAME, PERIODS of all teachers whose periods are
more than 25.
[Link] display all the information from the table SCHOOL in descending order
of experience.
iii. To display DESIGNATION without duplicate entries from the table
ADMIN.
iv. To display TEACHERNAME, CODE and corresponding DESIGNATION
from tables SCHOOL and ADMIN of Male teachers.
SECTION-E
35 Perfect Edu Services Ltd. is an educational organization. It is planning to setup 5
its India campus at Chennai with its head office at Delhi. The Chennai campus
has 4 main buildings – ADMIN, ENGINEERING, BUSINESS and MEDIA.

You as a network expert have to suggest the best network related solutions for
their problems raised in (i) to (v), keeping in mind the distances between the
buildings and other given parameters.

(i) Suggest the most appropriate location of the server inside the
CHENNAI campus (out of the 4 buildings), to get the best connectivity for
maximum no. of computers. Justify your answer.
(ii) Suggest and draw the cable layout to efficiently connect various
buildings within the CHENNAI campus for connecting the computers.
(iii) Which hardware device will you suggest to be procured by the
company to be installed to protect and control the internet uses within the
campus?
(iv) Which of the following will you suggest to establish the online face-to-
face communication between the people in the Admin Office of CHENNAI
campus and DELHI Head Office?
(a) Cable TV
(b) Email
(c) Video Conferencing
(d) Text Chat
(v)Name protocols used to send and receive emails between CHENNAI and
DELHI office?
36 A binary file “[Link]” has structure [ITEMID, ITEMNAME, 5
QUANTITY, PRICE].
(i) Write a user defined function MakeFile( )to input data for a record and add
to [Link].
(ii) Write a function GetPrice(ITEMID) in Python which accepts the ITEMID
as parameter and return PRICE of the Item stored in Binary file
[Link].
OR
A binary file “[Link]” has structure (EMPID, EMPNAME,
SALARY).
Write a function CountRec( )in Python that would read contents of the file
“[Link]” and display the details of those Employees whose Salary
is above 20000. Also display number of employees having Salary more than
20000.
37 (a)Write the outputs of the SQL queries (i) to (iii) based on relations EMP and 2+3
DESIG given below:
Table: EMP
E_ID Name Gender Age DOJ Designation
1 Om Prakash M 35 10/11/2009 Manager
2 Jai Kishan M 32 12/05/2013 Accountant
3 Shreya Sharma F 30 05/02/2015 Clerk
4 Rakesh Minhas M 40 15/05/2007 Manager
5 Himani Singh F 33 19/09/2010 Clerk

Table: DESIG
Salary E_ID DEPT_ID
45000 1 D101
35000 2 D102
45000 4 D101
(i) SELECT Designation, count(*) FROM EMP GROUP BY Designation;
(ii) SELECT AVG(Age) FROM EMP;
(iii) [Link],[Link],[Link] FROM EMP,DESIG
WHERE EMP.E_ID = DESIG.E_ID AND [Link]>35;

(b)Preety has written the code given below to read the following record from
the table named employee and displays only those records who have salary
greater than 53500:
Empcode – integer
EmpName – string
EmpSalary – integer

Note the following to establish connectivity between Python and MYSQL:


• Username is root
• Password is root@123
• The table exists in a MYSQL database named management.
Write the following missing statements to complete the code:
Statement 1 – to form the cursor object
Statement 2 – to execute the query that extracts records of those employees
whose salary are greater than 53500.
Statement 3- to read the complete result of the query (records whose salary are
greater than 53500) into the object named data, from the table employee in the
database.
import [Link] as mysql
def sql_data():
con1=[Link](host="localhost",user="root",password="root@123",
database="management")
mycursor=_______________ #Statement 1
print("Employees with salary greater than 53500 are : ")
_________________________ #Statement2
data=__________________ #Statement 3
for i in data:
print(i)
print()

*****END*****
KENDRIYA VIDYALAYA SANGATHAN HYDERABAD REGION
FIRST PRE-BOARD EXAMINATION 2024-25
CLASS: XII TIME:03 HOURS
SUBJECT: COMPUTER SCIENCE MAX. MARKS: 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.
SECTION-A
1 Which of the following data type in Python supports concatenation? 1
(A) int (B) float (C) bool (D) str
2 Identify the output of the following code snippet: 1
text = "PYTHONROCKS"
text = [Link]('RO', '#')
print(text)
(A) PY#CKS (B) PY#KS (C) PYTHON#CKS (D) PYTH#KS
3 Evaluate the following expression 1
print(10 + 3 * 2**3 // 4 - 5 or 7 and 9)
(A) 9 (B) 11
(C) 15 (D) 7
4 Consider the following statements and choose the correct output from the given 1
options:
EXAM="COMPUTER SCIENCE"
print(EXAM[:12:-2])
(A) EN (B) CI (C)SCIENCE (D) ENCE
5 In MYSQL database, if a table, Alpha has degree 5 and cardinality 3, and another 1
table, Beta has degree 3 and cardinality 5, what be the degree and cardinality of
the Cartesian product of Alpha and Beta?
A. 5,3 B. 8, 15 C. 3, 5 D. 15, 8
6 Which of the following is not a Tuple in Python? 1
(A) (1, 2, 3) (B) (“One”, “Two”, “Three”) (C) (10) (D) (“One”,)
7 A Dictionary d={'sprint':'autumn','autumn':'fall','fall':'spring'} is created. Which of 1
the following statement prints output as fall
(A) d['autumn'] (B) d.'autumn' (C) d['sprint'] (D) d. 'sprint'
8 Consider the statements given below and then choose the correct output from the 1
given options:
pride="#G20 Presidency"
print(pride [-2:2:-2])
A. ndsr B. ceieP0 C. ceieP D. yndsr
9 __________ is a non-key attribute, whose values are derived from the primary key 1
of some other table.
(A) Primary Key (B) Candidate Key (C) Foreign Key (D) Alternate Key
10 Which of the following functions changes the position of file pointer and returns 1
its new position?
(A)flush() (B)tell() (C)seek() (D)offset()
11 With respect to exception handling, how many except blocks a try block can have? 1
(A) 1 (B) >=0 (C) 2 (D) no such block exists.
12 Which of the following function header is correct? 1
A. def fun(a=1,b): B. def fun(a=1,b,c=2):
C. def fun(a=1,b=1,c=2): D. def fun(a=1,b=1,c=2,d):
13 Which of the following commands is not a DDL command? 1
(A) DROP (B) DELETE (C) CREATE (D) ALTER
14 Which SQL statement correctly retrieves the names of employees who earn more 1
than the average salary?
A. SELECT name FROM employees WHERE salary > AVG(salary);
B. SELECT name FROM employees HAVING salary > AVG(salary);
C. SELECT name FROM employees WHERE salary > (SELECT AVG(salary)
FROM employees);
D. SELECT name, AVG(salary) FROM employees GROUP BY name;
15 Suggest the suitable command to remove the pre-existing database named Clients. 1
(A) delete database Clients (B) drop Clients
(C) drop database Clients (D) Alter table drop Clients
16 Which SQL aggregate function is used to count the number of unique values in a 1
column?
A. COUNT(*) B. COUNT(DISTINCT Col Name)
C. DISTINCT(COUNT Col Name) D. COUNT(UNIQUE Col Name)
17 The __________ is a protocol used to send emails from a client to a server. 1
A. POP3 B. IMAP C. SMTP D. HTTP
18 A network device that connects dissimilar networks is-------- 1
a) Modem b) Switch c) Bridge d) Gateway
19 ___________ command is used to add a new column in a table in SQL 1
(A) update (B) remove (C) alter (D)drop
Q20 and 21 are ASSERTION AND REASONING based questions. Mark the correct
choice as

(a) Both A and R are true and R is the correct explanation for A 4
(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): Default arguments in Python functions must be defined after all 1
required arguments.

Reasoning (R): Default arguments provide a fall back value when no argument is
provided.

21 Assertion (A): An SQL SELECT statement can have both WHERE and ORDER 1
BY clauses.

Reasoning (R): WHERE filters data, and ORDER BY sorts it.


SECTION-B
22 Your Vidyalaya decided to conduct Solo singing competition. CCA in charge wants 2
to store the admission numbers of the participants. Help your CCA in charge in
choosing the correct/suitable data structure (data type) in Python for the following.
a) To store all the admission numbers of the registered candidates. May get
changed any time till completion of registration process.
b) To store the admission numbers of all the winners which never gets changed.
23 Give two examples of each of the following: 2
A. Logical operators B. Membership operators
24 (a)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)
(b) 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)
25 Identify the correct output(s) of the following code. Also write the possible values 2
for variable R.
import random
signal= [‘RED’,’YELLOW’,’GREEN’]
for k in range (2, 0,-1):
R=[Link](k)
print((signal[R], end=’#’)

(A) YELLOW # RED # (B) RED # GREEN #


(C) GREEN # RED # (D) YELLOW # GREEN #
26 Rahul has written a code to input a number and return its reverse. His code is 2
having errors. Rewrite the correct code and underline the corrections made.
defreverse()
n=int(input("Enternumber::") rev=0
while(num>0):
r=num%10
rev=rev*10+r
num=num//10
return rev
27 Satheesh has created a database “school” and table “student” and help him to 2
write SQL queries for the following
A) i). To view all the databases. .
OR
ii). To view the structure of the table student.
B) i). To add the new column PhoneNo of datatype integer to the table student
OR
ii). To find the cardinality of the table student.
28 (A) Define the term web hosting? 2
(OR)
(B) Expand the following terms and mention their purpose
i. POP ii. VoIP
SECTION-C
29 Write a Python function that counts and displays the number of words in a text file 3
called "[Link]".
OR
Write a Python function that reads a text file "[Link]" and displays all the lines
that contain the word "success".
30 A ) list, NList contains following record as list elements: 3
[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.
• 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.
• 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.
OR
(B)
• 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`.
• 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'.

31 (a)Predict the output of the following code: 3


S = "LOST"
L = [10, 21, 33, 4]
D={}
for I in range(len(S)) :
if I%2==0:
D[[Link]()] = S[I]
else:
D[[Link]()] = I+3
for K, V in [Link]() :
print (K,V, sep="*"*)
(OR)
Predict the output of the following code:
line=[4,9,12,6,20]
for I in line:
for j in range(1,I%5):
print(j,’#’,end=””)
print()
SECTION-D
32 Consider the following table DOCTOR given below and write the output of the 4
SQL Queries that follows :
D_ID D_NAME D_DEPT GENDER EXPERIENCE
101 JOSEPH ENT MALE 10
104 GUPTA MEDICINE MALE 12
106 SUMAN ORTHO FEMALE 7
111 HANEEF ENT MALE 12
123 DEEPTI CARDIOLOGY FEMALE 6
132 VEENA SKIN FEMALE 12
i) SELECT D_NAME FROM DOCTOR WHERE
GENDER=’MALE ‘AND EXPERIENCE=12 ;
ii) SELECT DISTINCT(D_DEPT) FROM DOCTOR ;
iii) SELECT D_NAME , EXPERIENCE FROM DOCTOR ORDER BY
EXPERIENCE ;
iv) SELECT COUNT(*) FROM DOCTOR WHERE GENDER=’MALE’;
OR
i) Write a query to how many doctors in each department
ii) Write a query to display the names of doctors who have more 10 Years
experience.
iii) Write a query to display the details of Female Doctors.
Write a query to change [Link] department to ENT
33 A CSV file "[Link]" contains the data collected from various weather 4
stations. Each record in the file includes the following data:

• Name of the city


• Average temperature (in Celsius)
• Humidity percentage
• Rainfall (in millimeters)

For example, a sample record in the file might look like: ['Rainford', 32,
75, 120]

Write the following Python functions to perform the specified operations on this
file:

1. Read all the data from the file in the form of a list and display all those
records where the average temperature is above 30 degrees Celsius.
Calculate and display the average rainfall across all records in the file.
34 Consider the following tables STUDENT and ST-HOUSE. 4
Table : STUDENT Table : ST-HOUSE
Class Sec Rno Sname House Hid Hname HMaster
3 A 1 ROHAN H03 H01 GANGA VACHASPATHI
12 C 5 PALLAVI H04 H02 YAMUNA MADHURI
9 D 12 KIRAN H03 H03 NARMADA MURALI
11 A 6 SAMPATH H02 H04 KAVERI SRIHARI
Write SQL Queries for the following.
i) Display class, section and name of all students belong to NARMADA
house.
ii) Display the number of students present in the student table.
iii) Display names of students in the descending order of names.
iv) a) Remove all students of section A
(OR)
b) Write SQL query to add a new column to ST-HOUSE table named Hmember
of
Varchar type with size 20.
35 Raman has created table named NATIONALSPORTS in MYSQL database, 4
SPORTS :
Each record contains the following fields:
∙ GameID(Game number )- integer
∙ Gamename(Name of game) - string
∙ DOG(Date of Game) – Date
∙ Venue(Venue of game) – decimal
Note the following to establish connectivity between Python and MySQL:
∙ Username - root
∙ Password – KVR@321
∙ Host – localhost

Raman , now wants to display all records of venue “Hyderabad”. Help him to
write the python program.
SECTION-E
36 Mayank is a manager working in a retail agency. He needs to manage the records 5
of various customers. For this, he wants the following information of each
candidate to be stored:
- Customer_ID – integer
- Customer_Name – string
- Address – string
- Receipt no-integer
You, as a programmer of the company, have been assigned to do this job for
Mayank.
(i) Write a function to input the data of a customers and append it in a
binary file.
(ii) Write a function to update the data of customers whose receipt no is 101
and change their address to "Secunderabad".
(iii)Write a function to read the data from the binary file and display the data
of all those candidates who are not belong to Secunderabad.
37 CITY CABLE NETWORK has set up its new centre at HYDERABAD for its 5
office and web based activities. It has four buildings as shown in the diagram
below:
A B

C D
Number of Computers
Block A 25

Block B 50

Block C 125

Block D 10

Center to center distances

Black A to Block B 50 m

Block B to Block C 150 m

Block C to Block D 25 m

Block A to Block D 170 m

Block B to Block D 125 m

Block A to Block C 90 m

(i) Which type of network is this 1


a)LAN b)PAN c)WAN d)TAN
(ii) Suggest a cable layout of connections between the blocks. 1
(iii) Suggest the most suitable place (i.e. block) to house the server of this organisation 1
with a suitable reason.
(iv) Suggest the placement of the following devices with justification 1
▪ Repeater
▪ Hub/Switch
(v) A)The organization is planning to link its front office situated in a far city in a 1
hilly region where cable connection is not feasible, suggest a way to connect it
with reasonably high speed?
OR
B)To protect the network from unauthorized access which device/software should
be installed ?

------All The Best-----


KENDRIYA VIDYALAYA SANGATHAN: JABALPUR REGION
FIRST PRE-BOARD (2024-25)
CLASS: XII Time allowed: 3 Hours Maximum Marks:70
COMPUTER SCIENCE (083-THEORY)

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 carries1 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=21Marks) Marks

1. State-True or false:
Python interpreter handles semantic errors during code execution. (1)
2. (A) Which of the following will return False:
(B) A) not (True and False) B) True or False (1)
(C) C) not (True or False) D) not (False and False)
3. (A) Which of the following function will help in converting a string to list with
elements separated according to delimiter passed? (1)
(D) A) list( ) B) split( ) C) str( ) D) shuffle( )
4. What is the output of the following?
OCEANS=('pacific','arctic','Atlantic','southern') (1)
print(OCEANS[4])
A) ‘southern’ B) (‘southern’) C) Error D) INDEX
5. What is the output of the following (1)
x="Excellent day"
print(x[1::3])
A) x B) xlnd C) error D) dnlx
6. What can be the possible output of the following code:
def Element(x):
z=""
for y in x:
if not [Link]():
z=z+[Link](y) (1)
print(z)
Element("W2e0Py2th4n") #Function Call
A) 2 B) 02 C) 024 D) 2024
7. If D={‘Mobile’:10000, ‘Computer’:30000, ‘Laptop’:75000} then which of the
following command will give output as 30000
A) print(D) B) print(D['Computer'])
C) print([Link]( )) D)print([Link]( )) (1)

1
8. Which of the following is not correct?
(A) del deletes the list or tuple from the memory
(B) remove deletes the list or tuple from the memory (1)
(C) pop is used to delete an element at a certain position
(D) pop(<index>) and remove(<element>) performs the same operation
9. A relation in a database can have _____ number of primary key(s)?
A) 1 B) 2 C) 3 D) 4 (1)
10. What is the value of ‘p’ and how many characters will be there in the variable
‘data’ in the following statement (1)
with open ("[Link]","r",encoding="utf-8") as F:
data = [Link](100)
p=[Link](10,0)
print(p)
A) 10, 100 B) 100, 10 C) 10, 110 D) 110, 10
11. Write the name of block / command(s) can be used to handle the error/exception in (1)
Python.
12. What will be the output of the following code?
def add():
c=1
d=1
while(c<9):
c=c+2 (1)
d=d*c
print(d, end="$")
return c
print(add( ),end="*")

A) 945$9* B) 945$9 C) 9*945$ D) 9$945*


13. Which type of command is used to delete the structure of the relation? (1)
A) DDL B) DML C) Select D) Cannot delete structure
14. What will the following query show?
(considering a table student with some columns)
SELECT * FROM students WHERE age in (17,19,21);
A) Show tuples of students table with all the age values from 17 to 21 (1)
B) Show tuples of students table only with the age values 17,19,21
C) Show tuples of students table only with the age values other then 17,19,21
D) Show tuples of students table with all the age values outside the range 17 to 21
15. Which of the following is not a data type in Python
A) date B) string C) tuple D) float (1)
16. Which of the following is not an aggregate function?
A) max( ) B) count( ) C) sum( ) D) upper( ) (1)
17. Which of the following protocol helps in e-mail services?
A) FTP B) PPP C) UDP D) MIME (1)
18. In order to cover a long-distance network which of the following device will be (1)
helpful?
A) Modem B) Gateway C) Switch D) Repeater
19. What is SIM & GPRS? (1)
A) Small Information Machine & Global People Research and Science
B) Subscriber Identity Module & General Packet Radio Service
C) Subscriber Information Module & General Public Radio Shrive
D) None of these

2
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 a relation of RDBMS, redundancy can be reduced.


Reasoning (R): This can be done with the help of join operations in between
relation. (1)
21. Assertion (A): A function in Python can have any number of arguments.
Reasoning(R): variable length parameter can be used to deal with such number of
arguments. (1)
Q No Section-B (7x2=14 Marks) Marks
22. a) Explain dictionary with example?
b) What is the data type of (i) x=10 (ii) x=10,20 (2)
23. Explain ‘in’ operator and write a small code in Python to show the use of ‘in’ (2)
operator.
24. Consider T=(10,20,30) and L=[60,50,40] answer the question I and II (1)
(I) Write command(s) to add tuple T in list L.
OR
Write command to find and delete element 20 from tuple T
(II) Write command to add 50 in L at position 2. (1)
OR
Write command to delete the variable T.
25. Identify the correct output(s) of the following code and write the minimum and the
maximum possible values of the variable b.
import random
a="ComputerScience"
I=0
while (I<3):
b=[Link](1,len(a)-1) (2)
print(a[b],end='$')
I+=2

A) C$m$ B) m$p$ C) c$n$ D)c$e$c$


26. Write a function named RECORDS() which can open a binary file named
‘[Link]’ containing the population data of all the districts of a state. The
function will ask for the name of the district to be searched in file and display its (2)
data from the file. [Note: Name of dist. is stored at 0 index of record in [Link]]
27. [I]
A) Benjamin a database administrator created a table with few columns. He
wants to stop duplicating the data in the table. Suggest how he can do so.
OR
B) Consider two tables student (rno, name, class) and marks (rno, mrk_obt,
percent). You as a database administrator how will your stop redundancy of
data in the table students and how the tables students and marks can be
connected with each other (2)
[II]
A) Write an SQL command to change the data type of a column named price
to number (10,2) in a table named stationary
OR
3
B) Write an SQL command to change the values of all the rows of the column
price of table stationary to Null
28. A) Difference between star and mesh topology.
OR (2)
B) Write the full forms of (i) VoLTE (ii) GSM

Q No. Section-C(3x3=9Marks) Marks


29. A) Write a Python function that displays all the words starting from the letter ‘C’
in the text file "[Link]".
OR (3)
B) Write a Python function that can read a text file and print only numbers stored
in the file on the screen (consider the text file name as "[Link]").
30. A) You have a stack named Inventory that contains records of medicines. Each
record is represented as a list containing code, name, type and price.
Write the following user-defined functions in Python to perform the specified
operations on the stack Inventory:
i. New_In (Inventory, newdata): This function takes the stack Inventory and
newdata as arguments and pushes the newdata to Inventory stack.
ii. Del_In(Inventory): This function removes the top most record from the
stack and returns it. If the stack is already empty, the function should
display "Underflow".
iii. Show_In(Inventory): This function displays the topmost element of the (3)
stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
B) Write the definition of a user-defined function `Push(x)` which accepts a string
in parameter `x` and pushes only consonants in the string `N` into a Stack named
`Consonants`.
Write function Display () to display all element of the stack.

For example: x = “Python”


Then the stack `Consonants’ should store: [‘P’,’y’,’t’,’h’,’n’]
31. Predict the output of the following code:
d={}
V="programs"
for x in V: (3)
if x in [Link]():
d[x]=d[x]+1
else:
d[x]=1
print(d)
OR
Predict the output of the following code:
V="interpreter"
L=list(V)
L1=""
for x in L:
if x in ['e','r']:
L1=L1+x
print(L1)

4
Q No. Section-D( 4x4=16Marks) Marks
32. Consider the tables given below
Watches
Id Wname Price Type Qty
W01 High Time 1200 Common 75
W02 Life line 1600 Gents 150
W03 Wave 780 Common 240
W04 Timer 950 Gents 460
W05 Golden era 1760 Ladies 250
(4)
WSale
Wid QSold Qtr
W01 25 1
W02 23 1
W03 2 1
W04 10 2
W05 12 2
W03 22 3
W04 22 3
W02 23 3

“Note: Consider the table contains the above records.”


A) Write the queries for the following:
i) To display the total quantity sold (qsold) of wsale for qtr number 3.
ii) To display the details of watches in descending order of qty.
iii) To display the total quantity of watches.
iv) To display the wname and maximum qsold from the table watches and
wsale sold in qtr=1
OR
B) Write the output
i) Select sum(price) from watches;
ii) Select * from watched where wname '%e';
iii) Select sum(qty), type from watches group by type;
iv) Select wname, price, qtr from watches, wsold
where [Link] = [Link] and [Link]=’Common’;
33. A csv file "[Link]" contains the data collected from an online application form
for selection of candidates for different posts, with the following data
• Candidate Name
• Qualification (4)
• Percent_XII
• Percent_Qualification
E.g. [‘Smith Jones’, ‘M Tech’, 80, 76]
Write the following Python functions to perform the specified operations on this file:
a) READ() function which can read all the data from the file and display only records
with Percent_XII more than 75
b) IDENTIFY() function which can find and print the number of such records which are
having Percent_XII not more than 75
34. A school is maintaining the records of his departments and their in-charges in the
following table and wants to see the data according to the following conditions. Study
the following table and write the queries for (i) to (iii) and output for (iv)

Table: Departments

5
D_No D_name D_Incharge Date_join grant
D94 Physics Binny 12-10-2021 34000
D46 Chemistry Virat 24-12-2010 49500
D78 Biology Jimmy 10-05-2001 79000 (4)
D99 Geography Adams 05-09-2006 62000
D23 Primary Ajay 15-06-2009 Null

(i) To display complete details of those departments where date_join is less then
01-01-2010
(ii) To display the details of departments with the name of incharges containing
m in their name.
(iii) To increase the grant of department by 1200 of D_no either D99 or D23.
(iv) Select d_name, grant from department where grant is null;
OR
Select sum(grant) from department where date_join>’10-10-2020’;
35. Consider a database named ‘DB’ containing a table named ‘Vehicle’ with the following
structure
Field Type
Model char(10)
Make_year Int(4)
Qty Int(3) (4)
Price Number(8,2)

Write the following Python function to perform the following operation as mentioned:
1. Add_Vehicle() - which takes input of data and store it to the table
2. Search_vehicle() – which can search a model given by user and show it on screen
* Assume the following for Python – Database connectivity:
Host: localhost, User: root, Password: root
[Link]. SECTIONE(2X5=10 Marks) Marks
36. Rajiv Kumar is an owner of a company willing to manage the data of his office
employees like their biodata, salary centrally for all his offices located in the state of
Karnataka.
He planned to make a database named ‘company’ with the table ‘staff’ that contains
following structure
- ID–integer(4)
- Name–string(30)
- Designation–string(10)
- Birth_date–date
- Salary-decimal(10,2)

You as his database administrator write the following queries (I) to (IV)

(I) Create a table ‘staff’ with above structure and id as primary key. (2)
(II) Display all the records with designation ‘Sales Executive’ (1)
(III) To change the designation = ‘Assistant’ of all the staff having salary from (1)
15000 to 17000 (both values included)
(IV) To display the total number of records with name ending at letter ‘j’ (1)
37. PK International is an advertising agency who is setting up a new office in Gurgaon in
an area of 2.5 kms with four building Admin, Finance, Development, Organizers. You
have been assigned the task to suggest network solutions by answering the following
questions (i) to (v)

6
No. of computers in the building Distance between buildings
Admin 10 Admin-Finance 96
Finance 10 Admin-Development 58
Development 46 Admin-Organizers 48
Organizers 25 Finance-Development 42
(5)
Finance-Organizers 35
Development-Financers 40

Finance
Organizers

Development
Admin

i) Suggest the most appropriate location of the server inside the above campus.
Justify your choice.
ii) Which hardware device can be used to connect all the computers within each
building?
iii) Draw the cable layout for economic and efficiently connect various buildings
within the campus?
iv) Whether repeater is required for your given cable layout? Yes or No? Justify
your answer.
v) A) Give your recommendation for live visual communication between all the
offices and customer located in different cities
a) Video Conferencing
b) Email
c) Telephony
d) Instant Messaging
OR
B) What type of network (PAN, LAN, MAN or WAN) will be setup
among the computers connected in this campus?

7
केन्द्रीय विद्यालय सं गठन, कोलकाता सं भाग
KENDRIYA VIDYALAYA SANGATHAN, KOLKATA REGION
प्रथम प्री-बोर्ड परीक्षा / 1st PRE-BOARD EXAMINATION- 2024-25
कक्षा /CLASS- XII अविकतम अं क /MAX MARKS- 70
विषय /SUB- Computer Science (083) समय /TIME- 03 घं टे / Hours
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 (21 x 1 = 21 Marks) Marks

1. State True or False:


(1)
The Python interpreter generates compile time error if only try block is written
without any catch or finally block.
2. Identify the output of the following code snippet:
text = "copyPYTHON"
text=[Link]('PY','#')
print(text)
(1)
(A) co##THON (B) Copy#THON (C) NOHT#ypoc (D) copy#THON

3. What will the output of the following expression? 15/4*8//6


(1)
(A) 4.0 (B) 5 (C) 5.0 (D) 3.0
4. What is the output of the expression?
text='inspirational idea'
print([Link]('i'))
(1)
(A) ('', 'nsp', 'rat', 'onal ', 'dea')
(B) ['', 'nsp', 'rat', 'onal ', 'dea']
(C) ['nsp', 'rat', 'onal ', 'dea']
(D) {'nsp', 'rat', 'onal ', 'dea'}
5. What will be the output of the following code snippet?
msg="Viksit BHARAT" (1)
print(msg[-2::-2].capitalize())
(A) Aabtsi (B) AABTSI (C ) Vkt Baa (D) Error

Page: 1/10
6. What will be the output of the following code?
tuple1 = (1, 2, 3) tuple2 = tuple1
tuple1 += (4,)
print(tuple1 == tuple2)
(A) True (B) False (C) tuple1 (D) Error (1)
7. If my_dict is a dictionary as defined below, then which of the following
statements will raise an exception?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
(A) my_dict.get('orange') (1)
(B) print(my_dict['apple', 'banana'])
(C) my_dict['apple']=20
(D) print(str(my_dict))
The statement which is used to get the number of rows fetched by execute() method
8.
of cursor:
(A) [Link] (B) [Link]() (1)
(C) [Link]() (D) [Link]()

9. If a table which has one Primary key and two alternate keys. How many Candidate
(1)
keys will this table have?
(A) 1 (B) 2 (C) 3 (D) 4

10. Write the missing statement to complete the following code:


file = open("[Link]", "r")
data = [Link](100)
___________________#Move the file pointer to the beginning of the file (1)
next_data = [Link](50)
[Link]()

11. State whether the following statement is True or False:


(1)
A code can run without removing all the logical errors.

12. What will be the output of the following code?


c = 10
def add():
global c
c=c+2
print(c,end='#')
add() (1)
c=15
print(c,end='%')

(A) 12%15# (B) 15#12% (C ) 12#15% (D) 12%15#


13. All aggregate functions except _______ ignore null values in their input collection. (1)
(A) Count (attribute) (B) Count (*) (C) Avg (D) Sum

Page: 2/10
14. What will be the output of the query?
SELECT * FROM products WHERE product_name LIKE 'App%';
(A) Details of all products whose names start with 'App'
(B) Details of all products whose names end with 'App' (1)
(C) Names of all products whose names start with 'App'
(D) Names of all products whose names end with 'App'

15. In which datatype the value stored is padded with spaces to fit the specified length.
(1)
(A) DATE (B) VARCHAR (C ) FLOAT (D) CHAR
Which aggregate function can be used to find the cardinality of a table? (1)
16.
(A) sum() (B) count() (C ) avg() (D) max()

17. Which protocol is NOT used to transfer mails over the Internet?
(1)
(A) SMTP (B) IMAP (C) FTP (D) POP3
18. A _________ is a network device that amplifies and restores the signals for long
distance communications.
(1)
(A) Repeater (B) Hub (C) Switch (D) Router

19. ______is a method of implementing a telecommunications network in which two


network nodes establish a dedicated communications channel through the network (1)
before the nodes may communicate.
(A)circuit switching (B) message switching (C) packet switching (D) All 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): If the arguments in the function call statement match the number
and order of arguments as defined in the function definition, such arguments are
(1)
called positional arguments.
Reasoning (R): During a function call, the argument list first contains default
argument(s) followed by the positional argument(s).

21. Assertion (A): A SELECT command in SQL can have both WHERE and HAVING clauses.
Reasoning (R): WHERE and HAVING clauses are used to check conditions,
(1)
therefore, these can be used interchangeably.
Q No Section-B ( 7 x 2=14 Marks) Marks

22. How is a mutable object different from an immutable object in Python?


How is pop() function different from remove() function in Python Lists? (2)

23. (i) Which out of the following operators will NOT work with a string? + , -, *, not
(2)
(ii) What will be the output of the following expression?
myTuple = ("John", "Peter", "Vicky")
Page: 3/10
x = "#".join(myTuple)
print(x)

24. If L1=[1,2,3,2,1,2,4,2, . . . ], and L2=[10,20,30, . . .], then


(Answer using builtin functions only)
(I)
A) Write a statement to count the occurrences of 4 in L1. (1)
OR
B) Write a statement to sort the elements of list L1 in ascending order.

(II) (1)
A) Write a statement to insert all the elements of L2 at the end of L1.
OR
B) Write a statement to reverse the elements of list L2.

25. What possible outputs(s) will be obtained when the following code is executed? What
is the possible minimum and maximum value x can take?

import random

List = ['CTC', 'BBSR', 'KDML', 'PURI']

for y in range (4): (2)

x = [Link] (1,3)

print (List[x], end = '#')

Options are:

a) KDML#PURI#BBSR#CTC# b) KDML#KDML#PURI#PURI#
c) BBSR#KDML#BBSR#KDML# d) All of these 3 options are possible

The given Python code to print all Prime numbers in an interval (range) inclusively.
26.
The given code accepts 02 number (low & high) as arguments for the function (2)
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:
[Link](2)
continue
for x in range(2, i):

Page: 4/10
if i % x == 0:
flag = 1
continue
if flag == 0:
[Link](x)
returns prime
low=int(input("Lower range value: "))
high=int(input("High range value: ")
print(Prime_Series())

27. (I)
A) What constraint should be applied on a table column so that duplicate (2)
values are not allowed in that column, but NULL is allowed.
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?

(II)
A) Write an SQL command to remove the Primary Key constraint from a
table, named MOBILE. M_ID is the primary key of the table.
OR
B) Write an SQL command to make the column M_ID the Primary Key of
an already existing table, named MOBILE.

28. A) List any two difference between Star topology and Bus topology.
OR (2)
B) Expand the term TCP/IP. What is the significance of a Gateway in a network with
traffic?

Q No. Section-C ( 3 x 3 = 9 Marks) Marks

29. A) Write a Python function that displays all the words containing “@gov”
from a text file "[Link]".
OR (3)
B) Write a Python function that finds and displays all the words smaller than 6
characters from a text file "[Link]".

Page: 5/10
30. A) You have a stack named BooksStack that contains records of books. Each
book record is represented as a list containing book_title, author_name, and
publication_year.
Write the following user-defined functions in Python to perform the specified
operations on the stack BooksStack:
(I) push_book(BooksStack, new_book): This function takes the stack
BooksStack and a new book record new_book as arguments and pushes
the new book record onto the stack.
(II) pop_book(BooksStack): This function pops the topmost book record from
the stack and returns it. If the stack is already empty, the function should
display "Underflow".
(III) peep(BookStack): This function displays the topmost element of the (3)
stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
(B) A dictionary, StudRec, contains the records of students in the following
pattern:
{admno: [m1, m2, m3, m4, m5]} , i.e., Admission No. (admno) as the key and 5
subject marks in the list as the value.
Each of these records is nested together to form a nested dictionary. Write the
following user-defined functions in the Python code to perform the specified
operations on the stack named BRIGHT.
(i) Push_Bright(StudRec): it takes the nested dictionary as an argument and
pushes a list of dictionary objects or elements containing data as {admno: total
(sum of 5 subject marks)} into the stack named BRIGHT of those students with a
total mark >350.
(ii) Pop_Bright(): It pops the dictionary objects from the stack and displays them.
Also, the function should display “Stack is Empty” when there are no elements in
the stack.
For Example: if the nested dictionary StudRec contains the following data:
StudRec={101:[80,90,80,70,90], 102:[50,60,45,50,40], 103:[90,90,99,98,90]}
Thes Stack BRIGHT Should contain: [{101: 410}, {103: 467}]
The Output Should be:
{103: 467}
{101: 410}
If the stack BRIGHT is empty then display: Stack is Empty

Page: 6/10
31. Predict the output of the following code:

d = {"apple": 15, "banana": 7, "cherry": 9}

str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]

print(str2) (3)

OR

Predict the output of the following code:

line=[4,9,12,6,20]
for I in line:
for j in range(1,I%5):
print(j,’#’,end=””)
print()
Q No. Section-D ( 4 x 4 = 16 Marks) Marks

32. Consider the table ORDERS as given below

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
Note: The table contains many more records than shown here.
(4)
A) Write the following queries:
(I) To display the total Quantity for each Product, excluding
Products with total Quantity less than 5.
(II) To display the orders table sorted by total price in descending order.
(III) To display the distinct customer names from the Orders table.
(IV) Display the sum of Price of all the orders for which the quantity is null
OR
B) Write the output of the following queries:
(I) Select c_name, sum(quantity) as total_quantity from orders group by c_name;
(II) Select * from orders where product like '%phone%';
(III) Select o_id, c_name, product, quantity, price from orders where price
between 1500 and 12000;
(IV) Select max(price) from orders;

Page: 7/10
33. Mr. Snehant is a software engineer working at TCS. He has been assigned to develop
code for stock management; he has to create a CSV file named [Link] to store the
stock details of different [Link] structure of [Link] is : [stockno, sname,
price, qty], where stockno is the stock serial number (int), sname is the stock name
(string), price is stock price (float) and qty is quantity of stock(int).
Mr. Snehant wants to maintain the stock data properly, for which he wants to write
the following user-defined functions:
(4)
(I) AcceptStock() – to accept a record from the user and append it to the file [Link].
The column headings should also be added on top of the csv file. The number of
records to be entered until the user chooses ‘Y’ / ‘Yes’.
(II) StockReport() – to read and display the stockno, stock name, price, qty and value of
each stock as price*qty. As a Python expert, help him complete the task.

Table Name: TRADERS


34.
TCODE TNAME CITY
T01 RELIANCE DIGITAL MUMBAI
T02 TATA DIGITAL BHUBANESHWAR
T03 BIRLA DIGITAL NEW DELHI

Table Name: STOCK


SCODE SNAME QTY PRICE BRAND TCODE (4)
1001 COMPUTER 90 45000 DELL T01
1006 LCD PROJECTOR 40 42000 NEC T02
1004 IPAD 100 55000 APPLE T01
1003 DIGITAL CAMERA 160 15000 SAMSUNG T02
1005 LAPTOP 600 35000 HP T03
Write SQL queries for the following:
(i) Display the SNAME, QTY, PRICE, TCODE, and TNAME of all the stocks in the STOCK
and TRADERS tables.
(ii) Display the details of all the stocks with a price >= 35000 and <=50000 (inclusive).
(iii) Display the SCODE, SNAME, QTY*PRICE as the “TOTAL PRICE” of BRAND “NEC” or
“HP” in ascending order of QTY*PRICE.
(iv) Display TCODE, TNAME, CITY and total QTY in STOCK and TRADERS in each TCODE.

Page: 8/10
35. A table, named STATIONERY, in ITEMDB database, has the following structure:

Field Type
itemNo int(11)
itemName Varchar(15)
Price Float
Qty Int(11)

(4)
Write the following Python function 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

[Link]. SECTION E (2 X 5 = 10 Marks) Marks


a. Write one point of difference between CSV file and Binary file.
36.
Reshabh is a programmer, who has recently been given a task to write a python code to
perform the following binary file operations with the help of two user defined (1+2+2)
functions/modules:
b. AddStudents() to create a binary file called [Link] containing student
information – roll number, name and marks (out of 100) of each student.
c. GetStudents() to display the name and percentage of those students who have a
percentage greater than 75. In case there is no student having percentage > 75 the
function displays an appropriate message. The function should also display the average
percent.

FutureTech Corporation, a Bihar based IT training and development company, is (5)


37.
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 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: 9/10
Distance between various block and locations:
BLOCK DISTANCE
Development to Admin 28 m
Development to Training 105 m
Admin to Training 32 m
Surajpur campus to Coimbatore campus 340 km

Number of Computers
BLOCK Number of Computers
Development 90
Admin 40
Training 50

(i) Suggest the most appropriate block/location to house the SERVER in the Surajpur
center (out of the 3 blocks) to get the best and effective connectivity. Justify your
answer.
(ii) Suggest why should a firewall be installed at the Surajpur Center?
(iii) Suggest the best wired medium and draw the cable layout (Block to Block) to
most efficiently connect various blocks within the Surajpur Center.
(iv) Suggest the placement of the following devices with appropriate reasons:
a) Switch/Hub b) Router

(v)
(A) Suggest the best possible way to provide wireless connectivity between Surajpur
Center and Raipur Center.
OR
(B) What type of network (PAN, LAN, MAN, or WAN) will be set up among the
computers connected in the SURAJPUR campus?

Page: 10/10
KENDRIYA VIDYALAYA SANGATHAN REGIONAL OFFICE LUCKNOW
1ST PRE-BOARD EXAMINATION 2024-25
CLASS: XII SUBJECT: COMPUTER SCIENCE
TIME: 3 HOURS M. MARKS: 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


“Variable declaration is implicit in Python”

2 What will be the output of the following python expression? print(2**3**2) 1


a. 64 b. 256 c. 512 d. 32

3 1
Which one of the following is False regarding data types in Python?
A. In python, explicit data type conversion is possible
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 1
The return type of [Link]() is a
A. string
B. List
C. Tuple
D. Dictionary

5 1
Given the following dictionary
Emp1={"salary":10000,"dept":"sales","age":24,"name":"john"}
[Link]() can give the output as
1|Page
A. (“salary”,‟dept”,‟age‟,‟name‟)
B. (['salary', 'dept', 'age', 'name'])
C. [10000,‟sales‟,24,‟john‟]
D. {„salary‟,‟dept‟,‟age‟,‟name‟}

6 1
What will be the output of the following python statement?
L=[3,6,9,12]
L=L+15
print(L)
A. [3,6,9,12,15]
B. [18,21,24,27]
C. [5,3,6,9,12,15]
D. error

7 Select the correct output of the code: 1

(a)COMPUTER-students-ARE-very-SMART (b) COMPUTER-STUDENTS-


ARE-very-SMART
(c) computer-students-are-very-SMART (d) COMPUTER-STUDENTS-ARE-
VERY-SMART

8 Select the correct output of the code: a = "Year 2024 at all the best" 1
a = [Link]('a')
b = a[0] + "-" + a[1] + "-" + a[3]
print (b)

a. Year – 0- at All the best


b. Ye-r 2024 -ll the best
c. Year – 024- at All the best
d. Year – 0- at all the best

9 Which SQL command is used to change some values in existing rows? 1


a) update b) insert c) alter d) order

10 Which method is used to move the file pointer to a specified position. 1


a. tell()
b. seek()
c. seekg()
d. tellg()

11 State True or False 1


A try block may have more than except blocks to handle exception.

2|Page
Q.12 and 20 is ASSERTION AND REASONING 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
C) A is True but R is False
D) A is false but R is True

12 Assertion (A):- The number of actual parameters in a function call may not 1
be equal to the number of formal parameters of the function.
Reasoning (R):- During a function call, it is optional to pass the values to
default parameters.

13 The correct definition of column ‘alias’ is 1


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: 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.

15 In MYSQL database, if a table, Alpha has degree 5 and cardinality 3, and another 1
table, Beta has degree 3 and cardinality 5, what will be the degree and cardinality of
the Cartesian product of Alpha and Beta?
a) 5,3 b) 8,15 c) 3,5 d) 15,8

16 A_______ is a query that retrieves rows from more than one table or view: 1
a. Start b. End c. Join d. All of these

17 is a communication protocol responsible to control the 1


transmission of data over a network.
a. TCP (b) SMTP (c) PPP (d)HTTP

18 Fill in the blank: 1


The modem at the sender’s computer end acts as a .
a. Model b) Modulatorc. c) Demodulator d) Convertor

19 Identify the device on the network which is responsible for forwarding data 1
from one device to another
a. NIC b. Router c. RJ45 d. Repeater

20 Assertion (A): A function is a block of organized and reusable code that is used to 1
perform a single related action.
3|Page
Reason (R): Function provides better modularity for your application and a high
degree of code reusability.

21 Which function is used to display the unique values of a column of a table? 1


a. sum()
b. unique()
c. distinct()
d. return()

Section - B (7x2 = 14 marks)

22 Predict the output of the Python code given below: 2


def Swap (a,b):
if a>b:
print('changed ',end=' ')
return b,a
else:
print('unchanged ',end=' ')
return a,b
data=[11,22,16,50,30]
for i in range (4,0,-1):
print(Swap(data[i],data[i-1]))

23. a) Rishaan has written a code to input a number and check whether it is even or 2
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”)

24 Choose the best option for the possible output of the following code 2
import random
L1=[[Link](0,10) for x in range(3)]

4|Page
print(L1)
(a) [9,9,9] (b) [5,5,5] (c) [6,6,6] (d) All are possible

OR
import random
num1=int([Link]()+0.5)
What will be the minimum and maximum possible values of variable num1

25 Predict the output of the following code: 2

26 The code given below accepts a number as an argument and checks whether the 2
given number is perfect number or not. Observe the following code carefully and
rewrite it after removing all syntax and logical errors. Underline all the
corrections made.

27 2
An organization SoftSolutions is considering to maintain their employees records
using SQL to store the data. As a database administrator, Murthy has decided that :
• Name of the table - HRDATA
• The attributes of HRDATA are as follows:
ECode – Numeric
EName – character of size 30

5|Page
Desig – Character of size 5

Remn - numeric
Now help Murthy to create table and insert one record (80008,Arjun,Admin, 55000)
into the table.
OR
City Hospital is considering to maintain their inventory using SQL to store the data.
As a database administer, Ritika has decided that :
• Name of the database - CH
• Name of the table - CHStore
• The attributes of CHStore are as follows:
ItemNo - numeric
ItemName – character of size 20
Scode - numeric
Quantity – numeric
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 i) Expand the following terms IMAP, DNS 2


ii) Write two points of difference between Switch and Router.
OR
(i) Define the term bandwidth with respect to networks
(ii) Write two points of difference between Web Server and Web Browser

Section - C (3x3 = 9 marks)

29 Write a function in Python to read lines from a text file “[Link]”, and display 3
only those lines, which are starting with an alphabet 'P'.
If the contents of file is :
Visitors from various cities are coming here.
Particularly, they want to visit the museum.
Looking to learn more history about countries with their cultures.
The output should be: Particularly, they want to visit the museum.
OR
Write a method in Python to read lines from a text file “ [Link]”, to find
and display the occurrence of the word 'are'. For example, if the content of the file
is:

6|Page
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 3
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']
7|Page
The output should be: ['Columbo', 'Sri Lanka']
['Dubai', 'UAE']
['Naypyidaw', 'Myanmar']
Stack Empty

31 3
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

Predict the output of the Python code given below:

8|Page
Section - D (4x4 = 16 marks)

32 Consider the tables STORE and SUPPLIERS given below: 4


TABLE: STORE
ITEM ITEM SCODE QTY RATE LASTBU
NO Y
2005 Sharpner Classic 23 60 8 2009-01-31
2003 Ball Pen 0.25 22 50 25 2010-02-01
2002 Gel Pen Premium 21 150 12 201-02-24
2006 Gel Pen Classic 21 250 20 2009-03-11
2001 Eraser Small 22 220 6 2009-01-19
2004 Eraser Big 22 110 8 2009-12-02
2009 Ball Pen 0.5 21 180 18 2009-11-03

Table :Suppliers

Scode Sname
21 Premium Stationary
23 Soft plastics
22 Tetra Supply
Write SQL commands for the following queries (i) to (iv):
i) To display ItemNo, Item Name and Sname from the tables with their
corresponding matching Scode.
ii) Display the structure of the table store.
iii) Display the average rate of Premium Stationary and Tetra Supply.
iv)Display the item, qty, and rate of products in descending order of rates
OR

Write SQL commands for the following queries (i) to (iv) on the basis of relation
Mobile Master and Mobile Stock.
MOBILE STOCK
S_Id M_Id M_Qty M_Supplier
S001 MB004 450 NEW VISION
S002 MB003 250 PRAVEEN GALLERY
S003 MB001 300 CLASSIC MOBILE
S004 MB006 150 A-ONE MOBILE
S005 MB003 150 THE MOBILE
S006 MB006 50 MOBILE CENTRE

9|Page
MOBILE MASTER
M_Id M_Company M_N M_Pric M_Mf_Dat
ame e e
MB001 SAMSUNG GAL 4500 2013=02-12
AXY
MB003 NOKIA N110 2250 2012-04-15
0
MB004 MICROMAX UNITE3 4500 2016-10-17
MB005 SONY XPERIA 7500 2017-11-20
M
MB006 OPPO SELFIEE 8500 2010-08-21
X

(i) Display the Mobile Company, Name and Price in descending order of their
manufacturing date
ii) List the details of mobile whose name starts with “S” or ends with “a”
iii) Display M_Id and sum of Mobile quantity in each M_Id.
iv) List the details of Mobile company name whose mobile price is greater than 5000.

33 (a)Write a Program in Python that defines and calls the following user defined 4
functions:
(i) InsertRow() – To accept and insert data of a student to a CSV file
‘[Link]’. Each record consists of a list with field elements as
rollno, name and marks to store roll number, student’s name and
marks respectively.
(ii) COUNTD () – To count and return the number of students who scored
marks greater than 75 stored in the CSV file named ‘[Link]’.

10 | P a g e
34 Consider the following tables Consumer and Stationary. 4
Table: Stationery

S_ID Stationary Company Price


Name
BP01 Ball Pen Reynolds 10
PL02 Pencil Natraj 5
ER05 Eraser Natraj 3
PL01 Pencil Apsara 6
GP02 Gel Pen Reynolds 15

Table: Consumer
C_ID Consumer Name City S_ID
01 Pen House Delhi PL01
06 Writer well Mumbai GP02
12 Topper Delhi BP01
15 Good learner Delhi PL02
16 Motivation Bangalore PL01
Write SQL statements for (i) to (iv)
(i) To display the consumer detail in descending order of their name.
(ii) To display the Name and Price of Stationaries whose Price is in the range 10 to
15.
(iii) To display the ConsumerName, City and StationaryName for stationaries of
"Reynolds" Company
iv) To increase the Price of all stationary by 2 Rupees

35 4
(i) Kabir wants to write a program in Python to insert the following record in
the table named Student in MYSQL database, SCHOOL:
rno(Roll number )- integer
name(Name) - string
DOB (Date of birth) – Date
Fee – float

Note the following to establish connectivity between Python and MySQL:

Username - root
Password - tiger
Host - localhost

The values of fields rno, name, DOB and fee has to be accepted from the user. Help
Kabir to write the program in Python.

11 | P a g e
Section - E (2x5 = 10 marks)

36 5
(i) Differentiate between Binary File and CSV File.

(ii) Write a python code to perform the following binary file operations with the
help of two user defined functions/modules:
a. AddStudents() to create a binary file called [Link] containing
student information – roll number, name and marks (out of 100) of each
student.
b. GetStudents() to display the name and percentage of those students who
have a percentage greater than 75. In case there is no student having
percentage > 75 the function displays an appropriate message. The function should
also display the percent.

37 “Vidyadhara” an NGO is planning to setup its new campus at Lucknow its web- 5
based activities. The campus has four (04) UNITS as shown below:

ADMIN TRAINING
UNIT UNIT

RESOURCE
FINANCE UNIT
UNIT

Distance Between above Units are given here’s under

UN IT-1 UNIT-2 DISTANCE(In mtrs)


ADMIN TRAINING 65
ADMIN RESOURCE 120
ADMIN FINANCE 100
FINANCE TRAINING 60
FINANCE RESOURCE 40

12 | P a g e
TRAINING RESOURCE 50

No Of Computers in various UNITs are:


UNIT NO OF COMPUTERS
ADMIN 150
FINANCE 25
TRAINING 90
RESOURCE 75

a) Suggest topology and draw the cable layout to efficiently connect various blocks
of buildings within the Lucknow campus for connecting the digital devices.
b) Which network device will be used to connect computers in each block to form a
local area network?
c) Which block, in Lucknow Campus should be made the server? Justify your
answer.
d) Is there a requirement of a repeater in the given cable layout? Why/Why not?
e) NGO is planning to connect its Regional Office at Delhi, Rajasthan. Which
out of the following wired communication, will you suggest for a very high-speed
connectivity?
(a) Twisted Pair cable (b) Ethernet cable (c) Optical Fiber

13 | P a g e
Subject Code 0 8 3 Roll No.

KENDRIYA VIDYALAYA SANGATHAN, MUMBAI REGION


FIRST PRE-BOARD (SESSION 2024-25)
(SET-I)
Subject: Computer Science (Theory) Class: XII
Time Allowed: 3:00 Hours Max. Marks - 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 (21 x 1 = 21 Marks) Marks


1. State True or False: 1
“The is operator checks the identity of two variables, not the equality of
their values.”
2. Identify the output of the following code snippet: 1
thought="work is worship"
p=[Link]("or")
print(p)
A. [‘work’, ‘is’, ‘worship’]
B. ('w', 'or', 'k is worship')
C. [‘w’, ‘or’, ‘k is worship’]
D. (‘work’, ‘is’, ‘worship’)
3. Which of the following expressions evaluates to True? 1
A. False or not True==1
B. not 3>4 and 5 and False
C. 4**3 and 0 or False
D. 12!=5 or not True
4. What is the output of the given expression? 1
pride="Assembly Elections@2024"
L=[Link]('s')
print(L[::-2])

A. ['@2024', ''] B. [‘@2024’, ‘A’]


C. [‘embly Election’] D. ‘40@nicl lmsA’

Page 1 of 9
5. What will be correct output for the following: 1
R = (4.5, 5), (5,4), (8.2,7), (8,7,3)
print(max(R))

A. Error B. (8.2, 7)
C. (8, 7, 3) D. (4.5, 5, 8.2, 8)
6. Select the correct output of the following code: 1
S = "Motivational thought"
print([Link]("hou", 4, 13))

A. True B. 4
C. 14 D. -1
7. Which of the following statement(s) would give an error after executing the 1
following code ?

Stud= { "Kiran": 70, "Jaya": 95} # Statement 1


print (Stud[95]) # Statement 2
Stud ["Arvind"]=60 # Statement 3
print([Link]()) # Statement 4
print(Stud) # Statement 5

A. Statement-2 B. Statement-3
C. Statement-4 D. Statement-2 and 4
8. What does the [Link](x) method do in Python? 1
A. Inserts the element x at the beginning of the list
B. Inserts the element x at the end of the list
C. Inserts the element x in between two elements in the list
D. It merges the two lists and creates another list
9. If a table which has one Primary key and two alternate keys. How many 1
Candidate keys will this table have?
A. 1 B. 2 C. 3 D. 4
10. Write the missing statement to complete the following code: 1
f = open("[Link]", "r")
data = [Link](80)
cur_pos = ______ # Get the current position of the file pointer
print(“Current position is: ”, cur_pos)
[Link]()
11. State True or False: 1
The try block in Python can contain multiple except blocks to handle
different types of exceptions.
12. What will be the output of the following code? 1
p=6
def Demo():
global p
p**=2
print(p, end='+')
Demo()
print(p, end='@')

Page 2 of 9
A. 6+36@
B. 72@
C. 36+36@
D. 36+6@
13. Fill in the blanks: 1
The SELECT statement when combined with __________ clause, returns
records without repetition.
14. Which function in SQL is used to count the total number of records 1
regardless of NULL from table in a database?
A. sum(*) B. total(*)
C. count(*) D. count( )
15. The degree and cardinality of a table named SONG are 2 and 4, respectively. 1
The degree and cardinality of another table named SINGER are 3 and 5,
respectively. There is one common field in both tables. After performing the
Cartesian product of both tables, what will be the new degree and
cardinality of the resultant table?
A. 4 and 20 B. 5 and 20
C. 5 and 9 D. 4 and 9
16. A result set is extracted from the database using a cursor object by giving 1
the following statement:
records=[Link]( )
What will be the data type of records,after the execution of above
statement?
A. tuple B. string
C. dictionary D. list
17. Which of the following protocols is used for remote login: 1
A. VoIP B. HTTP
C. IMAP D. TELNET
18. _________ is used for point-to-point communication or unicast 1
communication such as radar and satellite.
A. Infrared B. Bluetooth
C. Microwaves D. Radio waves
19. Which network device converts digital data from a computer into analog 1
signals for transmission over phone lines?
Q.20 and Q.21 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): The return statement in a Python function is optional. 1
Reason (R): If no return statement is used, the function returns None by
default.
21. Assertion (A): In SQL, the GROUP BY clause is used to arrange identical 1
data into groups.
Reason (R): The GROUP BY clause is mandatory when using aggregate
functions like SUM() or AVG().

Page 3 of 9
SECTION-B ( 7 x 2=14 Marks)
22. Define dynamic data typing in python. Write an example to illustrate 2
your answer.
23. i. Define Operator Associativity. 2
ii. Write the following operators in descending order (Higher precedence
to lower precedence in order of operation) of their operator
precedence:
or, **, and, +, *, ==
24. If M1=[60,25,30,……] and M2=[3,6,9,12, …….], then 2
Write the Python statements for each of the following tasks using Built-in
functions/methods only:
i.
A. To delete an element 25 from the list M1.
OR
B. Write a statement to add an element 85 in the list M2 between the
elements 9 and 12.

ii.
A. Write a statement to sort the elements of list M1 in descending
order.
OR
B. Write the statement to delete the last element of list M2.
25. Look at the following python code and find the possible output(s) from the 2
options (i) to (iv) following it. Also, write the highest and lowest values that
can be pointed by label VALUE.

import random
for y in range(4):
VALUE = [Link](4,11) + y
print(VALUE, "#", end=" ")
i. 6 # 7 # 12 # 13 # ii. 5 # 11 # 8 # 11 #
iii. 4 # 7 # 12 # 14 # iv. 9 # 15 # 8 # 6 #
26. The code provided below is intended to search an element from a list. 2
However, there are syntax and logical errors in the code. Rewrite the
code in python after removing all error(s). Underline each correction done
in the code.

def Linear_Search(L)
item=int(input("Enter the value that you want to search: ")
for i in range(len(L)):
if L[i]==item:
print("Element found at index: " i)
break
else:
print("Element not found")
Linear_Search([25,78,45,36,21,10])
27. i. 2
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. Categorize the following commands as DDL and DML:
INSERT, UPDATE, ALTER, DROP

Page 4 of 9
ii.

A. Write an SQL command to change a column name from


Date_of_Birth to DOB of date data type in Employee table.
OR
B. Write an SQL command to change a table name from Employee to
Emp.
28. Write two points of difference between XML and HTML. 2
OR
Write two points of difference between Circuit Switching and Packet
switching.
Section-C ( 3 x 3 = 9 Marks)
29. Write a function Show_Words( ) in python to read the content of a text file 3
“[Link]” and display those words in capital letters which start with any
vowel.
Example, if the file contains:
“Comparing apples to oranges”
Then the function should display the output as:
APPLES
ORANGES
OR
Write a function count_my( ) in python to read the text file “[Link]” and
count the number of times the word “my” (Including uppercase and
lowercase) occurs in the file.
For example, if the file “[Link]” contains:
“This is MY website. I have displayed my preferences in the CHOICE
section”
The count_my( ) function should display the output as :
The word my occurs :2 times
30. You have a stack named MovieStack that contains records of movies. Each 3
movie record is represented as a list containing movie_title,
director_name, and release_year.
Write the following user-defined functions in Python to perform the specified
operations on the stack MovieStack:
i. add_movie(MovieStack, new_movie): This function takes the stack
MovieStack and a new movie record new_movie as arguments and
pushes the new movie record onto the stack and display the stack.
ii. remove_movie(MovieStack): This function removes the topmost
movie record from the stack and returns it. If the stack is already
empty, the function should display "Underflow".
iii. view_top(MovieStack): This function displays the topmost element of
the stack without deleting it. If the stack is empty, the function should
display 'None'.
OR
Stationery_Item is a dictionary containing the details of stationary items.
Write a user defined function PUSH_DATA(Stationery_Item), to push the
name of those items into the stack named as PriceStack which have price
more than 75 and display stack. Also display the number of elements
pushed into the stack.
For example: If the dictionary contains the following data:
Stationery_Item={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain
Page 5 of 9
['Pen', 'Notebook']
The output should be:
Number of elements in stack: 2
31. Predict the output of the following code 3
s="science"
L=[1,3,4,8,7,18]
d={}
for i in range(len(L)//2):
if i%2==0:
d[[Link]()]=s[i]
else:
d[[Link]()]=i*2
for k,v in [Link]():
print(k,v,sep="-")

OR
Write the output of the code given below:
def FindOutput(p, q=2, r=40):
x=p**2*4
y=x+r
print(x, "@", y)
return y
c=FindOutput(q=5, r=7,p=4)
a,b=4,3
c=FindOutput(b,a,c)
print(a,"@",b,"@",c)
Section-D ( 4 x 4 = 16 Marks)
32. Consider a table TRAIN as given below: 4
TNo TName Train_Type Source Destination Fare
12001 Rajdhani Express Superfast Delhi Mumbai 3000
12625 Shatabdi Express Superfast Delhi NULL 1200
12501 North East Express Express Guwahati Delhi 1500
16159 Kanyakumari Exp Express Kanyakumari Delhi 2500
20814 Jodhpur-Puri Exp Express Jodhpur Puri 2800
19412 Sabarmati Express Express Sabarmati NULL 1100

A) Write the following queries:


i. Display type of train and total fare of each type of train.
ii. Display Train Number, Train Name and Fare of those trains whose
name starts with the alphabet letter ‘S’.
iii. Display train number, train name and source of those trains whose
destination is NULL.
iv. Count the number of trains which have train type as superfast and
source is ‘Delhi’.
OR
B) Write the output:
i. Select TNAME, Fare from TRAIN Where Fare<2000 order by TName;
ii. Select avg(fare) from TRAIN group by Train_Type;
iii. Select TName, Destination, Fare from TRAIN where fare <>2500
and destination IS NULL;
iv. Select min(fare) from TRAIN where Train_Type= “Express”;
Page 6 of 9
33. Mr. Ankit is a python programmer working in a software company. He has 4
to develop a simple inventory management system of all employees
working in an educational institute. He has created a csv file named
[Link], to store the details of employees. The structure of [Link]
is:
[employee_id, emp_name, salary]
Mr. Ankit wants to write a Program in Python that defines and calls the
following user defined functions:
i. ADD() – To accept and add data of 6 employees to a CSV file
‘[Link]’.
ii. COUNTR() – To count the number of records present in the CSV file
named ‘[Link]’.
34. Ms. Nishi has been entrusted with the bank Database. She needs to access 4
some information from LOAN and BORROWER tables for a survey analysis. Help
her to extract the following information by writing the desired SQL queries
as mentioned below.
Table: LOAN
loan_number branch_name Amount
L123 Nagpur 45000
L456 Pune 60000
L347 Delhi 80000
L987 Delhi 25000
L901 Pune 45000

Table : BORROWER
customer_name loan_number
Ajit Das L456
Rohan Yadav L901
Suman Verma L123
Ayesha Tiwari L987
Saurav L347

i. To display customer name and branch name of those customers who


have taken loan from Delhi branch.
ii. To display loan number, customer name and amount of those
customers who have taken loan more than 40000.
iii. To display branch name and average amount of that branch which
has given average loan amount more than 50000.
iv.
A. To display customer name and amount in descending order of
amount.
OR
B. What will be degree of resultant table after performing natural
join of these two tables.

Page 7 of 9
35. Alok wants to create a table named BOOK in the LIBRARY database, which 4
should have the following structure:

Field Type Remarks


Book_ID int Primary Key
BName varchar(25) NOT NULL
Quantity int
Price float(6,2)
Author Varchar (20)
Write the following Python function to perform the specified operation:
• Create_and_ADD() : To create a table BOOK as per details given above
and after creating table, insert the following record in the table BOOK.
Book_ID:12, BName:“Godaan”,
Quantity:15,Price:210,Author:“Premchand”
Assume the following for Python-Database connectivity:
host: localhost, user: root, password: program
SECTION E (2 X 5 = 10 Marks)
36. Mr. Mohit is working on a school project to manage student records using 5
Python. The student data is stored in a binary file named [Link]. The
binary file [Link] contains each record in given format:
{“Admn_No”:admn, “SName”:name, “Marks”:marks}
Where
● Admn_No: Admission Number (integer)
● SName: Student Name (string)
● Marks: Marks (integer)

You as a programmer, help him to write following python functions:


i. ADD_Data() : To write 7 records in binary file [Link] by taking
the values for each record from user.
ii. Display_Data() : Read all records from binary file and display them.
iii. Modify_Marks() : that updates the marks of a student in the file
[Link] based on the admission number provided by the user. If
the admission number does not exist in the file, display an appropriate
message.
37. “MyTech Services” is planning to set up its India campus at Jaipur with its 5
Head Office at Mumbai. The Jaipur campus has 3-main blocks-HR,
Technical and Marketing. You as a network expert have to suggest the
best network related solutions for their problems raised in (i) to (v).

Jaipur Campus

HR Tech
nical

Head Office
Mark
eting
Mumbai

Page 8 of 9
Distance between various building blocks:
HR BLOCK to TECHNICAL BLOCK 45 m
HR BLOCK to MARKETING BLOCK 98 m
TECHNICAL BLOCK to MARKETING BLOCK 107 m
Head Office to JAIPUR Campus 1275 KM

Number of computers in each Block:


HR BLOCK 10
TECHNICAL BLOCK 105
MARKETING BLOCK 45

i. Suggest the most appropriate location of the server inside the JAIPUR
campus (out of the 3 blocks), to get the best connectivity for
maximum number of computers. Justify your answer.

ii. Which among the following devices will you suggest to be procured
by the company for connecting all the computers within each of their
offices?
● Switch/Hub
● Modem
● Bridge

iii. Suggest network type (out of LAN, MAN, WAN) for connecting each
of the following set of their offices:
a. HR and Marketing Block
b. Head Office and Jaipur office

iv. Which of the following communication medium, you will suggest to


be procured by the company for connecting their local offices in
Jaipur for very effective and fast communication?
● Telephone cable
● Optical fiber
● Ethernet cable

v.
A. In JAIPUR Campus, in between which offices repeater should be
installed? Justify the answer.
OR
B. Suggest and draw the cable layout to efficiently connect various
blocks within the JAIPUR campus for connecting the computers.

Page 9 of 9
SET-1

KENDRIYA VIDYALAYA SANGATHAN PATNA REGION


PRE BOARD-1 EXAMINATION
CLASS: XII SESSION: 2024-25
COMPUTER SCIENCE (083)
(Question Paper)

Time allowed: 3 Hours Maximum Marks: 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.

Section-A (21 x 1 = 21 Marks)


1. Write the type of tokens from the following:
(i) if (ii) roll_no (1)
2. If the following code is executed, what will be the output of the following (1)
code?
name="ComputerSciencewithPython"
print(name[3:10])
3. Consider the given expression : (1)
7<4 or 6>3 and not 10==10 or 17>4
Which of the following will be the correct output if the given expression is
evaluated ?
(a) True
(b) False
(c) None
(d) NULL
(A)
4. Select the correct output of the code :
S="Amrit Mahotsav @ 75" (1)
A=[Link](" ",2)
print(A)
(a) ('Amrit', 'Mahotsav', '@', '75')
(b) ['Amrit', 'Mahotsav', '@ 75']
Page: 1/10
(c) ('Amrit', 'Mahotsav', '@ 75')
(d) ['Amrit', 'Mahotsav', '@', '75']

5. What will be the output of the following code snippet?


str= "COMPUTER PROGRAM"
print(str[-3:2:-2]) (1)

6. Nitin has decleared a Tuple as follows:-


T=(11,22,33)
Nitin now want to modify T as (11,22,33,44). Which of following statement,
Nitin will write to complete the task?
(A) T=T+44 (1)
(B) T=T+(44)
(C) T=T+(44,)
(D) Since T is immutable, therefore T cannot be modified.

7. Given the following code:-


my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
print(20 in my_dict, ‘apple’ in my_dict, sep=’#’)

Which statement is correct output of above code? (1)


(A)True#False
(B) False#True
(C)True#True
(D) False#False

8. Consider L is a List. What does the L+=’xy’ command do in Python?


(A) Add ‘xy’ at the end of L.
(B) Add ‘x’,’y’ at the end of L (1)
(C) Add ‘xy’ at the start of L
(D) Will give error

9. In SQL, which command will be used to add a new record in a table?


(A) UPDATE
(B) ADD
(C) INSERT (1)
(D) ALTER TABLE
(A)

Write the missing statement to complete the following code: (1)


10.
file = open("[Link]", "r")
data = _____ #Read the first 10 character of file
print(data)
[Link]()

Page: 2/10
Write the name of the built-in function/method of the math module which (1)
11.
when executed upon 5.8 as parameter, would return the nearest smaller
integer 5.
12. Write the output of the following Python code : 1
(1)
for i in range(2,7,2):
print(i * '$')
13. Which SQL command can delete all records from a existing table?
(1)

14. What will be the output of the query? (1)


SELECT * FROM client WHERE client_name LIKE '%Singh%';
(A) Details of all clients whose name start with ' Singh '
(B) Details of all clients whose name end with ' Singh '
(C) Details of all clients whose name contains ' Singh ' anywhere in name
(D) Name of all clients whose names contains ' Singh ' anywhere in name

15. Which is the following is unpacked datatype used in SQL for float number?
(A) float
(B) double
(1)
(C) decimal
(D) None of the above

16. Which command can be used to change the degree of a table? (1)

17. Computers connected by a network across different cities is an example of (1)


___________ .

18. Ethernet card is also known as : (1)


(a) LIC (b) MIC
(c) NIC (d) OIC

A ____________ is a networking device that connects computers in a (1)


19.
network by using packet switching to receive, and forward data to
the destination.

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

Page: 3/10
20. Assertion (A): To use a function from a particular module, we need to (1)
import the module.
Reasoning (R): import statement can be written anywhere in the program, before
using a function from that module.

21. Assertion (A):- SQL SELECT's GROUP BY clause is used to divide the (1)
result in groups.

Reasoning (R):- The GROUP BY clause combines all those records that
have identical values in a particular field or in group by fields.

Section-B ( 7 x 2=14 Marks)


22. How is a mutable object different from an immutable object in Python? (2)
Identify one mutable object and one immutable object from the following:
(1,2), [1,2], {1:1,2:2}, ‘123’

23. Differentiate between actual parameter(s) and a formal parameter(s) with a


suitable example for each. (2)
OR
Explain the use of global key word used in a function with the help of a
suitable example.
(2)
24. If L1=[1,2,3,2,1,2,4,2, . . . ], and L2=[10,20,30, . . .], then
(I)
A) Write a statement to count the occurrences of 1 in L1.
OR
B) Write a statement to sort the elements of list L1 in descending order.

(II)
A) Write a statement to insert all the elements of L2 at the start of L1.
OR
B) Write a statement to reverse the elements of list L1.

25. What possible output(s) is/are expected to be displayed on the screen at the (2)
time of execution of the program from the following code ? Also specify the
maximum and minimum value that can be assigned to the variable R when K
is assigned value as 2.
import random
Signal = [ 'Stop', 'Wait', 'Go' ]
for K in range(2, 0, 1):
R = randrange(K)
print (Signal[R], end = ' # ')
(a) Stop # Wait # Go #
(b) Wait # Stop #
(c) Go # Wait #
(d) Go # Stop #
Page: 4/10
26. Rao has written a code to input a number and check whether it is prime or (2)
not. His code is having syntax and logical 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’)
(2)
27. Write SQL command to create the table company:

The structure of company table is as follows: -


Field Data Type Constaint
ID Char(7) Primary Key
CompanyName Varchar(30)
EstablishDate Date
Turnover Int
OR
Write SQL command to add column Sales with datatype Int and constraints
not null in company column

(2)
28. A) List one advantage and one disadvantage of Bus topology.
OR
B) Expand the term POP3. What is the use of POP3?

Section-C ( 3 x 3 = 9 Marks)

29.A) Write a Python function that displays all the words containing @[Link] from (3)
a text file "[Link]".
OR
B)Write a Python function that finds and displays all the words longer than 4
characters from a text file "[Link]".

Page: 5/10
30. A list contains following record of a customer: [Customer_name, Phone_number, (3)
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
(i) Pop_element() - To Pop the objects from the stack and display them.
Also, display “Stack Empty” when there are no elements in the stack.
For example:
If the lists of customer details are:

[[“Gurdas”, “99999999999”,”Goa”]
[“Julee”, “8888888888”,”Mumbai”]
[“Murugan”,”77777777777”,”Cochin”] [“Ashmit”,
“1010101010”,”Goa”]]

The stack should contain [“Ashmit”,”1010101010”]


[“Gurdas”,”9999999999”]

The output should be: [“Ashmit”,”1010101010”]


[“Gurdas”,”9999999999”]
Stack Empty
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 Python code given below: (3)

def Diff(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1

NUM= [10,23,14,54,32]
for CNT in range (4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')

OR
Page: 6/10
Predict the output of the Python code given below:

tuple1 = (11, 22, 33, 44, 55 ,66)


list1 =list(tuple1)
new_list = []
for i in list1:
if i%2==0:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)

SECTION D (4 X 4 = 16 Marks)

(4)
32. Given a Table Student
Table : STUDENT

Write SQL queries for (i) to (iv), which are based on the table: STUDENT :-
(i)To display the records from table student in alphabetical order as per the
name of the student.
(ii)To display Class, Dob and City whose marks is between 450 and 551.
(iii)To display Name, Class and total number of students who have
secured more than 450 marks, class wise
(iv)To increase marks of all students by 20 whose class is “XII”

OR
(i) SELECT COUNT(*), City FROM STUDENT GROUP BY CITY
HAVING COUNT(*)>1;
(ii) SELECT MAX(DOB),MIN(DOB) FROM STUDENT;
(iii) SELECT NAME,GENDER FROM STUDENT WHERE CITY=”Delhi”;
(iv) SELECT COUNT(*), Class FROM STUDENT GROUP BY Class
HAVING gender=’F’;

Page: 7/10
33. A csv file "[Link]" contains the data of a survey. Each record of the (4)
file contains the following data:
● Name of a country
● Population of the country
● Sample Size (Number of persons who participated in the survey in that
country)
● Happy (Number of persons who accepted that they were Happy)
For example, a sample record of the file may be:
[‘Signiland’, 5673000, 5000, 3426]
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 for which the population is more than 5000000.
(II) Count the number of records in the file.

34. Write the outputs of the SQL queries (i) to (iv) based on the relations Teacher and (4)
Posting given below:

Table : Teacher
T_ID Name Age Department Date_of_join Salary Gender
1 Jugal 34 Computer Sc 10/01/2017 12000 M
2 Sharmila 31 History 24/03/2008 20000 F
3 Sandeep 32 Mathematics 12/12/2016 30000 M
4 Sangeeta 35 History 01/07/2015 40000 F
5 Rakesh 42 Mathematics 05/09/2007 25000 M
6 Shyam 50 History 27/06/2008 30000 M
7 Shiv Om 44 Computer Sc 25/02/2017 21000 M
8 Shalakha 33 Mathematics 31/07/2018 20000 F

Table : Posting
P_ID Department Place
1 History Agra
2 Mathematics Raipur
3 Computer Science Delhi

(i)SELECT Department, count(*) FROM Teacher GROUP BY Department;


(ii)SELECT Max(Date_of_Join),Min(Date_of_Join) FROM Teacher;
(iii)SELECT [Link],[Link], [Link] FROM Teacher,
Posting WHERE [Link] = [Link] AND
[Link]=”Delhi”;
(iv) SELECT name, age, salary FROM Teacher, Posting WHERE
[Link] = [Link] AND Posting. Department LIKE
”%e%”;

Page: 8/10
35. Kabir wants to write a program in Python to insert the following record in the (4)
table named Student i n MYSQL database, SCHOOL:
 rno(Roll number )- integer
 name(Name) - string
 DOB (Date of birth) – Date
 Fee – float
Note the following to establish connectivity between Python and MySQL:
 Username - root
 Password - tiger
 Host - localhost
The values of fields rno, name, DOBand fee has to be accepted from the
user. Help Kabir to write the program in Python

SECTION E (2 X 5 = 10 Marks)
36. A binary file “[Link]” has structure [BookNo, Book_Name, Author, (5)
Price].
(I) Write a user defined function CreateFile() to input data for a record
and
add to [Link] .
(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 “[Link]”
37. Software Development Company has head office in Mumbai and now want to (5)
set up its new center at Raipur for its office and web-based activities. It has
4 blocks of buildings named Block A, Block B, Block C, Block D.
(i) Number of Computers

: Block A 25

Block B 50

Block C 125

Block D 10

(ii)
(iii) Shortest distances between various Blocks in meters
Block A to Block B 60 m
Block B to Block C 40 m
Block C to Block A 30 m
Block D to Block C 50 m
(iv)

Page: 9/10
(v) (i) Suggest the most suitable place (i.e. block) to house the
server of this company with a suitable reason.
(vi) (ii)Suggest the type of network to connect all the blocks with suitable
reason .
(iii)The company is planning to link all the blocks through a secure and
high speed wired medium. Suggest a cable layout to connect all the
blocks.
(iv)Suggest the most suitable wired medium for efficiently connecting
each computer installed in every block out of the following network
cables:
Coaxial Cable
Ethernet Cable
Single Pair Telephone Cable.
(v) Suggest a protocol that shall be needed to provide Video
Conferencing solution between Mumbai office and Raipur Office.

Page: 10/10
SET-2
KENDRIYA VIDYALAYA SANGATHAN PATNA REGION
PRE BOARD-1 EXAMINATION (SESSION: 2024-25)
CLASS: XII
COMPUTER SCIENCE (083)
(QUESTION PAPER)
Time allowed: 3 Hours Maximum Marks: 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. N. Section-A (21 x 1 = 21 Marks) Marks

1. Which of the following is not a keyword? (1)

(a) eval (b) assert (C) del (d) pass


2. What will be the output of the following python statement?
str1= “6/4” (1)
print(“str1”)
(a) 1 (b) 6/4 (c) 1.5 (d) str1

3. Which of the following expressions evaluates to True?


(a) not(False) and False (b) False and True (1)
(c) not(True or True) (d) True and not(False)
4. Consider the statements given below and then choose the
correct output from the given options: (1)
event = "#G20 Presidency"
print(event[-2:2:-2])
(a) ndsr (b) ceieP0
(c) ceieP (d) ynsdr
Page 1 of 11
5. Identify the invalid python statement from the following: (1)
(a) d = dict() (b) l = {} (c) f = () (d) g = dict {}

6. What will be the output of the following code:


s= [3,0,[2,1,2,3],1]
print(s[s[len(s[2])-2][1]]) (1)
(a) [2,1,2,3] (b) 1
(c) 0 (d) 2

7. What will be the output of the following list operations?


data = [[5,10,15],20,[40,50],50] (1)
print(data[0]+data[-2])
print(data[2][-1])
8. Which of the following statements will raise an error?
(a) t=22, (b) t=(22,) (1)
(c) t=(15) (d) t=tuple(100)
9. Write the missing statement to complete the following code:
fout=open(“[Link]”, “r”)
_____________ #place the file pointer 50 bytes before end of file (1)
Str=[Link](50)
Print(“last 50 bytes of file”, str)
[Link]()
10. State whether the following statement is True or False:
“An exception may be raised even if the program is (1)
syntactically correct”.
11. What will be the output of the following code?
a=10
def call(): (1)
global a
a=15
print(a,end=”#“)
call( )
print(a)

(A) 15#15 (B) 15 #10


(C) 10#15 (D) 10# 10

12. What is the return data type of readlines() function? (1)


(a) string (b)List (c )Tuple (d)Dictionary

Page 2 of 11
13. The data types CHAR (n) and VARCHAR (n) are used to create
_______ and _______ types of string/text fields respectively in a
database. (1)
(a) Fixed, equal ( b) Equal, variable
(C) Fixed, variable (d) Variable, equal
14. Which of the following function is used to FIND the largest
value from the given data in MYSQL? (1)
(a) MAX () (b) MAXIMUM ()
(c) LARGEST () (d) BIG ()
15. Which SQL statement is used to display all the data from ITEMS
table where INAME is start with ‘L’?
(a) SELECT * FROM ITEMS WHERE INAME LIKE ‘L%’; (1)
(b) SELECT * FROM ITEMS WHERE INAME LIKE ‘%L’;
(c) SELECT * FROM ITEMS WHERE INAME LIKE ‘%L%’;
(d) SELECT * FROM ITEMS WHERE INAME LIKE ‘_L_’;
16. Which of the following statements is FALSE about keys in a
relational database?
(a) Any candidate key is eligible to become a primary key.
(b) A primary key uniquely identifies the tuples in a relation.
(1)
(c) A candidate key that is not a primary key is a foreign key.
(d) A foreign key is an attribute whose value is derived from the
primary key of another relation.
17. What does the term "bandwidth" refer to in networking?
(a) The amount of data a connection can handle in a given time (1)
(b) The distance between two network devices
(c) The security level of a network
(d) The speed of data processing
18. Which of the following cables carry data signals in the form of (1)
light?
(a) Coaxial (b) Fiber-optic
(c) twisted pair (d) All of the these
19. _________ Protocol allows user to communicate with a remote
machine. (1)
(a) FTP (b)Telnet (c)VoIP (d)SMTP

20-21 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

Page 3 of 11
(C) A is True but R is False
(D)A is False but R is True
20. Assertion (A): A parameter having a default value in the function
header is known as a default parameter.
Reason (R): The default values for parameters are considered (1)
only if no value is provided for the parameter in the function call
statement.
21. Assertion (A): both WHERE and HAVING clauses are used to
specify conditions.
Reason (R): Both WHERE and HAVING are interchangeable (1)

Section-B ( 7 x 2=14 Marks)

22. Rewrite the following code in python after removing all syntax
error(s). Underline each correction done in the code. (2)
Val = int("Value:")
Adder = 0
for C in the range(1,Val,4) :
Adder=+C
if C%3==0:
print (C*50)
Else:
print (C)
print (Adder)
23. (I) What is use of ** operator? (2)

(II) What will be the output of the following expression?


print (4+3*5/3-5%2)
24. If L1=[40,30,20,10 ], and
L2=[8,12,25,15,35] then
(I) (2)
A) Write a statement to insert element 25 in list L1 at index 2.
B) Write a statement to sort the elements of list L2
in descending order.
OR
If s t r 1 = “ K e n d r i y a V i d y a l a y a S a n g a t h a n ”
A) Write a statement to display the last four characters.
B) print(str1[1:-6])

Page 4 of 11
25. What possible output(s) are expected to be displayed on screen (2)
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 = [Link] (1, 3)
LAST = [Link](2, 4)
for I in range (BEGIN, LAST+1):
print (VALUES[I], end = "-")

(a) 30-40-50- (b) 10-20-30-40-


(c) 30-40-50-60- (d) 30-40-50-60-70-

26. What is primary key? How many primary keys can have in a 1+1=
one table? (2)

27. (I)
a) Name the aggregate functions of SQL which work only with
numeric data.
b) The structure of the table/relation can be displayed using
__________ command

OR
2
A table has initially 4 columns and 7 rows. Consider the following
sequence of operations performed on the table –
i. 5 rows are added
ii. 2 columns are added
iii. 2 rows are deleted
iv. 1 column is added
What will be the cardinality and degree of the table at the end
of above operations?
28. List one advantage and one disadvantage of Tree topology.
OR
(2)
What is a domain name and how does it relate to IP addresses?

Page 5 of 11
Section-C ( 3 x 3 = 9 Marks)
29. Write a function count_words()in puthon, which should read the
file [Link] and display those words which has less than or
equal to four characters. (3)
OR
Write a function RevText() to read a text file "[Link]" and
Print only word starting with 'I' in reverse order.
30. A nested list contains the data of visitors in a museum. Each of
the inner lists contains the 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
(3)
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
M
F
M
The output should be:
Done
Female: 1
Male: 2
OR
Write a function in Python, Push(SItem) where , SItem is a
dictionary containing the details of stationary items– {Sname:
price}.

Page 6 of 11
The function should push the names of those items in the stack
who have price greater than 150. Also display the count of
elements pushed into the stack.
For example:
If the dictionary contains the following data:
Ditem={"Notebook":156,"Pencil":29,"Pen":180,"Eraser":25}
The stack should contain
Pen
Notebook
The output should be:
The count of elements in the stack is 2
31 Write SQL Command for (i) to (iii)
TABLE : GRADUATE 1*3=(3)
SN NAME STIPEND SUBJECT AVERAGE DIV
1 KARAN 400 PHYSICS 68 I
2 DIWAKAR 450 COMP Sc 68 I
3 DIVYA 300 CHEMISTRY 62 I
4 REKHA 350 PHYSICS 63 I
5 ARJUN 500 MATHS 70 I
6 SABINA 400 CHEMISTRY 55 II
7 JOHN 250 PHYSICS 64 I
8 ROBERT 450 MATHS 68 I
9 RUBINA 500 COMP Sc 62 I
10 VIKAS 400 MATHS 57 II
(i) List the names of those students who have obtained DIV I
sorted by NAME.

(ii) Display a report, listing NAME, STIPEND, SUBJECT and


amount of stipend received in a year assuming that the
STIPEND is paid every month.

(iii) To count the number of students who are either PHYSICS


or COMPUTER SC graduates.
OR

(i) To insert a new row in the GRADUATE table:

12,”Kajol”, 300, “computer sc”, 75, 1

(ii) Add a new column GRADE of character

Page 7 of 11
(iii) To delete all the record where average is less than 60.

SECTION D (4 X 4 = 16 Marks)

32. A)
I. “Every syntax error is an exception but every exception
cannot be a syntax error.” Justify the statement. (1+3=4)
II. Explain try…except with the help of an example code
which raise an error when the denominator is Zero while
dividing X and Y and display the quotient otherwise. (4)
OR
B) Mr. Sumit is working in departmental store. He wants to
maintain the record of stock. Help him to perform the following
operations/ tasks: (1*4=4)
 Opens a CSV file named "[Link]" in read mode using
the [Link]() object.
 Iterates through each row in the CSV file.
 Checks if the quantity (second column) of each item is less
than 10. If so, appends the item's name (first column) to a
list named low_stock_items.

 Finally, prints the list low_stock_items containing the


names of items with low stock

33. A binary file “[Link]” has structure [rollno, name, marks].


i. Write a user defined function insertRec() to input data for a
student and add to [Link].
ii. Write a function searchRollNo( rn ) in Python which 2+2=4
accepts the student’s rollno as parameter and searches the
record in the file “[Link]” and shows the details of
student i.e. rollno, name and marks (if found) otherwise
shows the message as ‘No record found’

Page 8 of 11
34. Miss Archna is working in a university. She needs to access 2*2=
some information from employee and department tables for (4)
analysis. Help her to extract the following information by
Writing queries (i) to (iv) as given below:
Table: EMPLOYEE
EMPID NAME DOB DEPTID DESIG SALARY
120 Alisha 23-Jan-1978 D001 Manager 75000

123 Nitin 10-Oct-1977 D002 AO 59000

129 Navjot 12-Jul-1971 D003 Supervisor 40000

130 Jimmy 30-Dec-1980 D004 Sales Rep


131 Faiz 06-Apr-1984 D001 Dep Manager 65000

Table: DEPARTMENT

DEPTID DEPTNAME FLOORNO


D001 Personal 4
D002 Admin 10
D003 Production 1
D004 Sales 3

i) To display the average salary of all employees,


department wise.

ii) To display name and respective department name of each


employee whose salary is more than 50000.

iii) To increase the salary of employee by 1000 whose


designation is starting with “s”

iv) To display the names of employees whose salary is not


known, in alphabetical order.

OR (Option for IV part only)

To display DEPTID from the table EMPLOYEE without


repetition.

Page 9 of 11
35. Kabir wants to write a program in Python to insert the following (4)
record in the table named Student in SCHOOL database:
Structure of table:
rno(Roll number )- integer
name(Name) - string VARCHAR(20)
stream char(20)
Fee – float

Note the following to establish connectivity between Python


and MySQL:
Username – root, Password - password , Host - localhost

Write the following


Add_display(): to input detail of a student ( fields rno, name,
stream and fee) and store it in the table student.. The function
should then retrieve and display all records from table student
where fee is less than 7000.
SECTION E (2 X 5 = 10 Marks)
36. Kavya is a manager working in a bank. She needs to manage
the records of various accounts. For this she wants the
following information of each bank account to be stored:
Cust_id - ineteger, cust_name, string, ac_no-
inetger , and b_amount-float 2+2+1
You, as a programmer of a bank, have been assigned to do this =(5)
job for Kavya. Suggest:
(i) Write a function add() – To accept and add data of a bank
account to a CSV File ‘[Link]’. Each record consists of
a list with field elements as cust_id, cust_name, ac_no, ,
b_amount respectively.
(ii) search()- read the data from the file “[Link]” and
display the records of those accounts whose balance
amount is less than 10000(if found) otherwise shows the
message “no record found”.
(iii) Write one difference between a binary file and a csv file?
37. ABC limited setup their computer network in the Bangalore (5)
based campus having four buildings. Each block has a number
of computers that are required to be connected for ease of
communication, resource sharing and data security. You are
required to suggest the best answers to the questions i) to v)
keeping in mind the building layout on the campus.
Page 10 of 11
HR
Development

Admin
Logistics

Number of Computers
Block Number of computers
Development 100
HR 120
Admin 200
Logistics 110
Distance Between the various blocks
Block Distance
Development to HR 50m
Development to Admin 75m
Development to Logistics 120m
HR to Admin 110m
HR to Logistics 50m
Admin to Logistics 140m

i) Suggest the most appropriate block to host the


Server. Also justify your choice.
ii) Suggest the device that should be placed in the
Server building so that they can connect to Internet
Service Provider to avail Internet Services.
iii) Suggest the wired medium and draw the cable block to
block layout to economically connect the various
blocks.
iv) Suggest the placement of Switches and Repeaters in
the network with justification.
V) Suggest the high-speed wired communication medium
between Bangalore Campus and Mysore campus to
establish a data network.
Or
Suggest a device/software to be installed to take care
of data security

********** END OF QUESTION PAPER **********

Page 11 of 11
KENDRIYA VIDYALAYA SANGATHAN, RAIPUR REGION
FIRST PRE-BOARD EXAM (2024-25)
SUB: COMPUTER SCIENCE (Python) (083)
CLASS: XII
Max Marks: 70 TIME: 03 HOURS
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.

PART A
01 Which exception is raised when attempting to access a non-existent file? 1
(a) FileNotFoundError
(b) FileNotAccessibleError
(c) NonExistentFileError
(d) InvalidFileAccessError
02 Find the output of the following code. 1
Name=” PythoN3@1”
R=” “
for x in range(len(Name)):
if Name[x]. isupper():
R=R+Name[x]. lower ()
elif Name[x]. islower():
R=R+Name[x]. upper ()
elif Name[x]. isdigit:
R=R+Name[N-1]
else:
R=R+”#”
Print(R)
(a) pYTHOn##@ (b) pYTHOnN#@
(c) pYTHOn#@ (d) pYTHOnN@#
03 Which of the following is the correct output for the execution of the following 1
Python statement?
print (5 + 3 ** 2 / 2)
(a) 32 (b) 8.0 (c) 9.5 (d) 32.0
04 What is the output of the expression? 1
country='International'
print([Link]("n"))
(a) ('I', 'ter', 'atio', 'al’)
(b) ['I', 'ter', 'atio', 'al']
(c) ['I', 'n', 'ter', 'n', 'atio', 'n', 'al']
(d) Error
05 What will be the output of the following Python code? 1
print ('1Rn@’. lower ())
(a) n (b) 1rn@ (c) rn (d) r
06 What will be the output of the following Python code? 1
>>>t= (1,2,4,3)
>>>t [1: -1]
(a) (1, 2) (b) (1, 2, 4)
(c) (2, 4) (d) (2, 4, 3)
07 Which of the following statements create a dictionary? 1
(a) d = { }
(b) d = {“john”:40, “peter”:45}
(c) d = {40:” john”, 45:” peter”}
(d) All of the mentioned
08 Which will be the output for the following Python statement 1
L= [10,20,30,40,50]
L=L+5
Print(L)
(a) [10,20,30,40,50,5]
(b) [15,25,35,45,55]
(c) 5,10,20,30,40,50
(d) Error
09 Suppose t = (1, 2, 4, 3), which of the following is incorrect? 1
(a) print (t [3]) (b) t [3] = 45
(c) print(max(t)) (d) print(len(t))
10 Write the missing statement: To write the string "Hello, World!" to a file in Python, 1
use the following code:
with open ('[Link]', 'w') as file:
___________
(a) [Link]('Hello, World!') (b) [Link]('Hello, World!')
(c) [Link]('Hello, World!') (d) [Link]('Hello, World!')
11 Which of the following is a valid reason for using a 'finally' block? 1
(a) To clean up resources like closing files or releasing memory
(b) To handle different types of exceptions
(c) To break out of a loop
(d) To define a block of code that will never be executed
12 What will be the output of the following code? 1
def outer_function():
x = 10
def inner_function():
x = 20
print ("Inner:", x)
inner_function()
print ("Outer:", x)
outer_function()
(a) Inner: 10, Outer: 20
(b) Inner: 20, Outer: 20
(c) Inner: 10, Outer: 10
(d) Inner: 20, Outer: 10
13 Which keyword is used to remove redundant data from a relation? 1
14 What pattern should be used in the WHERE clause to find all records where the 1
'email' field contains a domain '[Link]'?
(a) LIKE '%@[Link]'
(b) LIKE '[Link]%'
(c) LIKE '%[Link]%'
(d) LIKE '_example.com'
15 What type of data type is used to store large text values in SQL? 1
(a) VARCHAR (b) INT
(c) TEXT (d) CHAR
16 Which SQL statement would you use to calculate the total sum of the 'price' column 1
in the 'products' table?
(a) SELECT COUNT (price) FROM products;
(b) SELECT SUM (price) FROM products;
(c) SELECT AVG (price) FROM products;
(d) SELECT MAX (price) FROM products;
17 Which of the following protocols is used for secure communication over a computer 1
network?
(a) HTTP (b) FTP
(c) SSH (d) POP
18 Which device is typically used to extend the range of a wireless network by receiving 1
and retransmitting signals?
(a) Hub (b) Router
(c) Repeater (d) Switch
19 Which of the following statements about packet switching is TRUE? 1
(a) Packet switching requires a dedicated path between source and destination.
(b) Packet switching is less efficient than circuit switching.
(c) In packet switching, packets can take different paths to reach the destination.
(d) Packet switching does not support error checking mechanisms.
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): Default arguments in functions allow some arguments to be omitted 1
when the function is called.
Reason (R): Default arguments must be provided from right to left in the parameter
list.
21 Assertion (A): The GROUP BY clause can be used without any aggregate functions in 1
an SQL query.
Reason (R): The GROUP BY clause alone can be used to eliminate duplicate records.
PART B
22 How do tuples and lists in Python illustrate the concepts of mutable and immutable 2
types?
23 Explain the difference between the '==' operator and the 'is' operator in Python. 2
24 (i) 2
(a) How would you add an element 60 to the end of the list my_list = [10, 20, 30, 40,
50]?
OR
(b) Which method would you use to remove the first occurrence of the value 20
from the list my_list = [10, 20, 30, 20, 40]?
(ii)
(a) How do you find the length of the list my_list = [10, 20, 30, 40, 50]?
OR
(b) How can you insert an element 25 at the second position in the list my_list = [10,
20, 30, 40, 50]?
25 What possible output(s) are expected to be displayed on screen at the time of 2
execution of the program from the following code? Also specify the minimum and
maximum values that can be assigned to the variable End.

import random
Colours = [“VIOLET”, “INDIGO”, “BLUE”, “GREEN”, “YELLOW”, “ORANGE”, “RED”]
End = randrange(2) +3
Begin = randrange(End) + 1
for i in range(Begin,End):
print(Colours[i],end=”&”)

(a) INDIGO&BLUE&GREEN
(b) VIOLET&INDIGO&BLUE&
(c) BLUE&GREEN&YELLOW&
(d) GREEN&YELLOW&ORANGE&
26 Rewrite the following code in Python after removing all syntax error(s) and 2
underline each correction done in the code.
30 = num
for k in range (0, num)
IF k%4==0:
print(k*4)
Else:
print(k+3)
27 (i) Satheesh has created a database “school” and table “student”. Now he wants to 2
view all the databases present in his laptop. Help him to write SQL command for
that, also to view the structure of the table he created.
OR
(ii) Meera got confused with DDL and DML commands. Help her to select only DML
command from the given list of command.
28 (a) Explain how a ring topology functions and mention one scenario where it is 2
particularly useful.
OR
(b) Identify and explain the role of the central component in a star topology
network. How does this component affect network performance?
PART C
29 Write a function in Python to count the number of lines in a text fie ‘[Link]’ 3
which start with an alphabet ‘T’.
OR
Write a function in Python that count the number of “can” words present in a text file
“[Link]”.
def count_word():
count=0
f=open("[Link]","r")
contents=[Link]()
word=[Link]()
for i in word:
if i==’can’:
count+=1
print ("Number of words in the File is:”, count)
[Link]( )
count_word( )
30 Julie has created a dictionary containing names and marks as key value pairs of 6 3
students. Write a program, with separate user defined functions to perform the
following operations
Push the key (name of the student) of the dictionary into a stack, where the
corresponding value
(marks) is greater than 75.
Pop and display content of the stack.
For example: If the sample content of the dictionary is as follows
R= {“OM”:76,” JAI”: 45, “BOB”:89, “ALI”:65, “ANU”:90,” TOM”:82}
OR
Alam has a list containing 10 integers. You need to help him create a program with
separate user defined functions to perform the following operations based on this list.
● Traverse the content of the list and push the even numbers into a stack.
● Pop and display the content of the stack.
For Example: If the sample Content of the list is as follows: N=[12, 13, 34, 56, 21,
79, 98, 22, 35, 38] Sample Output of the code should be: 38 22 98 56 34 12
31 Predict the output of the Python code given below: 3
def calculate(str):
text=''
x=range(len(str)-1)
for i in x:
if str[i].isupper():
text+=str[i]
elif str[i].islower():
text+=str[i+1]
else:
text+='@'
return text
start='Pre-board Exam'
final=calculate(start)
print(final)
OR
Predict the output of the Python code given below:
tuple1 = (33, 24, 44, 42, 54 ,65)
list1 =list(tuple1)
new_list = [ ]
for i in list1:
if i>40:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)
PART D
32 (A) 4
T_ID NAME AG SEX DEPT D_O_JOIN SALARY

902 SANDEEP 45 M COMPUTER 10/10/2002 56000


813 SANGEETA 34 F HISTORY 24/9/2010 50000
771 JOEL 48 M ENGLISH 4/5/2001 67900
703 MANVITH 36 M MATHS 27/09/2012 48000
606 NEENA 32 F ENGLISH 23/5/2013 40000
537 ABHILASH 42 M MATHS 6/2/2006 47000
420 MUHSIN 49 M ENGLISH 8/3/2003 70450
412 SUBESH 52 M HINDI 10/11/1999 60500
345 RENJINI 36 F COMPUTER 27/4/2010 45000
218 DEEPTI 28 F HINDI 2/2/2016 40000
160 SHUBHAM 39 M SCIENCE 19/9/2011 45000
Based on the above table, Write SQL command for the following:
i) To show all information about the teacher of maths department
ii) To list name and department whose name starts with letter ‘M’
iii) To display all details of female teacher whose salary in between
35000 and 50000
iv) To display all the List of Subjects taken by the teachers.
OR
(B)Write the outputs of the SQL queries (i) to (iv) based on the relations Teacher and
Placement given below:
BOOK
Book_id Book_name Price Qty Author_id
1001 My first C++ 323 12 204
1002 SQL basics 462 6 202
1003 Thunderbolts 248 10 203
1004 The tears 518 3 204
AUTHOR
Author_id Author_name Country
201 William Hopkins Australia
202 Anita India
203 Anna Roberts USA
204 Brain&Brooke Italy
(i) SELECT Author_id, avg(price) FROMBOOK GROUP BYAuthor_id;
(ii) SELECT MAX (price), MIN (price) FROM BOOK;
(iii) SELECTBook_name,Author_name,countryFROM BOOK B, AUTHOR A
WHERE B.Author_id = A.Author_id AND price>300;
iv) SELECT Author_name FROM AUTHOR WHERE Author_nameLIKE “A%”;
33 Mr. Rao is writing a program to create a csv file “[Link]” which will contain 4
user name and password for department entries. He has written the following code.
As a programmer, help him to successfully execute the given task.
import ---------------- #statement 1
def add_emp(username,password):
f=open (‘[Link]’,’----------‘) # statement 2
content=[Link](f)
[Link]([username,password])
[Link]()
def read_emp( ):
with open (‘[Link]’,’r’) as file:
content_reader=csv.-------------------(file) # statement 3
for row in content_reader:
print (row [0], row [1])
[Link]( )
add_emp(‘mohan’,’emp123#’)
add_emp(‘ravi’,’emp456#’)
read_emp() #statement 4
i) Name the module he should import in statement 1
ii) In which mode, Mr. Rao should open the file to add record in to the file?
iii) Fill in the blank in statement 3 to read the record from a csv file
iv) What output will he obtain while executing statement 4?
34 Rahul created following table TRAVEL to store the travel details 4

Based on the data given above answer the following questions:


(i) Identify the most appropriate column, which can be considered as Primary key.
(ii) If 3 columns are added and 1rows are deleted from the table TRAVEL, what will
be the new degree and cardinality of the above table?
(iii) Write the statements to:
(a) Insert the following record into the table
110 BIMAL 28-11-2022 200 VOLVO 40
(b) Increase KM travelled by 10 if the VTYPE is VOLVO.
OR (Option for part iii only)
(iii) Write the statements to:
(a) Delete the record of travel of traveler NANDA.
(b) Add a column MILEAGE in the table with data type as
integer
35 The code given below inserts the following record in the table Employee: 4
Empid – integer Name – string salary-float
Note the following to establish connectivity between Python and MYSQL:
• Username is root
• Password is tiger
• The table exists in a MYSQL database named Empolyee.
• The details (Empid, Name, salary) are to be accepted from the user.
Write the following missing statements to complete the code:
Statement 1 – to import correct library
Statement 2 – to form the cursor object
Statement 3 – to execute the command that inserts the record in the table Employee.
Statement 4- to add the record permanently in the database
import _____________ #STATEMENT1
from [Link] import Error
connection = [Link](host='localhost', database='Employee',
user='root', password='tiger')
cursor=_______________________#STATEMENT2
empid=int (input ("enter Empid"))
name=input ("enter name")
salary=float (input ("ENTER SALARY"))
result = __________________________#STATEMENT3
___________________________________#STATEMENT4

PART E
36 i) What is the difference between ‘r’ and ‘rb’ mode in Python file? 5
r is used to read text files and rb is used to read binary files
(1 mark for each correct output)
ii) A binary file “[Link]” has structure [admission_number,
Name, Percentage]. Write a function countrec( ) in Python that would
read contents of the file “[Link]” and display the details of
those students whose percentage is above 90. Also display number of
students scoring above 90%
import pickle
def countrec():
fobj=open(‘[Link]’,’rb’)
num=0
try:
while True:
rec=[Link](fobj)
if rec [2]>90:
num=num+1
print (rec [0], rec [1], rec [2])
except:
[Link]()
return num
37 The USA-based company, Micron, has selected Tata Projects to build the 5
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:
Training Campus Research Campus 3 KM
Business Campus warehousing 4.5 KM
Manufacturing Campus Research Campus 1.5 KM
Warehousing Training Campus 9.5 KM
Research Campus Business Campus 3.5 KM
Warehousing Campus Research Campus 2.6 KM
Research Campus New Delhi Head Office Campus 962KM

Number of computers installed at various locations are as follows:


Warehousing Campus 20 computers
Research Campus 200 computers
Business Campus 10 computers
Training Campus 25 computers
Manufacturing Campus 15 Computers
Ahmedabad Admin Campus 15 Computers
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

*****
KENDRIYA VIDYALAYA SANGATHAN RANCHI REGION
PRE-BOARD EXAMINATION 2024-25
CLASS XII SUBJECT: COMPUTER SCIENCE SET-5
TIME ALLOWED: 3 HOURS MAXIMUM MARKS:70
General Instructions:
• Please check this question paper contains 37 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.
• Section B, C, and D contains questions of internal choice.
• All programming questions are to be answered using Python Language only.

Ques Question Marks


No
Section A
1 Find the invalid identifier from the following 1
a) MyName b) true c) 2ndName d) My_Name
2 Given the lists L= [1,2,3,4,5,20,25,92], write the output of print(L[3:5]) 1
3. How many times is the word “HELLO” printed in the following statement? 1
S=’KVS RO Ranchi’
for ch in s[3:8] :
print(“HELLO”)
4. If a = ‘8’, what will be the result of a*2 + str(int(a)*2) 1
a) ‘32’ b) ‘1616’ c) ‘8888’ d) Error
5. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after [Link](1)? 1
a) [3, 4, 5, 20, 5, 25, 1, 3] b) [1,3,3, 4, 5, 20, 5, 25]
c) [3, 5, 20, 5, 25, 1, 3] d) [1, 3, 4, 5, 20, 5, 25,]
6 Which of the following expressions evaluates to False? 1
a) True and (not)False b) True or False
c)not (False and True) d) False and not (False)
7 What will be the output of the following code? 1
tup1 = (10, 20, 30)
tup2 = tup1
tup1 +=(40,)
print(tup1 == tup2)
a) True b) False c) tup1 d) Error
8 What will be the output of the following code? 1
Lst1= [1,2]
Lst2=Lst1
if Lst1 is Lst2:
print(True)
else:
print(False)
a) True b) False c) [1,2] d) Error
9 In Python, Dictionaries are immutable 1
a) False b) True
10. Which one is incorrect ways to copy a dictionary in Python 1
a)dict2 = [Link]() b)dict2 = dict(dict1)
c)dict2 = dict1 d)dict2 =copy(dict1)
11. State whether the following statement is True or False: 1
The except block in Python is executed only if no exception occurs in the try block.
12. Write the output of the following code 1
def show(a,b):
print(a,b)
show(4,b=5)
13. Rahul wants to add the content in existing Binary file. Suggest him which file opening mode will 1
be used to open file for writing.
Page 1 of 5
14. Which protocol is used to send emails over the Internet? 1
a) HTTP b) SMTP c) FTP d) PPP
15. Which of the following Cable provides highest speed transmission? 1
a) Optical Fibre b) Co-axial c) Twisted Pair d) None of the above
16. Identify the class of the following IP Address 1
[Link]
a) Class-A b) Class-B c) Class-C d) Class-D
17 In SQL, name the clause that is used to display the tuples in ascending order of an attribute. 1
18 Which of the following is a DDL command? 1
a) SELECT b) ALTER c) INSERT d) UPDATE
19 What will be the output of the query? 1
SELECT * FROM student WHERE name LIKE 'R%';
a) Display all the Details of all students whose names start with 'R'
b) Display all the Details of all students whose names end with 'R'
c) Display only Names of all students whose names start with 'R'
d) Display only Names of all students whose names end with 'R'
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): SQL is a language which provide the facility to handle database. 1
Reasoning (R): For handling the database SQL provide a Set of commands
21. Assertion (A): A SELECT command in SQL can have multiple clauses. 1
Reasoning (R): Delete command is used to remove the table from database
Section B
22. Explain the difference between mutable and immutable object in Python with example 2
23. What is dynamic typing? Explain with example. 2
OR
Explain String Slicing with example
24. Find the output: 2
for a in range(1,4):
if a%2==0:
break
print(a)
else:
print(“Ending Loop”)
25. Find the output: 2
d={1:’a’,2:’e’,3:’I’}
print(d[1])
print([Link]( ))
print([Link]( ))
print(d[3])
26. Differentiate between HTTP server and HTTP client 2
OR
Define the benefits of HTTPS over HTTP
27 Write about any 4 aggregate functions available in SQL. 2
OR
Define All the Clauses of SELECT Command
28. What’s the difference between CHAR and VARCHAR?. 2
Section C
29. [Link] file contains the following content 3
This is my file
Made glorious summer by this sun of York
And all the clouds that lour'd upon our house
In the deep bosom of the ocean buried

Find the output of the given code


with open("[Link]", "r") as file:
Page 2 of 5
lines = [Link]()
print("File Content:")
for line in lines:
print(line)
print("\nNumber of lines:", len(lines))

OR
Find the output of the given code using above file
with open("[Link]", "r") as file:
for i in range(3):
line = [Link]()
if line:
print(line)
else:
break
30. Write a function in Python PUSH_ODD(Arr), where Arr is a list of numbers. From this list, push 3
all odd numbers into a stack implemented by using a list.
OR
Write a function in Python POP_STACK(Arr), where Arr is a stack implemented by a list of
numbers. The function should pop two values from the stack if possible and return them. If not
enough elements are present in the stack, display an appropriate error message
31. Write the full forms of DDL and DML. Explain any two commands of DML in SQL with 3
example.
Section-D
32 Explain exception handling in Python. What are try, except, and finally blocks? Provide an 4
example.
33. EmpID EmpName Salary Department 4
101 Aarav Sharma 50000 HR
102 Priya Singh 60000 Finance
103 Rohan Patel 55000 HR
104 Neha Gupta 70000 IT
105 Vikram Mehta 65000 Finance
106 Sneha Desai 75000 IT
107 Arjun Verma 80000 HR
Using the above table write the output of the following query
1. SELECT EmpName, Salary FROM Employees WHERE Salary >= (SELECT DISTINCT
Salary FROM Employees ORDER BY Salary DESC
2. SELECT Department, sum(Salary) count(*) FROM Employees
3. SELECT EmpName, Salary FROM Employees WHERE Department =”IT”
4. SELECT EmpName, Salary FROM Employees WHERE Salary > (SELECT AVG(Salary)
FROM Employees)
OR
Define the followings
1. Primary Key
2. Foreign Key
3. Database Schema
4. Join
34. Write the output of the following code with justification if the contents of the file [Link] are: 4
Welcome to Python Programming!
f1 = file("[Link]", "r")
size = len([Link]())
print(size)
data = [Link](5)
print(data)
35. Write the following missing statements to complete the code: 4
import [Link] as mydb
mycon = mydb.______ #Statement 1
(host = “localhost”,user = “root”,

Page 3 of 5
passwd = “system”,database = “Admin”)
cursor = _______________ #Statement 2
sql = “SELECT * FROM student WHERE class=XII”
cursor.__________________ #Statement 3
display = cursor.________ # Statement 4
for i in display:
print(i)
[Link] ( )
Section-E
36. Planoteria is a knowledge and skill community which has an aim to uplift the standard of 5
knowledge and skills in the society. It is planning to set-up its training centers in multiple towns
and villages in India with its head offices in the nearest cities. They have created a model of their
network with a city, a town and 3 villages as follows. As a network consultant, you have to
suggest the best network related solutions for their issues/problems raised in (i) to (v) keeping in
mind the distances between various locations and other given parameters.

Distance between different locations


Village – 1 to B_Town 2 KM
Village – 2 to B_Town 1 KM
Village – 3 to B_Town 1.5 KM
Village – 1 Village –2 3.5 KM
Village –1 Village –3 4.5 KM
Village –2 Village –3 2.5 KM
A_CITY Head Office – B_Hub 25 KM
Number of computers
B_Town 120PC
Village – 1 15PC
Village – 2 10PC
Village – 3 15PC
A_CITY Head Office 6PC
NOTE: In Villages, there are community centers, in which one room has been given as training
center to this organization to install computers. The organization has got financial support from
the government and top IT companies.

1. Suggest the most appropriate location of the SERVER in the B_HUB (out of the 4
locations), to get the best and effective connectivity. Justify your answer.
2. Suggest the best wired medium and draw the cable layout (location to location) to
efficiently connect various location within the B_HUB.
3. Which hardware device will you suggest to connect all the computers within each
location of B_HUB?
4. Which service/protocol will be most helpful to conduct live interactions of Experts from
Head Office and people at all locations of B_HUB?
5. Which hardware device will you suggest to be procured by the company to be installed
to protect and control the Internet uses within the campus?

Page 4 of 5
37. Ranjeet wants to write a program in Python to copy the contents of [Link] to [Link]. Help him 3+2
to complete the code.
import pickle
def copy_binary_file(source, dest):
with open(source, '_____') as src_file: #Statement1
data = pickle._______(src_file) #Statement2
with open(dest,'wb') as dest_file:
pickle._____(data, dest_file) #Statement3
print(“Copied from”,source,”to”,dest, successfully.")
source_file = '[Link]'
dest_file = '[Link]'
copy_binary_file(source_file, dest_file)
Explain the difference between text files and binary files. Why might you choose to use binary
files over text files for certain applications?

---xxx—

Page 5 of 5
KENDRIYA VIDYALAYA SANGATHAN SILCHAR REGION
PRE BOARD EXAMINATION-2024-25

CLASS-XII TIME: 3HOURS


SUBJECT: COMPUTER SCIENCE (083) [Link]

General Instructions:
i) This question paper contains 37 questions.
ii) All questions are compulsory. However, internal choices have been provided in some questions.
iii) Attempt only one of the choices in such questions
iv) The paper is divided into 5 Sections- A, B, C, D and E.
v) Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
vi) Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
vii) Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
viii) Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
ix) Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
x) 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 = 21Marks)


1 State True or False: 1M
The Value of the expression 4/(3*(4-2)) and 4/3*(4-2) is the same.
2 Identify the output of the following code snippet: 1M
String1=”my”
String2=”work”
print([Link]+[Link]())

(A) MyWork (B)myWork (c)MYwork (d)myWORK


3 Consider the given expression: 1M
not True and False or True
Which of the following will be correct output if the given expression is
evaluated?
(A) True
(B) False
(C) NONE
(D) NULL
4 Select the correct output of the Code: 1M
a = "Year 2022 at All the best"
a = [Link]('2')
b = a[0] + ". " + a[1] + ". " + a[3]
print (b)

(A) Year . 0. at All the best


(B) Year 0. at All the best
(C) Year . 022. at All the best
(D) Year . 0. at All the best
5 Given the lists L=[1,3,6,82,5,7,11,92] , write the output of print(L[2:5]) 1M
6 Which of the following statement(s) would give an error during execution of the 1M
following code?
tup = (20,30,40,50,80,79)
print(tup) #Statement 1
print(tup[3]+50) #Statement 2
print(max(tup)) #Statement 3
tup[4]=80 #Statement 4

Options:
(A) Statement 1 (B) Statement 2(C) Statement 3 (D) Statement 4
7 Suppose d = {“john”:40, “peter”:45}, what happens when we try to retrieve a value 1M
using the expression d[“susan”]?
(A) Since “susan” is not a value in the set, Python raises a KeyError exception
(B) It is executed fine and no exception is raised, and it returns None
(C) Since “susan” is not a key in the set, Python raises a KeyError exception
(D) Since “susan” is not a key in the set, Python raises a syntax error
8 Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list after [Link](1)? 1M
(A) [3, 4, 5, 20, 5, 25, 1, 3]
(B) [1, 3, 3, 4, 5, 5, 20, 25]
(C) [3, 5, 20, 5, 25, 1, 3]
(D) [1, 3, 4, 5, 20, 5, 25]
9 _________ is a non-key attribute, whose values are derived from the primary key of 1M
some other table.
(A) Primary Key
(B) Foreign Key
(C) Candidate Key
(D) Alternate Key
10 Which of the following functions gives the position of file pointer? 1M
(A) flush()
(B) tell()
(C) seek()
(D) offset()
11 State whether the following statement is True or False: 1M
An exception may be raised even if the program is syntactically correct.
12 What will be the output of the following code? 1M
V=50
N=40
def Change(N):
global V
V,N = N,V
(A) print(V, N, sep = “#",end = "@")
(A) 20#50@20 (B) 40#50@ (C) 50#50@ (D)20@50#20
13 In SQL, write the query to display the list of Databases stored in a database 1M
14 What will be the output of the query? 1M
SELECT * FROM student WHERE student_city LIKE '%pur';
(A) Details of all student_city whose names start with 'pur'
(B) Details of allstudent_city whose names end with 'pur'
(C) Names of allstudent_city whose names start with 'pur'
(D) Names of allstudent_city whose names end with 'pur'
15 Which of the following types of table constraints will prevent the entry of duplicate 1M
rows?
(A) Unique
(B) Distinct
(C) Primary Key
(D) NULL
16 The SELECT statement when combined with __________ clause, returns records 1M
without repetition.
(a) DESCRIBE
(b) UNIQUE
(c) DISTINCT
(d) NULL
17 ______is a communication methodology designed to deliver both voice 1M
and multimedia communications over Internet protocol.
(a) VoIP (b) SMTP (c) PPP (d)HTTP

18 Which network device is used to connect two dissimilar networks? 1M


(A) Modem
(B) Gateway
(C) Switch
(D) Repeater
19 In case of _____________ switching, before a communication starts, a dedicated 1M
path is identified between the sender and the receiver
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct 1M
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):- If the arguments in function call statement match the number and 1M
order of arguments as defined in the function definition, such arguments are called
positional arguments.
Reasoning (R):- During a function call, the argument list first contains default
argument(s) followed by positional argument(s).
21 Assertion (A):- In SQL, the aggregate function AVG() calculates the value on a set of 1M
values and produces a single result
Reasoning (R):-The aggregate functions are used to perform some fundamental
arithmetic tasks such as Min(), Ma(),Sum() etc
Section-B ( 7 x 2=14 Marks)
22 What is the difference between List and Tuple? Give an example for each 2M
23 What will the following expression be evaluated to in Python? 2M
print(15.0 / 4 + (8 + 3.0))
24 Write the Python statement for each of the following tasks using BUILT-IN 2M
functions/methods only:
(i) To insert an element 200 at the third position, in the list L1.
(ii) To check whether a string named, message ends with a full stop / period
or not.
OR
A list named studentAge stores age of students of a class. Write the Python
command to import the required module and (using built-in function) to display the
most common age value from the given list.
25 What possible outputs(s) are expected to be displayed on screen at the time of execution of 2M
the program from the following code?
Also specify the maximum values that can be assigned to each of the variables Lower and
Upper.

import random
AR=[20,30,40,50,60,70];
Lower =[Link](1,3)
Upper =[Link](2,4)
for K in range(Lower, Upper +1):
print (AR[K],end=”#“)
(A) 10#40#70# (B) 30#40#50# (C) 50#60#70# (D) 40#50#70#
26 Sudha has written a code to input a number and check whether it is prime or not. Her 2M
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. What do you understand by Candidate Keys in a table? 2M
OR
B. Write any two commands of DML in SQL.

(II) [Link] between count() and count(*) functions in SQL with appropriate
example.
OR
[Link] the following commands as DDL or DML:
INSERT, UPDATE, ALTER, DROP

28 (A) List one advantage and one disadvantage of Bus topology 2M


OR

(B)Expand the following terms:


POP3 , URL
Section-C ( 3 x 3 = 9 Marks)
29 Write a method COUNTLINES() in Python to read lines from text file 3M
‘[Link]’ and display the lines which are not starting with any vowel.
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 COUNTLINES() function should display the output as:
The number of lines not starting with any vowel – 1

OR
Write a function AMCount() in Python, which should read each character of a text file
[Link], should count and display the occurrence of alphabets A and M
(including small cases a and m too).
Example: If the file content is as follows:
Updated information As simplified by official websites.
The EUCount() function should display the output as:
A or a:4 M or m :2
30 (A)Write a function in Python PUSH(Arr), where Arr is a list of numbers. From this 3M
list push all numbers divisible by 5 into a stack implemented by using a list. Display
the stack if it has at least one element, otherwise display appropriate error message.
OR
(B)Write a function in Python POP(Arr), where Arr is a stack implemented by a list of
numbers. The function returns the value deleted from the stack.
31 Write the output for the following python code: 3M
defQuo_Mod (L1):
[Link]([33,52])
for i in range(len(L1)):
if L1[i]%2==0:
L1[i]=L1[i] /5
else:
L1[i]=L1[i]%10
L=[100,212,310]
print(L)
Quo_Mod(L)
print(L)
OR
Suppose the content of”;[Link]” is
Python is an interactive language
What will be the output of the following code?

myfile = open(“[Link]”)
vlist = list(“aeiouAEIOU”)
vc=0
x = [Link]()
for y in x:
if(y in vlist):
vc+=1
print(vc)
[Link]()
Section-D ( 4 x 4 = 16 Marks)
32 Consider the table TRANSACT given below 4M
Table: TRANSACT
TRNO ANO AMOUNT TYPE DOT
T001 101 2500 Withdraw 2017-12-21
T002 103 3000 Deposit 2017-06-01
T003 102 2000 Withdraw 2017-05-12
T004 103 1000 Deposit 2017-10-22
T005 101 12000 Deposit 2017-11-06
(A) Write the output of the queries (a) to (d) based on the table
(I) To display minimum amount transaction from the table
(II) To display total amount withdrawn from table.
(III)To display ANO, DOT, AMOUNT for maximum amount transaction.
(IV)To display all information DOT wise
OR
(B)Write the output

(I) Select ANO, sum(AMOUNT) as from Transact group by ANO;


(II) Select * from TRANSACT AMOUNT> 2000 ;
(III) Select TRNO,AMOUNT,TYPE,DOT from TRANSACT where DOT>”2017-01-06”
from TRANSACT;
(IV) Select AVG(AMOUNT) from TRANSACT;
33 Jahnav is a Python programmer working in a school. For the Annual Sports Event, 4M
he has created a csv file named [Link], to store the results of students in
different sports events. The structure of [Link] is :
[St_Id, St_Name, Game_Name, Result]
Where
St_Id is Student ID (integer)
ST_name is Student Name (string)
Game_Name is name of game in which student is participating(string)
Result is result of the game whose value can be either 'Won', 'Lost' or 'Tie'
For efficiently maintaining data of the event, Jahnav wants to write the following user
defined functions:
Accept() – to accept a record from the user and add it to the file [Link]. The
column headings should also be added on top of the csv file.
wonCount() – to count the number of students who have won any event.
As a Python expert, help him complete the task.
34 Consider the following tables TRAINER and COURSES. Write SQL commands for 4M
the
statements (a) to (d)
TRAINER
TID TNAME CITY HIREDATE SALARY
101 SUNAINA MUMBAI 1998-10-15 90000
102 ANAMIKA DELHI 1994-12-24 80000
103 DEEPTI CHANDIGARG 2001-12-21 82000
104 MEENAKSHI DELHI 2002-12-25 78000
105 RICHA MUMBAI 1996-01-12 95000
106 MANIPRABHA CHENNAI 2001-12-12 69000

COURSE

CID CNAME FEES STARTDAT TID


E
C201 AGDCA 12000 2018-07-02 101
C202 ADCA 15000 2018-07-15 103
C203 DCA 10000 2018-10-01 102
C204 DDTP 9000 2018-09-15 104
C205 DHN 20000 2018-08-01 101
C206 O LEVEL 18000 2018-07-25 105

a)Display the Trainer Name, City & Salary in descending order of their Hiredate.
b)To display the TNAME and CITY of Trainer who joined the Institute in the Month of
December 2001.
c)To display TNAME, HIREDATE, CNAME, STARTDATE from tables TRAINER and
COURSE of all those courses whose FEES is less than or equal to 10000.
d)To display number of Trainers from each city.
35 A table, named ClassXII, in Student database, has the following structure: 4M
Field Type
RollNo int(11)
Name varchar(15)
Marks float
RegNo int(11)
Write the following Python function to perform the specified operation:
Display(): To input details of a student and store it in the table [Link] function should
then retrieve and display all records from the ClassXII table where the Marks is greater than
80.
Assume the following for Python-Database connectivity: Host: localhost, User: root,
Password: KVS
SECTION E (2 X 5 = 10 Marks)
36 Raghu is a HR manager working in a reputedcompany. He needs to manage the 5M
records of various employees. For this, he wants the following information of each
employee to be stored: - Emp_ID – integer
- Emp_Name – string
- Designation – string
- Experience – float
You, as a programmer of the company, have been assigned to do this job for Raghu.

(I) Write a function to input the data of employees and append it in a binary file.
(II) Write a function to update the data of employees 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 employees who are not "Senior Manager".
37 Global University is setting up its academic blocks at Jaipur and is planning to set up 5M
a network. The University has 3 academic blocks and one Human Resource Center
as shown in the diagram below:

Center to Center distances between various blocks/center is as follows:


Law Block to Business Block 40 m
Law Block to Technology Block 80 m
Law Block to HR Centre 105 m
Business Block toTechnology Block 30 m
Business Block to HR Centre 35 m
Technology Block to HR Centre 15 m

Number of computers in each of the blocks/Center is as follows:


Law Block 15
Business Block 25
Technology Block 40
HR Centre 115

I) Suggest the most suitable place (i.e., Block/Center) to install the server of this University
with a suitable reason.
II) Suggest an ideal layout for connecting these blocks/centers for a wired connectivity.
III) Which device will you suggest to be placed/installed in each of these blocks/centers to
efficiently connect all the computers within these blocks/centers?
IV) Suggest the placement of a Repeater in the network with justification.
V) [Link] Global university is planning to connect its admission office in Banglore, which is
more than 1650km from university. Which type of network out of LAN, MAN, or WAN will be
formed? Justify your answer.
OR
B. What would be your recommendation for enabling live visual communication
between the HR Centre at the Jaipur and the Banglore admissions office from the
following options:
a) Video Conferencing b) Email c) Telephony d) Instant Messaging
FIRST PRE BOARD EXAM (2024-25)
CLASS-XII
SUBJECT- COMPUTER SCIENCE(083)
QP12ACS01PB24
TIME-3:00 HRS Max Marks-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.
 This question paper contains five sections, Section A to E.
 Section A have 21 questions (1 to 21) carrying 01 mark each.
 Section B has 07 questions (22 to 28) carrying 02 marks each.
 Section C has 03 questions (29 to 31) carrying 03 marks each.
 Section D has 04 questions (32 to 35) carrying 04 marks each.
 Section E has 02 questions (36 to 37) carrying 05 marks each.
 All programming questions are to be answered using Python Language only.
 In case of MCQs, text of the correct answer should also be written.
SECTION A
1. State True or False 1
“Variable declaration is implicit in Python.”
2. Which of the following is an invalid datatype in Python? 1
(a) Set (b) None
(c) Integer (d) Real
3. Given the following dictionaries 1
dict_exam={"Exam":"AISSCE", "Year":2025}
dict_result={"Total":500, "Pass_Marks":165}
Which statement will merge the contents of both dictionaries?
(a) dict_exam.update(dict_result) (b) dict_exam + dict_result
(c) dict_exam.add(dict_result) (d) dict_exam.merge(dict_result)
4. Consider the given expression: 1
not True and False or True
Which of the following will be correct output if the given expression isevaluated?
(a) True (b) False
(c) NONE (d) NULL
5. Select the correct output of the code: 1
a = "Year 2022 at All the best"
a = [Link]('2')
b = a[0] + ". " + a[1] + ". " + a[3]
print (b)
(a) Year . 0. at All the best
(b) Year 0. at All the best
(c) Year . 022. at All the best
(d) Year . 0. at all the best
6. Which of the following mode in file opening statement results or generates an error if the 1
file does not exist?
(a) a+ (b) r+ (c) w+ (d) None of the above
7. Fill in the blank: 1
command is used to remove primary key from the table in SQL.
(a) update (b)remove (c) alter (d)drop
8. Which of the following commands will delete the table from MYSQL database? 1
(a) DELETE TABLE (b) DROP TABLE
(c) REMOVE TABLE (d) ALTER TABLE
9. Which of the following statement(s) would give an error after executing the 1
following code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Thank you" # Statement 5
(a) Statement 3
(b) Statement 4
(c) Statement 5
(d) Statement 4 and 5
10. Fill in the blank: 1
is a non-key attribute, whose values are derived from the primary key of some
other table.
(a) Primary Key (b) Foreign Key
(c) Candidate Key (d) Alternate Key
11. The correct syntax of seek() is: 1
(a) file_object.seek(offset [, reference_point])
(b) seek(offset [, reference_point])
(c) seek(offset, file_object)
(d) seek.file_object(offset)
12. Fill in the blank: 1
The SELECT statement when combined with clause, returns records
without repetition.
(a) DESCRIBE (b) UNIQUE
(c) DISTINCT (d) NULL
13. Fill in the blank: 1
is a communication methodology designed to deliver both voiceand multimedia
communications over Internet protocol.
(a) VoIP (b) SMTP (c) PPP (d)HTTP
14. What will the following expression be evaluated to in Python? 1
print(15.0 / 4 + (8 + 3.0))
(a) 14.75 (b)14.0 (c) 15 (d) 15.5
15. Which function is used to display the total number of records from table in a database? 1
(a) sum(*) (b) total(*)
(c) count(*) (d) return(*)
16. To establish a connection between Python and SQL database, connect() is used. Which of 1
the following arguments may notnecessarily be given while calling connect()?
(a) host (b) database
(c) user (d) Password
17. What is the scope of a variable defined outside of any function? 1
(a) Global scope (b) Local scope
(c) Module- scope (d) Function- scope
18. How do you check if a file exists before opening it in Python? 1
a) Use the exists() function from the os module
b) Use the open() function with the try-except block
c) Use the isfile() function from the [Link] module
d) All of the above
19. Which type of network consists of both LANs and MANs? 1
(a) Wide Area Network (b) Local Area Network
(c) Both a and b (d) None of the above
Q20 and 21 are ASSERTION AND REASONING 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):- If the arguments in function call statement match the number and order of 1
arguments as defined in the function definition, such arguments are called positional
arguments.
Reasoning (R):- During a function call, the argument list first contains default argument(s)
followed by positional argument(s).
21. Assertion (A): CSV (Comma Separated Values) is a file format for datastorage which looks 1
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
22. Rao has written a code to input a number and check whether it is prime or not. His code is 2
having errors. Rewrite the correct code andunderline 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’)
23. Write two points of difference between Circuit Switching and PacketSwitching. 2

OR

Write two points of difference between XML and HTML.


24. (a) Given is a Python string declaration: 1
myexam="@@CBSE Examination 2022@@"
Write the output of: print(myexam[::-2])
(b) Write the output of the code given below:
my_dict = {"name": "Aman", "age": 26} 1
my_dict['age'] = 27
my_dict['address'] = "Delhi"
print(my_dict.items())
25. Explain the use of „Foreign Key‟ in a Relational Database Management System. Give 2
example to support your answer.
26. (a) Write the full forms of the following: 2
i. SMTP (ii) PPP

(b) What is the use of TELNET?


27. Predict the output of the Python code given below: 2

def Diff(N1,N2):if
N1>N2:
return N1-N2
else:
return N2-N1

NUM= [10,23,14,54,32]
for CNT in range (4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')

OR

Predict the output of the Python code given below:

tuple1 = (11, 22, 33, 44, 55 ,66)


list1 =list(tuple1)
new_list = []
for i in list1:if
i%2==0:
new_list.append(i) new_tuple = tuple(new_list)
print(new_tuple)
28. Differentiate between count() and count(*) functions in SQL withappropriate example. 2

OR

Categorize the following commands as DDL or DML:INSERT, UPDATE, ALTER, DROP


SECTION C
29. (a) Consider the following tables – Bank_Account and Branch: 1+2

What will be the output of the following statement?


SELECT * FROM Bank_Account NATURAL JOIN Branch;
(b)Write the output of the queries (i) to (iv) based on the given table,
i. SELECT DISTINCT TID FROM TECH_COURSE;
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;
30. Write a method COUNTLINES() in Python to read lines from text file „[Link]‟ 3
and display the lines which are not starting with any vowel. 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. T

he COUNTLINES() function should display the output as:


The number of lines not starting with any vowel - 1

OR

Write a function ETCount() in Python, which should read each character of a text file
“[Link]” and then count and display the count of occurrence of alphabets E
and T individually (includingsmall cases e and t too).

Example:

If the file content is as follows:

Today is a pleasant day. It might


rain today.
It is mentioned on weather sites

The ETCount() function should display the output as:E or e: 6


T or t : 9
31. (a) Write the outputs of the SQL queries (i) to (iv) based on the relations Teacher and 2+1
Placement given below:
i. SELECT Department, avg(salary) FROM Teacher GROUP BY
Department;
ii. SELECT MAX(Date_of_Join),MIN(Date_of_Join) FROM
Teacher;
iii. SELECT Name, Salary, [Link], Place FROM
Teacher T, Placement P WHERE [Link] =
[Link] AND Salary>20000;
iv. SELECT Name, Place FROM Teacher T, Placement P
WHERE Gender =’F’ AND [Link]=[Link];
(b) Write the command to view all tables in a database.
SECTION D
32. (a) What will be the output of the following code? 2+2
x = 3
def myfunc():
global x
x+=2
print(x, end=' ')
print(x, end=' ')
myfunc()
print(x, end=' ')
(b)Consider the code given below
Import_______as sqltor
conn=[Link](host='localhost',user='john',password=''
,database='test')
cursor=_________________
query =__________________
[Link](query)
data=______________
for row in data:
print(row)

The above code displays all details of students present in the table Student whose marks are
more than and grade is „B‟ using Python MySQL connectivity. Complete the missing code
by fill in the blanks.
33. (a) differentiate dump() and load() in the context of binaryfile. 2+2
(b) Write a Program in Python that defines and calls the following user defined functions:
i. add() – To accept and add data of a Product to a CSV file „[Link]‟.Each record
consists of a list with field elements as pid, pname and price to store Product id,
Product name and Product price respectively.
ii. search()- To display the records of the Product whose price is more than 20000 and
product name starting with a vowel.
34. Write a program to create a Stack of Students containing 5 records each record structured as 4
[Roll, Name, Percentage of marks].Perform the following:
a) Display all the details of the Student who got the highest percentage of marks.
b) Insert a new Record to a Stack.
c) Remove the student details who scored less than 90% and display Stack.
35. A school wants to store its students' records in digital form. For this they want the 2+2
following information of each student to be stored:
- Student_ID – integer
- Student_Name – string
- Class – integer
- House – string

You, as a programmer, have been assigned to do this job for school.


1. Write a function to input the data of a student and append it in a binary file.
2. Write a function to update the data of student whose house is Ashoka and change
it to Raman.
SECTION E
36. Intelligent Hub India is a knowledge community aimed to uplift the standard of skills and 5
knowledge in the society. It is planning to setup its training centers in multiple towns and
villages of India with its head offices in the nearest cities. They have created a model of
their network with a city, a town and 3 villages as given. As a network consultant, you have
to suggest the best network related solution for their issues/problems raised in (a) to (e)
keeping in mind the distance between various locations and given parameters.
a) Suggest the most appropriate location of the SERVER in the YHUB (out of the 4
locations), to getthe best and effective connectivity. Justify your answer.
b) Suggest the best wired medium and draw the cable layout (location to location) to
efficientlyconnect various locations within the YHUB.
c) Which hardware device will you suggest to connect all the computers within each
location ofYHUB?
d) Which server/protocol will be most helpful to conduct live interaction of Experts
from Head officeand people at YHUB locations?
e) Suggest a device/software and its placement that would provide data security for the
entire networkof the YHUB.
37. You are working on a project that involves managing inventory records of a store in a 5
MySQL database. Your task is to create a Python program that performs the following
operations:

1. Connect to the MySQL database: Assume the database is named STOREDB, the
user is admin, and the password is admin123. The MySQL is available on a local
computer, not a remote computer.
2. Create a table: The table INVENTORY should have the following columns:
o ProductID (INTEGER, Primary Key, Auto Increment)
o ProductName (VARCHAR(100))
o Price (FLOAT(8,2))
o PurchaseDate (DATE)
3. Insert data into the table: Insert at least three records with sample data into the
INVENTORY table.
4. Retrieve and display all records: Write a Python function that retrieves all records
from the INVENTORY table and prints them in a readable format.

END
KENDRIYA VIDYALAYA SANGATHAN VARANASI REGION
PRE-BOARD EXAMINATION-I 2024-25
Class: XII Max Marks: 70
Subject: COMPUTER SCIENCE (083) Max Time: 3:00 Hrs

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: 1
Variable declared inside functions may have global scope .
2. Identify the output of the following code snippet: 1
event ="kendriya Vidyalaya Sangathan VARANASI REGION"
L = [Link](“ “)
print(L[::-2])

3. Which of the following operations on a string will generate an error? 1


a) "PYTHON"*2
b) "PYTHON" + "10"
c) "PYTHON" + 10
d) "PYTHON" + "PYTHON"
4. What is the output of the expression? 1
Str1='International'
print([Link]('o','*'))

5. What will be the output of the following code snippet? 1


message= "Virat kohali"
print(message[-2::-2])
6. What will be the output of the following code? 1
L1 = [1, 2, 3]
L2 = L1
L1 += [4,]
print(L1 = = L2)
(A) True
(B) False
(C) tuple1
(D) Error
What will the following code do?
7. dict={“Phy”:94,”Che”:70,”Bio”:82,”Eng”:95} 1
[Link]({“Che”:72,”Bio”:80})
(a)It will create new dictionary as dict={“Che”:72,”Bio”:80} and old dict will be
deleted
(b)It will throw an error as dictionary cannot be updated
(c)It will simply update the dictionary as dict={“Phy”:94,”Che”:72,”Bio”:80,
“Eng”:95}
(d) It will not throw any error but it will not do any changes in dict
8. Consider the tuple in python named DAYS=(“SUN”,”MON”,”TUES”). 1
Identify the invalid statement(s) from the given below statements:
a) S=DAYS[1] b) print(DAYS[2]) c) DAYS[0]=”WED” d)
LIST=list(DAYS)
9. Command to remove all row(s) from table student is 1
(a) drop table student; (b) drop from student;
(c) remove from student; (d) delete from student;
10. What will be the output of the following statement in python? (fh is a file handle) 1
[Link](-30,2)
Options:- It will place the file pointer:-
A. at 30th byte ahead of current current file pointer position
B. at 30 bytes behind from end-of file
C. at 30th byte from the beginning of the file
D. at 5 bytes behind from end-of file .
11. What is the primary role of the `try` block in a try-except construct? – 1
A. To execute code that may raise an exception –
B. To handle exceptions –
C. To indicate the end of the try-except construct –
D. To prevent exceptions from occurring
12. In conflict between global variable and local variable with same name in local body 1
then preference will be given to ………..
a) global variable
b) local variable
c)non local variable
d)none of these
13. Which SQL command can change the number of cardinality of an existing relation? 1
14. A relation can have only one______key and one or more than one______keys. 1
(a) PRIMARY, CANDIDATE
(b) CANDIDATE, ALTERNATE
(c) CANDIDATE, PRIMARY
(d) ALTERNATE, CANDIDATE
15. Fill in the blank: 1
command is used to change the structure of the table in SQL.

(a)update (b)remove (c)alter (d)drop


16. Which aggregate function can be used to find the non null values of a table? 1
(A) sum()
(B) count()
(C) count(*)
(D) max()
17 Which protocol is used sending or receiving emails? 1
(A) HTTPS
(B) FTP
(C) PPP
(D) SMTP/POP3
18 Fill in the blank: ______is a communication methodology designed to deliver both 1
voice and multimedia communications over Internet protocol.
(a) VoIP
(b) SMTP
(c) PPP
(d)HTTP
19 Fill in the blank: The modem at the sender’s computer end acts as a ____________. 1
a) Model
b) Modulator
c) Demodulator
d) Convertor
Q20 and 21 are ASSERTION AND REASONING 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
c) A is True but R is False
d) A is false but R is True
20 Assertion (A):- A Python sequence is an ordered collection of items, where each item 1
. is indexed by an integer.
Reasoning (R):- The Strings, Lists and Tuples are not sequence data types available in
Python.
21 Assertion (A): A SELECT command in SQL can have both WHERE and HAVING 1
. clauses.
Reasoning (R): WHERE and HAVING clauses are used to check conditions, therefore,
these can be used interchangeably.
Section-B ( 7 x 2=14 Marks)
22 Give two examples of each of the following: 2
(I) relational operators (II) logical operators

23 Predict the output of the python code given below: 2


def FunStr(S):
T=""
for i in S:
if [Link]():
T=T+i
return T
x="PYTHON 3.9"
Y=FunStr(x)
print(x, Y, sep="*", end="@")

24 Consider a List L = [10,20,30,[40,50,60],70,80] 2


Write a single line python statement (using List methods only) to:
i. Insert an element 55 as the second last element of the inner list, so that L becomes
[10,20,30,[40,50,55,60],70,80]
ii. Delete the inner list so the L becomes [10,20,30,70,80]
or
If L1=[1,2,3,2,1,2,4,2, . . . ], and L2=[10,20,30, . . .], then (Answer using builtin
functions only)
i) Write a statement to count the occurrences of 2 in L1
ii) Write a statement to remove 3 from l1

25 What possible output(s) are expected to be displayed on screen at the time of 2


execution of the program from the following code?
Import random
Ar=[20,30,40,50,60,70]
From =[Link](1,3)
To=[Link](2,4)

for k in range(From,To+1):
print( Ar[k],end=”#”)
(i) 10#40#70# (iii) 50#60#70# (ii) 30#40#50# (iv) 40#50#70#
26 Rewrite the following Python code after removing all the syntactical errors (if any), 2
underlining each correction.

x = int(input("Enter an number"))
if (x%2) = 0:
print (x, "is even")
else if x<0:
print (x, "should be positive")
else;
print (x "is odd")
27 Sonal needs to display name of teachers, who have "o" as the third character in their 2
name.
She wrote the following query. Select name From teacher Where name ="$$o?";
But the query is not producing the result. Identify the problems.
OR
Pooja created a table 'bank' in SQL. Later on, she found that there should have been
another column in the table. Which command is used to add column to the table?
28 A) List one advantage and one disadvantage of bus topology. 2
OR
B) Expand the term TCP/IP. What is the use of IP?
Section-C ( 3 x 3 = 9 Marks)
29 Write a definition of a function calculate () which count the number of digits in a file 3
“[Link]”.
OR
Write a function count( ) in Python that counts the number of “the” word
present in a text file “[Link]”.
If the “[Link]” contents are as follows:
This is the book I have purchased. Cost of the book was Rs. 320.
Then the output will be : 2
30 Write python function Push(), Pop() and Display to implement the stack. The program 3
will store the Employee details i.e. Employee number, Employee name and Salary.
OR
A dictionary, StudRec, contains the records of students in the following pattern:
{admno: [m1, m2, m3, m4, m5]}, i.e., Admission No. (admno) as the key and 5
subject marks in the list as the value.
Each of these records is nested together to form a nested dictionary. Write the
following user-defined functions in the Python code to perform the specified
operations on the stack named BRIGHT.
(i) Push_Bright(StudRec): it takes the nested dictionary as an argument and pushes a
list of dictionary objects or elements containing data as {admno: total (sum of 5
subject marks)} into the stack named BRIGHT of those students with a total mark
>350.
(ii) Pop_Bright(): It pops the dictionary objects from the stack and displays them. Also,
the function should display “Stack is Empty” when there are no elements in the stack.
For Example: if the nested dictionary StudRec contains the following data:
StudRec={101:[80,90,80,70,90], 102:[50,60,45,50,40],
103:[90,90,99,98,90]}
Thes Stack BRIGHT Should contain: [{101: 410}, {103: 467}]
The Output Should be: {103: 467}
{101: 410}
If the stack BRIGHT is empty then display: Stack is Empty .
31 Predict the output of the Python code given below: 3
def product(L1,L2):
p=0
for i in L1:
for j in L2:
p=p+i*j
return p
LIST=[1,2,3,4,5,6]
l1=[]
l2=[]
for i in LIST:
if(i%2==0):
[Link](i)
else:
[Link](i)
print(product(l1,l2))

OR

Predict the output of the Python code given below:


tuple1 = (33, 24, 44, 42, 54 ,65)
list1 =list(tuple1)
new_list = []
for i in list1:
if i>40:
new_list.append(i)
new_tuple = tuple(new_list)
print(new_tuple)

Section-D ( 4 x 4 = 16 Marks)
32 Write the SQL queries (i) to (iv) based on the relations Teacher and Placement given 4
below:
a)Write a query to find sum of salary of those teachers who are from computer science.
b) Find total no of teachers in each department and average salary of each department.
c)Write a query to find the details of those teacher whose placement place is “Jaipur”.
d)To count total males and females in teacher table.
OR
Write the output
(I) Select name, sum(salary) from teacher group by name;
(II) Select * from teacher where department like '%Sc%';
(III) Select t_id from teacher where age>34;
(IV) Select max(salary) from teachers;
33 What is the advantage of using a csv file for permanent storage? 4
Write a Program in Python that defines and calls the following user defined functions:
(i) ADD() – To accept and add data of a teacher to a CSV file ‘[Link]’. Each
record consists of a list with field elements as tid, name and mobile to
storeteacherid,teacher name and teacher mobile number respectively.
(ii) COUNTRECORD() – To count the number of records present in the CSV file
named
‘[Link]’.
34 Consider the following tables and write MySQL query for (a), (b) and (c), 4
(d) for output Table : Employees
Empid Firstname Lastname Address City
010 Ravi Kumar Raj nagar GZB
105 Harry Waltor Gandhi nagar GZB
152 Sam Tones 33 Elm St. Paris
215 Sarah Ackerman 440 U.S. 110 Upton
244 Manila Sengupta 24 Friends street New Delhi
300 Robert Samuel 9 Fifth Cross Washington
335 Ritu Tondon Shastri Nagar GZB
400 Rachel Lee 121 Harrison St. New York
441 Peter Thompson 11 Red Road Paris
Table : EmpSalary
Empid Salary Benefits Designation

010 75000 15000 Manager


105 65000 15000 Manager
152 80000 25000 Director
215 75000 12500 Manager
244 50000 12000 Clerk
300 45000 10000 Clerk
335 40000 10000 Clerk
400 32000 7500 Salesman
441 28000 7500 salesman
Write the SQL commands for the following:
a) To show first name, last name, address and city of all employees
who lives in Paris.
b) To display the details of Employees table in descending order of
First name.
c) To display the first name, last name and salary of all employees
from the tables Employee and EmpSalary, who are working as
Manager.
Give the Output of following SQL commands:
d) Select designation, sum(salary) from empsalary
group by designation having count(*) > 2;
or
Select sum(benefits) from empsalary
where designation =’clerk’;
35 A table, named STATIONERY, in ITEMDB database, has the following 4
structure:
Field Type
itemNo int(11)
itemName varchar(15)
price float
qty int(11)
Write the following Python function 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 A binary file “[Link]” has structure [BookNo, Book_Name, Author, Price]. 5
Write a user defined function CreateFile() to input data for a record and add to
[Link] file .
Write a function CountRec(Author) in Python which accepts the Author name as
parameter and count and return number of books written by the given Author are
stored in the binary file “[Link]”
OR
A binary file “[Link]” has structure (admission_number, Name,
Percentage).
Write a function countrec() in Python that would read contents of the file
“[Link]” and display the details of those students whose percentage is above
75. Also count and display number of students scoring above 75%.

37 Software Development Company has set up its new center at Raipur for its office and 5
web based activities. It has 4 blocks of buildings named Block A, Block B, Block C,
Block D.
No of Computers in each Block Distance between various blocks
Block A 25 Block A to Block B 60 Mtrs
Block B 50 Block B to Block C 40 Mtrs
Block C 125 Block C to Block A 30 Mtrs
Block D 10 Block D to Block C 50 Mtrs

1. [Link] the most suitable place (i.e. block) to house the server of this company with
a suitable reason.
2. [Link] the ideal layout to connect all the blocks with a wired connectivity.
3. [Link] device will you suggest to be placed/installed in each of these blocks to
efficiently connect all the computers within these blocks.
4. [Link] the placement of a repeater in the network with justification.
[Link] company is planning to link all the blocks through a secure and high speed wired
medium. Suggest a way to connect all the blocks.

You might also like