0% found this document useful (0 votes)
726 views53 pages

KVS PB I CS 202425 QPS

Uploaded by

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

KVS PB I CS 202425 QPS

Uploaded by

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

KENDRIYA VIDYALAYA SANGATHAN: BHUBANESWAR REGION

FIRST PRE-BOARD EXAMINATION 2024-25


CLASS XII - COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70

General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some questions.
Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.

SECTION-A (21 x1=21M)


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

SECTION-B (7 x 2 =14M)

22 Rewrite the following code in python after removing all syntax errors. Underline each 2
correction done in the code:
Def Calc(a):
for i in (0,a):
if i%2 =0:
s=s+1
else if i%5= =0
m=m+2
else:
n=n+i
print(s,m,n) Calc(15)
23 Give two examples of each of the following: 2
(I) keywords (II) Mutable Datatypes
24 Write a suitable Python statement for each of the following tasks using built-in 2
functions/methods only:
a) To delete an element Mumbai:50 from Dictionary D.
b) To display words in a string S in the form of a list
OR
a)To insert an element 100 at the Second position, in the list L 1
b) To sort the elements of list L1 in ascending order.
25 What possible outputs(s) are expected to be displayed on screen at the time of execution of 2
the program from the following code? Also specify the maximum values that can be assigned
to each of the variables BEG and END.
import random
heights=[10,20,30,40,50]
beg=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

MCODE MODEL COMPANY PRICE DATE_OF_LAUNCH


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

SECTION-D (4 x 4 = 16 M)

32 i. When is TypeError exception raised in Python?


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

G101 Saree 1250 100 C03


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

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

SECTION-E (2 x 5 = 10 M)

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


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

Technology Block Business Block

HR Center Law Block

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


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

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


BLOCK NO.OF COMPUTERS
Law Block 15
Technology Block 40
HR center 115
Business Block 25

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

Time allowed: 3 Hours Maximum Marks: 70


General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in
somequestions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.

Q No. Section-A (21 x 1 = 21 Marks) Marks

1. State True or False:


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

2. Identify the output of the following code snippet:


text = "HELLOWORLD"
text=text.replace('HE','@')
print(text)
(A) @LLOWORLD (1)
(B) @LLOWORLD@
(C) HE@
(D) HE@LLOWORLD

3. Which of the following expressions evaluates to True?


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

4. What is the output of the expression?


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

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

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


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

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


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

8. Which of the following will delete key-value pair for key = “Name” from a dictionary
D1?
(A) delete D1("Name")
(1)
(B) del D1["Name"]
(C) del.D1["Name"]
(D) 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

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


file = open("story.txt", "r")
data = file.read(100)
#Move the file pointer to the (1)
beginning of the file
next_data = file.read(50)
file.close()

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


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

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

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

14. What will be the output of the query?


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

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

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


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

17. Which protocol is used in videoconferencing?


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

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

Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark
the correct choice as:
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation
for A
(C) A is True but R is False
(D) A is False but R is True

20. Assertion (A): Positional arguments in Python functions must be passed in


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

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

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

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


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

23. Give two examples of each of the following:


(2)

(I) Identity operators (II) Membership operators

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


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

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

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

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

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

(2)

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

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

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

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

29. A) Write a Python function that displays all the words containing @gmail
from a text file "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.

(i) Push_element(NList): It takes the nested list as an argument and


pushes a list object containing name of the city and country, which
are not in India and distance is less than 3500 km from Delhi.

(ii) Pop_element(): It pops the objects from the stack and displays

Page: 6/11
them. Also, the function should display “Stack Empty” when there
are no elements in the stack.

For example: If the nested list contains the following data:

NList=[["New York", "U.S.A.", 11734],


["Naypyidaw", "Myanmar", 3219],
["Dubai", "UAE", 2194],
["London", "England", 6693],
["Gangtok", "India", 1580],
["Columbo", "Sri Lanka", 3405]]

The stack should contain:


['Naypyidaw', 'Myanmar'],
['Dubai', 'UAE'],
['Columbo', 'Sri Lanka']

The output should be:


['Columbo', 'Sri Lanka']
['Dubai', 'UAE']
['Naypyidaw', 'Myanmar']
Stack Empty

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

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

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

32.

(4)

Write SQL queries for the following:


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

OR

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

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

a. SELECT COUNT(DISTINCT TYPE) FROM BOOK;


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

Page: 8/11
33. A csv file "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.

Assume the following for Python-Database connectivity:


Host: localhost, User: root, Password: Pencil

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

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


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

You, as a programmer of the company, have been assigned to do this job


for Surya.

(I) Write a function to input the data of a candidate and append it in a


binary file.

Page: 10/11
(II) Write a function to update the data of candidates whose experience
is more than 10 years and change their designation to "Senior
Manager".
(III) Write a function to read the data from the binary file and display the
data of all those candidates who are not "Senior Manager".

37. STAR Enterprises is an event planning organization. It is planning to set up


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

Block to Block distances (in Mtrs.)


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

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

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

Page: 12/11
KENDRIYA VIDYALAYA SANGATHAN, CHENNAI REGION
CLASS: XII SESSION: 2024-25
PREBOARD
COMPUTER SCIENCE (083)
Time allowed: 3 Hours Maximum Marks: 70
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some questions.
Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.

Q No. Section-A (21 x 1 = 21 Marks) Marks


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

4 What is the output of the expression? 1


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

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


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

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


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

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

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


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

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

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


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

OR
(B) Write a function that displays the line number along with no of words in it
from the file 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”.

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


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

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


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

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

Assume the following values for Python Database Connectivity


Host-localhost, user-root, password-tiger

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


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

REGIONAL OFFICE MUMBAI

HR ADMIN
London Head
Head Head
Office
Accts Logistics

Distances between various blocks/locations:


Admin to HR 500m
Accts to Admin 100m
Accts to HR 300m
Logistics to Admin 200m
HR to logistics 450m
Accts to logistics 600m
Number of computers installed at various blocks are as follows:
Block No of computers
ADMIN 95
HR 70
Accts 45
Logistics 28
i) Suggest the most appropriate block to place the sever in Mumbai office.
Justify your answer.
ii) State the best wired medium to efficiently connect various blocks within
the Mumbai Office.
iii) Draw the ideal cable layout (block to block) for connecting these blocks
for wired connectivity.
iv) The company wants to conduct an online meeting with heads of regional
office and headquarter. Which protocol will be used for the effective voice
communication?
v) Suggest the best place to house the following
a) Repeater b) Switch
PRE-BOARD EXAMINATION (2024-25)
CLASS-XII
COMPUTER SCIENCE(083)
TIME: 03:00 HOURS MM: 70

GENERAL INSTRUCTIONS

 This Question paper contain 09(Nine) printed pages.


 This question paper contains 37 questions.
 All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions.
 The paper is divided into 5 Sections- A, B, C, D and E.
 Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
 Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
 Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
 Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
 Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
 All programming questions are to be answered using Python Language only.
 In case of MCQ, text of the correct answer should also be written.

QNO SECTION -A (21 x 1=21 Marks) Marks


State True or False-
1 1
“continue keyword skips remaining part of an iteration in a loop”
State the correct output of the following code-
S1= “India is on the Moon”
A=S1.split("o",3)
print(A)
2 1
a) ['India is ', 'n the M', ' ', 'n']
b) 'India is ', 'n the M', ' ', 'n'
c) ['India is n ', 'the ', ' ', 'Mn']
d) [„India is‟, „the‟, „n‟]

Identify the output of the following code snippet:


text = "PYTHONPROGRAM"
text=text.replace('PY','#')
print(text)
3 1
a) #THONPROGRAM
b) ##THON#ROGRAM
c) #THON#ROGRAM
d) #YTHON#ROGRAM
str1=" Programming "
str2=" is My Junoon"
str3=str1.strip()+str2.replace("J", "j").lstrip()
print(str3.partition("My"))
4 a) ('Programmingis ', 'My', ' junoon') 1
b) ['Programmingis ', 'My', ' junoon']
c) ['Programming is ', 'My', ' Junoon']
d) (('Programmingis ', 'My', ' Junoon')

1/8
What will be the output of the following code snippet?
5 message= "Olympics 2024" 1
print(message[-2::-4])
Given the following tuple-

T1= (10,30,20,50,40)
6 Which of the following statement will result an error? 1

a) print(T1[0]) b) print(len(T1)) c) print(T1[-4:3]) d) print(T1.insert(2,3))

If dict1 is a dictionary defined below, then which of the following will raise an
exception?

dict1={“Dhoni”:95,”Virat”:99,”Rohit”:100}
7 1
a) print(str(dict1))
b) dict1.get(“Virat”)
c) print(dict1([“Dhoni”,”Rohit”])
d) dict1[“Rohit”]=158
What does this statement will do in python
>>>L1=[10,20,30] # Statement 1
>>>L1.insert(-3,1) # Statement 2
>>>print(L1) # Statement 3
8 1
a) The statement 2 will insert the element -3 at index 1
b) The statement 2 will insert the element 1 at index -3
c) The statement 2 will insert the element 1 after the value 10
d) The statement 2 will insert the element -3 after the value 30

If a table which has one Primary key and two alternate keys. How many Candidate
keys will this table have?
9 1
a) 1 b) 2 c) 3 d) 4

Which of the following modes keeps the file offset position at the end of file?
10 1
a) r b) w c) a d) r+

In a try-except block with multiple except blocks, which block will be executed if an
Exception matches multiple except blocks?

11 a) The first matching except block encountered from top to bottom 1


b) All matching except blocks simultaneously
c) The last matching except block encountered from top to bottom
d) None of the above
What will be output of the following code?
X=10
def exam(Y=20):
X=30
12 Z=X+Y 1
print(X,Z,end=”#”)
exam(30)
print(X,end=”$”)

a) 30 60#10$ b) 30 60 $10# c) 30 10#10$ d) 30 50#10$


13 Which SQL command is used to change the name of a column? 1
2/8
What will be output of the following SQL command?

SELECT * FROM EMP WHERE EMPNAME LIKE “%S_”

14 a) details of all employee whose name begin with S 1


b) name of all employee whose name ends with S
c) details of all employee whose name second last character is S
d) name of all employee whose name second last character is S

In which data type the value stored is padded with spaces to fit the specified length?
15 1
a) DATE b) VARCHAR c) FLOAT d) CHAR

How many primary key can be defined in a relation/table in mysql?


16 1
a) 1 b) 2 c) as much as required in a relation d) 0
Which protocol is used to send and receive email?
17 1
a) HTTPS b) FTP c) SMTP d) PPP
Paheli is having an internet connection between her office and server room through
an Ethernet cable (i.e. twisted pair) but the network speed is very poor and need to
amplify/boost the signal. Which of the following device is required as a booster to
18 1
amplify the signal?

a) Gateway b) router c) modem d) repeater


Which switching technique use dedicated physical connection is to be established
between the source and destination?
19 1
a) Packet Switching c) Message Switching
b) Circuit Switching d) Hybrid Switching

Q20 and Q21 are Assertion (A) and Reason(R) based questions. Mark the correct
choice as:
a) Both A and R are true and R is the correct explanation for A
b) Both A and R are true and R is not the correct explanation for A
c) A is True but R is False
d) A is False but R is True

Assertion(A): if an existing file whose size was 40 Byte is opened in write mode
and after writing another 40 Byte into file it is closed. The file size is 80 Byte after
closing.
20 1
Reason(R):File size will remain 40 Byte as it was not opened in the append mode
so old content be lost
Assertion (A): A SELECT command in SQL can have both WHERE and HAVING
clauses.
21 1
Reasoning (R): WHERE and HAVING clauses are used to check conditions,
therefore, these can be used interchangeably.
Q No Section-B ( 7 x 2=14 Marks) Marks
Give two examples of each of the following-
22 a) Logical operator b) Relational operator 2

Mani Ayyar, a python programmer, is working on a project which requires him to


define a function with name CalculateInterest().
23 2
He defines it as:
def CalculateInterest(Principal,Rate=.06, Time): # Code
3/8
But this code is not working; Can you help Mani Ayyar to identify the error in the
above function and with the solution?
a) Write the Python statement of each of the following task using BUILT-IN
function/methods only-

i) To delete an element 20 from the list lst1


ii) To replace the string “That” with “This” in the string str1.
24 2
OR

b) A dictionary dict2 is copied into the dictionary dict1 such that the common keys
values get updated. Write the python command to do the task and after that
empty the dictionary dict1
What possible output(s) are expected to be displayed on screen at the time of
execution of the program from the following code? Also specify the minimum values
that can be assigned to each of the variables BEGIN and LAST.

import random
VALUES=[10,20,30,40,50,60,70,80]
BEGIN=random.randint(1,3)
25 2
LAST=random.randint(BEGIN,4)
for I in range (BEGIN, LAST+1):
print (VALUES[I],"-",)

a) 30 - 40 - 50 - c) 30 - 40 - 50 - 60 -
b) 10 - 20 - 30 - 40 – d) 30 - 40 - 50 - 60 - 70 –

The given Python code to print all Prime numbers in an interval (range) inclusively.
The given code accepts 02 number (low & high) as arguments for the function
Prime_Series() and return the list of prime numbers between those two numbers
inclusively. Observe the following code carefully and rewrite it after removing all
syntax and logical errors. Underline all the corrections made.

def Prime_Series(low, high)

primes = [ ]
for i in range(low, high + 1):
flag = 0
if i < 2:
continue
if i =2:
26 2
primes.append(2)
continue
for x in range(2, i):
if i % x == 0:
flag = 1
break
if flag == 0:
primes.appends(i)
return primes
low=int(input("Lower range value: "))
high=int(input("High range value: ")
print(Prime_Series())

4/8
(I) Attempt either A or B.
a) Bhojo wants to create a table in Mysql, in which he want only unique value
not even NULL , what constraint Bhojo should use.
OR
b) What constraint should be applied on a table column so that NULL is not
allowed in that column, but duplicate values are allowed.
27 2
(II) Attempt either A or B.
a) Write an SQL command to remove column empcontact from emp table
OR
b) Write an SQL command to make the column B_ID the Primary Key of an
already existing table, named BSTORE.
Give one difference between web browser and webserver.
OR
28 Expand the following terms- 2
a) VoIP b) SMTP c) SLIP d) TCP/IP
Q No Section-C ( 3 x 3 = 9 Marks) Marks
a) Write a method/function CNTWORDS() in python to read contents from a text file
PROCURE.TXT, to count and return the occurrences of those words, which are
having 4 or more characters.
b) Write a method/function LINECOUNT() in Python to read lines from a text file
CONTENT.txt, and display those lines, which have #anywhere in the line.
For example, If the content of the file is-
29 Had an amazing time at the Vidyalaya Annual function last night with #MusicLovers. 3
Excited to announce the launch of our KVS new website !
KVS # G20

The method/function should display-

Had an amazing time at the Vidyalaya Annual function last night with #MusicLovers.
KVS # G20
a) Paheli has created a dictionary D, containing names and salary as key value
pairs of 5 employees. Write separate functions to perform the following
operations:
● PUSH(HS, D), where HS is the stack and D is the dictionary which containing
names and salaries. Push the keys (name of the employee) of the dictionary into
a stack, where the corresponding value (salary) is greater than ₹75,000.
● POP(HS), where HS is the stack. Pop and display the content of the stack.
● PEEK(HS),This function displays the topmost element of the stack without
30 deleting it. If the stack is empty, the function should display 'None'. 3
OR
b) Write the following user defined functions with reference to STACK-
 Write the definition of a user-defined function PUSH_ODD(N) which accepts
a list of integers in a parameter `N` and pushes all those integers which are
odd from the list `N` into a Stack named `OddNumbers`.
For example- If the integers input into the list `VALUES` are:
[10, 5, 8, 3, 12,11]
Then the stack `OddNumbers` should store: [5,3,11]
5/8
 Write function POP_ODD() to pop the topmost number from the stack and
returns it. If the stack is already empty, the function should display "Empty".

 Write function DISP_ODD() to display all element of the stack without


deleting them. If the stack is empty, the function should display 'None'.

Predict the output of the following code

OR
31 3
Predict the output of the following Code-

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


Consider the table MSTORE as given below
M_Id M_Company M_Name M_Price M_Mf_Date M_qty
MB001 Samsung Galaxy 15000 12-02-2013 5
MB003 Nokia N1100 12500 15-04-2011 2
MB004 Micromax Unite 3 5500 17-10-2016 3
32 MB005 Sony Unite 3 25000 20-11-2017 2 4
MB006 Oppo SelfieEx 18500 21-08-2010 1
MB007 Samsung Galaxy 20000 14-09-2022 3
MB008 Nokia N1100 30000 11-08-2023 5

Note: The table contains many more records than shown here.

6/8
A) Write the following queries-

I) Display total quantity(M_qty) of each mobile name(M_name),excluding mobile


name(M_name) with total quantity(M_qty)less than 3.

II) Display maximum and minimum price(M_price) of mobile with


company(M_company)name

III) Display mobile company(M_company),Mobile name(M_name) of those

IV) Display mobile id(M_id) and mobile company(M_company) of those mobiles


whose mobile company(M_company)second character is not n

B) Write the output of the following queries-

I) SELECT M_ID,M_NAME, M_PRICE FROM MSTORE WHERE


M_COMPANY NOT IN (“Samsung”,”Nokia”,”Sony”);

II) UPADTE MSTORE SET M_PRICE=M_PRICE+M_PRICE*0.1 WHERE


M_COMPANY =”NOKIA” OR M_COMPANY=”OPPO”;

III) SELECT M_NAME,SUM(M_PRICE) AS TOTAL_PRICE FROM MSTORE


GROUP BY M_NAME ;

IV) SELECT M_COMPANY,M_PRICE FROM MSTORE ORDER BY


M_COMPANY,M_PRICE DESC;

A CSV file “Employee.csv” contains data of Employees. Each record of the file
contains the following data.
 Name of the Employee
 Designation of Employee
 Salary of the employee
 Contact number of the employee

33 For example, a sample record of the file may be: 4


[„NRAMAN‟, “ENGG”, 95000, 3426827]

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

I) Read all the data from the file in the form of a list and display all those
records of Employee whose salary is more than 50000.
II) Count the number of records in the file.

7/8
34 4

OR

Display the NATURAL JOIN of these two tables.

A table, named bookdetails ,in bookstore database has the following structure-

Field Type
Bookid int(10)
Bookname varchar(15)
Price float
Qty int(10)

Note the following to establish connectivity between Python and MySQL:


35 Username - root 4
Password - tiger
Host - localhost

Write the following Python function to perform the specified operation-

BOOK_ADD_DISP(): To input details of an item and store it in the table bookdetails.


The function should then retrieve and display all records from the bookdetails table
where the Price is greater than 450.

8/8
Q.No SECTION E (2 X 5 = 10 Marks) Marks
You are programmer in a software company,Your work profile is to manage the
records of various employees. For this you want following information of each
employee to be stored-

Employee_id – integer
Employee_Name – string
Emoployee_job – string
Employee_sal – float

36 As a programmer complete the following task- 5

I) Write a function INPUT_DATA() to input the data of an employee and append


it in a binary file.
II) Write a function UPDATE_SAL() to update the salary of employees by
Rs10000/- whose job is “programmer”.
III) Write a function READ_DATA() to read the data from the binary file and
display the data of all those employees who are not "Engg".
An International Bank has to set up its new data centre in Delhi, India.
It has five blocks of buildings – A, B, C, D and E.

37 5

i) Suggest the most suitable block to host the server. Justify your answer.
ii) Draw the cable layout (Block to Block) to economically connect various blocks
within the Delhi campus of International Bank.
iii) Suggest the placement of the following devices with justification:
a) Repeater b) Hub/Switch
iv) The bank is planning to connect its head office in London. Which type of
network out of LAN, MAN, or WAN will be formed? Justify your answer.
v) Suggest a device/software to be installed in the Delhi Campus to take care of
data security.
*** ALL THE BEST ***

9/8
12PB24CS04
KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION
PRE-BOARD EXAMINATION
CLASS: XII COMPUTER SCIENCE (083) Time allowed: 3 Hours
Maximum Marks: 70
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language
only.
● In case of MCQ, text of the correct answer should also be written.
Q No. Section-A (21 x 1 = 21 Marks) Marks
1 State True or False 1
“Dictionaries in Python are mutable but Strings are immutable.”

2 str="R and Data Science" 1


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

3 Consider the given expression: 1


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

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


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

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

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


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

1
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

7 What will be the output? 1


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

9 Fill in the blanks: 1


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

10 Which of the following options is the correct Python statement to read and display the 1
first 10 characters of a text file “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))

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


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

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


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

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

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

14 What will be the output of the query? 1


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

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

17 Fill in the blank: 1


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

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


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

19 Which of the following establishes PAN? 1


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

Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the
correct choice as:
(A)Both A and R are true and R is the correct explanation for A
(B)Both A and R are true and R is not the correct explanation for A
(C)A is True but R is False
(D)A is False but R is True
20 Assertion (A): CSV (Comma Separated Values) is a file format for data storage 1
that looks like a text file.
Reason (R): The information is organized with one record on each line and each
field is separated by a comma.

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

3
read and written without the need of the data conversion

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


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

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


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

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

import random
arr=['10','30','40','50','70','90','100']
L=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

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


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

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


OR
B) What is URL?

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


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

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

31 Predict the output of the following code: 3


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

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

OR

Predict the output of the following code:


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

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


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

1 Sharma Geeta F Udhamwara 182141 50000

2 Singh Surinder M Kupwara 193222 75000


Nagar

3 Jacob Peter M Bhawani 185155 45000

4 Alvis Thomas M Ahmed 380025 50000


Nagar

5 Mohan Garima M Nagar 390026 33000


Coolangetta

6 Azmi Simi F NewDelhi 110021 40000

7 Kaur Manpreet F Udhamwara 182141 42000


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

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

33 A csv file "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

L01 Maths Raman ABC 70 20

L02 Science Agarkar DEF 90 15

L03 Social Suresh XYZ 85 30

L04 Computer Sumita ABC 75 7

L05 Telugu Nannayya DEF 60 25

L06 English Wordsworth DEF 55 12


Table: ISSUES
Book_id Qty_issued

L02 13

L04 5

L05 21

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

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

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

Field Type

Rollno integer

Name string

Clas integer

Mark integer

Write the following Python function to perform the specified operation:


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

Assume the following for Python-Database connectivity:


Host: localhost, User: root, Password:root

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


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

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

Main Resource

Training Accounts

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

Main building to Resource building 120m

Main building to Training building 40m

Main building to Accounts building 135m

Resource building to Training building 125m

Resource building to Accounts building 45m

Training building to Accounts building 110m

Number of computers in each building are as follows:


Main building 15

Resource building 25

Training building 250

Training building 10

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


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

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

9
केन्द्रीय विद्यालय सं गठन, कोलकाता सं भाग
KENDRIYA VIDYALAYA SANGATHAN, KOLKATA REGION
प्रथम प्री-बोर्ड परीक्षा / 1st PRE-BOARD EXAMINATION- 2024-25
कक्षा /CLASS- XII अविकतम अं क /MAX MARKS- 70
विषय /SUB- Computer Science (083) समय /TIME- 03 घं टे / Hours
General Instructions:
● This question paper contains 37 questions.
● All questions are compulsory. However, internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5 Sections- A, B, C, D and E.
● Section A consists of 21 questions (1 to 21). Each question carries 1 Mark.
● Section B consists of 7 questions (22 to 28). Each question carries 2 Marks.
● Section C consists of 3 questions (29 to 31). Each question carries 3 Marks.
● Section D consists of 4 questions (32 to 35). Each question carries 4 Marks.
● Section E consists of 2 questions (36 to 37). Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In case of MCQ, text of the correct answer should also be written.

Q No. Section-A (21 x 1 = 21 Marks) Marks

1. State True or False:


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

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


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

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

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


file = open("example.txt", "r")
data = file.read(100)
___________________#Move the file pointer to the beginning of the file (1)
next_data = file.read(50)
file.close()

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


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

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


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

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


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

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

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

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

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


network nodes establish a dedicated communications channel through the network (1)
before the nodes may communicate.
(A)circuit switching (B) message switching (C) packet switching (D) All of these
Q20 and Q21 are Assertion(A) and Reason(R) based questions. Mark the correct
choice as:
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation for A
(C) A is True but R is False
(D) A is False but R is True

20. Assertion (A): If the arguments in the function call statement match the number
and order of arguments as defined in the function definition, such arguments are
(1)
called positional arguments.
Reasoning (R): During a function call, the argument list first contains default
argument(s) followed by the positional argument(s).

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

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


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

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

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


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

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

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

import random

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

for y in range (4): (2)

x = random.randint (1,3)

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

Options are:

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

The given Python code to print all Prime numbers in an interval (range) inclusively.
26.
The given code accepts 02 number (low & high) as arguments for the function (2)
Prime_Series() and return the list of prime numbers between those two numbers
inclusively. Observe the following code carefully and rewrite it after removing all
syntax and logical errors. Underline all the corrections made.
Def Prime_Series(low, high)
primes = [ ]
for i in range(low, high + 1):
flag = 0
if i < 2:
continue
if i == 2:
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?

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

29. A) Write a Python function that displays all the words containing “@gov”
from a text file "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:

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

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

print(str2) (3)

OR

Predict the output of the following code:

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

32. Consider the table ORDERS as given below

O_Id C_Name Product Quantity Price


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

Page: 7/10
33. Mr. Snehant is a software engineer working at TCS. He has been assigned to develop
code for stock management; he has to create a CSV file named 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.

Table Name: TRADERS


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

Table Name: STOCK


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

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

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

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

Assume the following for Python-Database connectivity: Host:


localhost, User: root, Password: Pencil

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


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

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


37.
planning to set up training centers in various cities in the coming year. Their first center
is coming up in Surajpur district. At Surajpur center, they are planning to have 3
different blocks - one for Admin, one for Training and one for Development. Each block
has number of computers, which are required to be connected in a network for
communication, data and resource sharing. As a network consultant of this company,
you have to suggest the best network related solutions for them for issues/problems
raised in question nos. (i) to (v), keeping in mind the distances between various
blocks/locations and other given parameters.

Page: 9/10
Distance between various block and locations:
BLOCK DISTANCE
Development to Admin 28 m
Development to Training 105 m
Admin to Training 32 m
Surajpur campus to Coimbatore campus 340 km

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

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

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

Page: 10/10

You might also like