0% found this document useful (0 votes)
303 views9 pages

QP CS XII Set1

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

QP CS XII Set1

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

Code: - KVS (DR)/2024/JI

KENDRIYA VIDYALAYA SANGTHAN, DELHI REGION


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

Q
No SECTION – A (21X1=21 MARKS) Marks
.
1 State True or False : “ In Python tuple is mutable datatype” 1
2 What will the output of the following code 1
S = "text#next"
print(S.strip("t"))
(A) ext#nex (B) ex#nex
(C) text#nex (D) ext#next
3 What will be the output of the following statement : 1
print( 3 – 2 ** 2 ** 2 + 77 / 11 )
(A) 6 ( B) 6.0 (C) -6.0 (D) Error
4 Consider a list L = [‘H’, ‘U’, ‘L’, ‘K’]. Which of the following operations will 1
result in an error?
(A) L * 2 (B) L + [2]
(C) L * [2] (D) 2 * L
5 Consider the statements given below and then choose the correct output 1
from the given options :
Game="World Cup 2023"
print(Game[-6::-1])
(A) CdrW (B) ce o (C) puC dlroW (D) Error
6 Consider the tuple in python named sub=( “cs”, “phy”, “mat”). 1
Identify the invalid statement(s) from the given below statements:
(A) s=sub[1] (B) print(sub[2])
(C) sub[0]= “ip” (D) list=list(sub)
7 If my_dict is a dictionary as defined below, then which of the following 1
statements will raise an exception?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
(A) my_dict.get('orange')
(B) print(my_dict['apple', 'banana'])
(C) my_dict['apple']=20
(D) print(str(my_dict))
Page 1 of 9
8 Which keyword is used for function in python? 1
(A) Fun (B) def (C) DEFINE (D) Function
9 Mr. Ravi is creating a field that contains alphanumeric values and fixed 1
lengths. Which MySQL data type should he choose for the same?
(A) VARCHAR (B) CHAR (C) LONG ( D) NUMBER
10 Which is the valid syntax to write an object onto a binary file opened in the 1
write mode?
(A) pickle.dump(<object to be written>, <file handle of open file>)
(B) pickle.dump(<file handle of open file>, <object to be written>)
(C) dump.pickle(<object>, <file handle>)
(D)None of the above
11 The output of the given expression is 1
>>>20 * (20 / 0)
(A) NameEr ror (B) TypeError
(C)OverflowError (D) ZeroDivisionError
12 What will be the output of the following code? 1
a = 15
def update(x):
global a
a += 2
if x%2==0:
a *= x
else:
a //= x
a=a+5
print(a, end="$")
update(5)
print(a)
(A) 20$11 (B) 15$4 (C) 20$4 (D) 22$4
13 The structure of the table/relation can be displayed using ______ command. 1
(A) view (B) describe (C) show (D) select
14 What will be the output of the query? 1
SELECT * FROM products WHERE product_name LIKE 'App%';
(A) Details of all products whose names start with 'App'
(B) Details of all products whose names end with 'App'
(C) Names of all products whose names start with 'App'
(D) Names of all products whose names end with 'App' .
15 Which of the following statements is FALSE about keys in a relational 1
database?
(A) Any candidate key is eligible to become a primary key.
(B) A primary key uniquely identifies the tuples in a relation.
(C) A candidate key that is not a primary key is a foreign key.
(D) A foreign key is an attribute whose value is derived from the primary
key of another relation.
16 Which aggregate function can be used to find the cardinality of a table? 1
(A)sum() (B)count() (C)avg() (D)max()
17 Which protocol is used to transfer files over the Internet? 1
(A) HTTP (B) Telnet (C) PPP (D)HTTPS

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

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


L = [1, 23, ‘hi’, 6].
(i)list (ii) dictionary
(iii) array (iv) tuple
(B) Which is the correct form of declaration of dictionary?
(i) Day={1:’monday’,2:’tuesday’,3:’wednesday’}
(ii) Day=(1;’monday’,2;’tuesday’,3;’wednesday’)
(iii) Day=[1:’monday’,2:’tuesday’,3:’wednesday’]
(iv) Day={1’monday’,2’tuesday’,3’wednesday’]
24 (i) Consider the List prices L=[23.811,237.81,238.91] then 2
(Answer using built in function only)
(A) Write a statement to sort the elements of list prices in ascending order
OR
(B) Write the statement to find the minimum or smallest element from list
(ii) Consider the List prices L=[“Jan”,”Feb”,”Mar”] then
(Answer using built in function only)
(A) Add the element “Apr” at the last
OR
Page 3 of 9
(B) Find the index of “Feb”
25 What possible output(s) are expected to be displayed on screen at the time 2
of execution of the program from the following code? Also specify the
maximum values that can be assigned to each of the variables FROM and
TO.

import random
AR=[20,30,40,50,60,70];
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print (AR[K],end=”# “)

(i) 10#40#70# (ii) 30#40#50#


(iii) 50#60#70# (iv) 40#50#70#
26 Kavi has written a function to print Fibonacci series for first 10 element. 2
His code is having errors. Rewrite the correct code and underline the
corrections made. Some initial elements of Fibonacci series are:
def fibonacci()
first=0 second=1
print((“first no. is “, first)
print (“second no. is,second)
for a in range (1,9):
third=first+second
print(third)
first,second=second,third
fibonacci()

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

OR
(C) Write an SQL command to make the column M_ID the Primary Key of an
already existing table, named MOBILE.

28 (A) Expand the following terms: 2


i. SMTP ii. TCP/IP
(B) Give one difference between XML and HTML?
OR

Page 4 of 9
Write one advantage and one disadvantage of each –
(i) STAR Topology
(ii) Tree Topology

Section– C (3X3=9 Marks)


29 Write a function in python to count the number of lines in a text file 3
‘STORY.TXT’ which is starting with an alphabet ‘A’.
OR
Write a method/function DISPLAYWORDS() in python to read lines from a
text file STORY.TXT, and display those words, which are less than 4
characters.
30 Raju has a list containing 10 integers. You need to help him create a 3
program with separate user defined functions to perform the following
operations based on this list.
➢ Traverse the content of the list and push the even numbers into a stack.
➢ Pop and display the content of the stack.
For example:
If the sample content of the list is as follows:
N=[12,13,34,56,21,79,98,22,35,38]
Sample output of the code should be:
38 22 98 56 34 12
OR
A list, NList contains following record as list elements:
[City, Country, distance from Delhi]
Each of these records are nested together to form a nested list. Write the
following user defined functions in Python to perform the specified
operations on the stack named travel.

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


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

(ii) Pop_element(): It pops the objects from the stack and displays them.
Also, the function should display “Stack Empty” when there are no elements
in the stack. For example:
If the nested list contains the following data:

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


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

S.NO NAME STIPEND SUBJECT AVERAGE DIV


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

(A) Write the following queries


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

COURSES

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

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

F_ code : Flight code (String)


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

Consider the following to establish connectivity between Python and


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

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

Law Block to business Block 40m

Page 8 of 9
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
Mumbai Head Office to Raipur 800 km

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


.

BUSINESS BLOCK 25
TECHNOLOGY BLOCK 40

LAW BLOCK 15
HR CENTRE 115

Write the Answers:


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

Page 9 of 9

You might also like