KVS PB I CS 202425 QPS
KVS PB I CS 202425 QPS
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=random.randint(0,2)
end=random.randint(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 Database.Give 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 Poetry.txt
OR
write a user defined function Transfer() that copies a text file "source.txt" onto “destination.txt"
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) D1.del["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=random.randint(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 "Story.txt".
(3)
OR
B) Write a Python function that finds and displays all the words having 5
characters from a text file "Story.txt".
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 "country.csv" 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*random.randint(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 Quotes.txt
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 it.if 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) dict1.get(“Virat”)
c) print(dict1([“Dhoni”,”Rohit”])
d) dict1[“Rohit”]=158
What does this statement will do in python
>>>L1=[10,20,30] # Statement 1
>>>L1.insert(-3,1) # Statement 2
>>>print(L1) # Statement 3
8 1
a) The statement 2 will insert the element -3 at index 1
b) The statement 2 will insert the element 1 at index -3
c) The statement 2 will insert the element 1 after the value 10
d) The statement 2 will insert the element -3 after the value 30
If a table which has one Primary key and two alternate keys. How many Candidate
keys will this table have?
9 1
a) 1 b) 2 c) 3 d) 4
Which of the following modes keeps the file offset position at the end of file?
10 1
a) r b) w c) a d) r+
In a try-except block with multiple except blocks, which block will be executed if an
Exception matches multiple except blocks?
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=random.randint(1,3)
25 2
LAST=random.randint(BEGIN,4)
for I in range (BEGIN, LAST+1):
print (VALUES[I],"-",)
a) 30 - 40 - 50 - c) 30 - 40 - 50 - 60 -
b) 10 - 20 - 30 - 40 – d) 30 - 40 - 50 - 60 - 70 –
The given Python code to print all Prime numbers in an interval (range) inclusively.
The given code accepts 02 number (low & high) as arguments for the function
Prime_Series() and return the list of prime numbers between those two numbers
inclusively. Observe the following code carefully and rewrite it after removing all
syntax and logical errors. Underline all the corrections made.
primes = [ ]
for i in range(low, high + 1):
flag = 0
if i < 2:
continue
if i =2:
26 2
primes.append(2)
continue
for x in range(2, i):
if i % x == 0:
flag = 1
break
if flag == 0:
primes.appends(i)
return primes
low=int(input("Lower range value: "))
high=int(input("High range value: ")
print(Prime_Series())
4/8
(I) Attempt either A or B.
a) Bhojo wants to create a table in Mysql, in which he want only unique value
not even NULL , what constraint Bhojo should use.
OR
b) What constraint should be applied on a table column so that NULL is not
allowed in that column, but duplicate values are allowed.
27 2
(II) Attempt either A or B.
a) Write an SQL command to remove column empcontact from emp table
OR
b) Write an SQL command to make the column B_ID the Primary Key of an
already existing table, named BSTORE.
Give one difference between web browser and webserver.
OR
28 Expand the following terms- 2
a) VoIP b) SMTP c) SLIP d) TCP/IP
Q No Section-C ( 3 x 3 = 9 Marks) Marks
a) Write a method/function CNTWORDS() in python to read contents from a text file
PROCURE.TXT, to count and return the occurrences of those words, which are
having 4 or more characters.
b) Write a method/function LINECOUNT() in Python to read lines from a text file
CONTENT.txt, and display those lines, which have #anywhere in the line.
For example, If the content of the file is-
29 Had an amazing time at the Vidyalaya Annual function last night with #MusicLovers. 3
Excited to announce the launch of our KVS new website !
KVS # G20
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 “Employee.csv” contains data of Employees. Each record of the file
contains the following data.
Name of the Employee
Designation of Employee
Salary of the employee
Contact number of the employee
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
Q.No SECTION E (2 X 5 = 10 Marks) Marks
You are programmer in a software company,Your work profile is to manage the
records of various employees. For this you want following information of each
employee to be stored-
Employee_id – integer
Employee_Name – string
Emoployee_job – string
Employee_sal – float
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
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
t.append(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 “poem.txt”?
(a) F=open(‘poem.txt’)
print(F.load(10))
(b) F=open(‘poem.txt’)
print(F.reader(10))
(c) F=open(‘poem.txt’)
print(F.read(10))
(d) F=open(‘poem.txt’,)
print(F.readline(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=random.randrange(1,3)
U=random.randrange(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 "furdata.csv" 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 furdata.csv. 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
केन्द्रीय विद्यालय सं गठन, कोलकाता सं भाग
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) cursor.rowcount (B) cursor.countrows() (1)
(C) cursor.allrows() (D) cursor.countrows()
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 = random.randint (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:
primes.append(2)
continue
for x in range(2, i):
Page: 4/10
if i % x == 0:
flag = 1
continue
if flag == 0:
primes.append(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 "Email.txt".
OR (3)
B) Write a Python function that finds and displays all the words smaller than 6
characters from a text file "Friends.txt".
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 stock.csv to store the
stock details of different products.The structure of stock.csv 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 stock.csv.
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