Class XII Computer Science Pre-Board 2024-25
Class XII Computer Science Pre-Board 2024-25
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
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
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
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
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
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.
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?
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
Page 8 of 12
j=j+2
else:
j=j+3
print(s [ j : : j ] )
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
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
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.
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
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.
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
PAGE NO. 2 OF 14
(B) print(dict['Rose', 'Lily'])
(C) dict['Rose']=40
(D) print(str(dict))
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.
Update(50)
Update()
PAGE NO. 3 OF 14
13. Which SQL command can decrease Cardinality of a Relation? (1)
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
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.
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
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.
(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.
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.
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.”
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.
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'.
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
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:
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
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:
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
केन्द्र�य �वद्यालय संगठन
आगरा संभाग
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
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
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
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
Page 8 of 12
d) To display names of those brands whose name have anywhere ‘K’
in their Brand_name .
OR
Page 9 of 12
2 Mathematics Jaipur
3 Computer Sc Nagpur
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
Page 11 of 12
Kodagu Campus to Coimbatore Campus 304 km
Number of computers:
Block Number of Computers
IT 75
DS 50
IoT 80
Page 12 of 12
कें द्रीय विद्यालय संगठन, अहमदाबाद संभाग SET-1/A
KENDRIYA VIDYALAYA SANGATHAN, AHMEDABAD REGION
प्री-बोर्ड परीक्षा:2024-25
PRE-BOARD EXAMINATION: 2024-25
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.
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:
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
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:
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-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
SECTION-D (4 x 4 = 16 M)
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)
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)
Page: 1/11
5. What will be the output of the following code snippet?
message= "Good Morning" (1)
print(message[2::2])
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
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)
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
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
(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
(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#
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?
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.
(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.
(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)
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
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.
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".
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.
import random
word='Inspiration'
Lot=2*[Link](2,4)
for i in range(Lot,len(word),3):
print(word[i],end='$')
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.
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”.
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.
HR ADMIN
London Head
Head Head
Office
Accts Logistics
GENERAL INSTRUCTIONS
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
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?
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
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
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.
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
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".
OR
31 3
Predict the output of the following Code-
Note: The table contains many more records than shown here.
6/8
A) Write the following queries-
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
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
A table, named bookdetails ,in bookstore database has the following structure-
Field Type
Bookid int(10)
Bookname varchar(15)
Price float
Qty int(10)
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
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
(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=‟#‟)
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.
(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.
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
import random
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 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]”.
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%”;
i) Write the header row and records of five employees into the file.
ii) Appends a new record in the CSV file.
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 15
Technology Block 40
HR Center 115
Business Block 25
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
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
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=”# “)
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.
(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:
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
COURSES
[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:
Page 8 of 9
Business Block to HR Center 35m
Technology block to HR center 15m
Mumbai Head Office to Raipur 800 km
BUSINESS BLOCK 25
TECHNOLOGY BLOCK 40
LAW BLOCK 15
HR CENTRE 115
Page 9 of 9
कोड(Code)-KVS(DR)/2024/AN
c) [‘a’,’@’,’b@c@d’] d) [‘a’,’@’,’b@c@d’]
[‘a’,’b’,’c’,’d’] [‘a’,’@’,’b’,’@’,’c’,’@’,’d’]
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
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;
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;
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
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
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
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?
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)
OR
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
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)
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 :
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.”
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
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
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))
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
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()
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
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
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]
5
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + "\n"
str2 = str1[:-1]
print(str2)
OR
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
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.
Field Type
Rollno integer
Name string
Clas integer
Mark integer
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:
Resource building 25
Training building 10
*************************************
9
AS-07
Please check total printed pages before start : 12
Roll No. :
[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
Logistics Block
[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
[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)
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
*****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.
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
Black A to Block B 50 m
Block C to Block D 25 m
Block A to Block C 90 m
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.
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="*")
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
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
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.
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
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
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
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)
(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
x = [Link] (1,3)
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?
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:
str1 = ""
for key in d:
str1 = str1 + str(d[key]) + "@" + “\n”
str2 = str1[:-1]
print(str2) (3)
OR
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
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.
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.
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.
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
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)
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.
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
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.
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
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.
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
(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.
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
8|Page
Section - D (4x4 = 16 marks)
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
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
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
12 | P a g e
TRAINING RESOURCE 50
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.
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.
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 ?
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.
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
Table : BORROWER
customer_name loan_number
Ajit Das L456
Rohan Yadav L901
Suman Verma L123
Ayesha Tiwari L987
Saurav L347
Page 7 of 9
35. Alok wants to create a table named BOOK in the LIBRARY database, which 4
should have the following structure:
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
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
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
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.
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)
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)
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.
(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:
(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”]]
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:
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
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.
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)
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)
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 = "-")
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)]
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.
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.
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
Table: DEPARTMENT
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
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
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
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.
*****
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.
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.
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
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.
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
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
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
COURSE
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:
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
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
OR
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:
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
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.
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
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
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.