0% found this document useful (0 votes)
25 views

QP _ 03

The document is a pre-board examination paper for Class XII Computer Science (083) conducted by Kendriya Vidyalaya Sangathan, Ahmedabad Region. It consists of 35 questions divided into five sections, covering various topics in computer science and programming, primarily using Python. The exam has a total duration of 3 hours and a maximum score of 70 marks.
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)
25 views

QP _ 03

The document is a pre-board examination paper for Class XII Computer Science (083) conducted by Kendriya Vidyalaya Sangathan, Ahmedabad Region. It consists of 35 questions divided into five sections, covering various topics in computer science and programming, primarily using Python. The exam has a total duration of 3 hours and a maximum score of 70 marks.
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/ 7

KENDRIYA VIDYALAYA SANGATHAN, AHMEDABAD REGION

COMPUTER SCIENCE (083)


PRE BOARD EXAMINATION - 2023-24
CLASS: XII
Time allowed: 3 Hours Maximum Marks: 70

General Instructions:
• Please check this question paper contains 35 questions.
• The paper is divided into 5 Sections- A, B, C, D and E.
• Section A, consists of 18 questions (1 to 18). Each question carries 1 Mark.
• Section B, consists of 7 questions (19 to 25). Each question carries 2 Marks.
• Section C, consists of 5 questions (26 to 30). Each question carries 3 Marks.
• Section D, consists of 2 questions (31 to 32). Each question carries 4 Marks.
• Section E, consists of 3 questions (33 to 35). Each question carries 5 Marks.
• All programming questions are to be answered using Python Language only.

Ques
Question Marks
No
SECTION A
1 Which command comes under TCL (Transaction Control Language)?
1
(a) alter (b) update (c) grant (d) create
2 Which of the following is an invalid datatype in Python?
(a) list (b) Dictionary (c)Tuple (d) Class 1
3 Given the following dictionaries
dict_fruit = {"Kiwi":"Brown", "Cherry":"Red"}
dict_vegetable = {"Tomato":"Red", "Brinjal":"Purple"}
Which statement will merge the contents of both dictionaries? 1
(a) dict_fruit.update(dict_vegetable) (b) dict_fruit + dict_vegetable
(c) dict_fruit.add(dict_vegetable) (d) dict_fruit.merge(dict_vegetable)
4 Consider the given expression:
not False and False or True
1
Which of the following will be correct output if the given expression is evaluated?
(a) True (b) False (c) NONE (d) NULL
5 Select the correct output of the code:

(a) 0 1 2 ….. 15 (b)Infinite loop


(c) 0 3 6 9 12 15 (d) 0 3 6 9 12
6 Which of the following is not a valid mode to open a file? 1
(a) ab (b) r+ (c) w+ (d) rw
7 Fill in the blank:
1
command is used to delete the table from the database of SQL.

1
(a) update (b)remove (c) alter (d) drop

8 Which of the following commands will use to change the structure of table in MYSQL 1
database?
(a) DELETE TABLE (b) DROP TABLE
(c) REMOVE TABLE (d) ALTER TABLE
9 What possible output(s) are expected to be displayed on screen at the time of execution
of the program from the following code?
import random
points=[20,40,10,30,15]
points=[30,50,20,40,45]
begin=random.randint(1,3) 1
last=random.randint(2,4) for c in
range(begin,last+1):
print(points[c],"#")
(a) 20#50#30# (b) 20#40#45
(c) 50#20#40# (d) both (b) and (c)
10 Fill in the blank:
is an attribute whose value is derived from the primary keyof some
other table. 1
(a) Primary Key (b) Foreign Key
(c) Candidate Key (d) Alternate Key
11 The tell() function returns:
(a) Number of bytes remaining to be read from the file
(b) Number of bytes already read from the file 1
(b) Number of the byte written to the file
(d) Total number of bytes in the file
12 Network in which every computer is capable of playing the role of a client, or a server or
both at same time is called :
(a) local area network
1
(b) peer-to-peer network
(c) dedicated server network
(d) wide area network
13 Which switching technique follows the store and forward mechanism?
(a) Circuit switching (b) message switching 1
(c) packet switching (d) All of these
14 What will the following expression be evaluated to in Python?
Print (16-(3+2)*5+2**3*4) 1
(a) 54 (b) 46 (c) 23 (d) 32
15 What will be the result of the following statements?
1
a) bool(int(“0‟)) b) type(“hello”)
16 Fill in the blank:
________ is a communication methodology designed to deliver both voice and
1
multimedia communications over Internet protocol.
(a) SMTP (b) VoIP (c) PPP (d) HTTP
Q 17 and 18 are ASSERTION AND REASONING based questions.
Mark the correct choice as
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
2
(c) A is True but R is False
(d) (d)A is false but R is True
17 Assertion (A):- key word arguments are related to the function calls.
Reasoning (R):- when you use keyword arguments in a function call, the caller identifies 1
the arguments by parameter name.
18 Assertion (A): CSV stands for Comma Separated Values
1
Reason (R): CSV files are a common file format for transferring and storingdata.
SECTION B
19 Jiya has written a Python program to add all the numbers of the list. Her code is having
errors. Rewrite the correct code and underline the corrections made.

define sum(numbers):
total = 0 2
for x in numbers
total += x
returns total
Print(sum([4, 6, 3, 5, 6]))
20 (a) Given is a Python string declaration:
mySubject = "Computer Science with Python"
Write the output of : print(mySubject[ -27 : -10 : 2])

(b) Write the output of the code given below: 2


>>> a=[10, 20, 30, 40, 50, 60, 70]
>>> a[3:5]=[100,1000]
>>> a[3:5]=[10000]
>>> print(a)
21 Predict the output of the Python code given below:

def Alpha(N1, N2):


if N1>N2:
print(N1%N2)
else:
print(N2//N1, '#', end=' ') 2

NUM = [10, 23, 14, 54, 32]


for C in range (4, 0, -1):
A = NUM[C]
B = NUM[C-1]
Alpha(A, B)
22 What is the use of Modem and Router in a network?
OR 2
Write two points of difference between Star topology and Bus topology.
23 Name the aggregate functions which work only with numeric data, and those that work
with any type of data.
OR
Consider the following two commands with reference to a table, named Students, having
a column named Section:
2
(a) Select count (Section) from Students;
(b) Select count(*) from Students;
If these two commands are producing different results,
(i) What may be the possible reason?
(ii) Which command, (a) or (b), might be giving higher value?
3
24 (a) Given is a Python string declaration:
myexam="Russia Ukrain"
Write the output of :
print(myexam[-2: 2: -2])
2
(b) Write the output of the code given below:
d1 = {"name": "Aman", "age": 26}
d2 = {27:'age','age':28}
d1.update(d2)
print(d1.values())
25 Write a function count_Country(c) in Python, that takes the dictionary, c as an argument
and displays the names (in uppercase) of the countries whose names are greater than 6
characters.
For example, Consider the following dictionary
Country = {1:"America", 2:"India", 3:"China", 4:"Germany", 5:"Japan"}
2
The output should be: AMERICA GERMANY
OR
Write a function Magic_Word(text), that takes a text as an argument and returns a tuple
containing length of each word of a text.
For example, if the text is "What is your hobby", the tuple will have (4, 2, 4, 5)
SECTION C
26 Write a function lenFOURword(L), where L is the list of elements (list of words)
passed as argument to the function. The function returns another list named
‘indexList’ that stores the indices of all four lettered word of L.
3
For example:
If L contains [“AKASH”, “RAMESH”, “AMAN”, “SURESH”, “KARN”]
The indexList will have [2, 4]
27 Write the outputs of the SQL queries (i) to (iii) based on the relation Stock given below:
Table : Stock

(i) SELECT Dcode, MAX(UnitPrice) FROM STOCK GROUP BY Dcode;


(ii) SELECT COUNT(DISTINCT Dcode) FROM STOCK;
(iii) SELECT Qty*UnitPrice FROM STOCK WHERE ItemNo=5006;

28 Write a user-defined function Count_H_T() in Python that displays the number of lines
starting with ‘H’ and ‘T’ in the file “Poem.txt”.
3

4
Example, if the file contains:
Here we go round the mulberry bush,
The mulberry bush,
The mulberry bush.
Here we go round the mulberry bush
On a cold and frosty morning.

The line count should be 4


OR
Write a function bush_Count() in Python, which should read each word of a text file
“Poem.txt” and then count and display the count of occurrence of word “bush”.

Example: If the file content is as follows :


Here we go round the mulberry bush
The mulberry bush
The mulberry bush
Here we go round the mulberry bush
On a cold and frosty morning.
The bush_Count() function should display the output as :
The number of word bush : 4
29 Consider the Table Student give below :
Table : Student

RNo Name Subject Marks


1101 PRAGYA English 86
1105 SUNIL Chemistry 92
1106 VISHAL CS 82
3
1107 KIRTI Chemistry 74
1109 ROHIT Maths 91
Writh the SQL queries for following :
(i) Increase 2 marks in Chemistry Subject
(ii) Delete the record whose Roll Number is 1106
(iii) Display the student name and subject whose marks is less than 90.

30 A list contains the following record of a Hostel:


[Hostel_No, Total_Students, Total Rooms]
Write the following user defined functions to perform given operations on the stack
named ‘Hostel’:
(i) Push_element() - To push an object containing Hostel_No and Total Students along
with Total Rooms to the stack
(ii) Pop_element() - To pop the objects from the stack and display them. Also, display
“Stack Empty” when there are no elements in the stack.

For example: 3
If the lists of Hostel details are:
[1,2000,1000]
[2, 1500,800]
[3,5000,2000]
The output should be:
[1,2000,1000]
[2, 1500,800]
[3,5000,2000]
Stack Empty
5
SECTION D
31 Write the SQL queries based on the relations Employee and Station Tables given below :
Table : Employee
E_ID Name Age Department DOJ Salary Gender
1 R K Mishra 32 Sales 2020-12-12 30000 M
2 A I Verma 35 Purchase 2018-07-01 40000 F
3 S Gupta 34 HR 2019-01-10 12000 M
4 G Dave 50 Purchase 2019-06-27 30000 M
5 S N Tripathi 33 Sales 2018-07-31 20000 F
6 S L Jain 44 HR 2019-02-25 21000 M
7 V K Parmar 31 Purchase 2017-03-24 20000 M
8 J Singh 42 Sales 2021-09-05 25000 M
4
Table : Station
P_ID Department Place
1 Sales Sector 21
2 Purchase Sector 35
3 HR Sector 17
(i) Display department wise maximum salary from the Employee Table.
(ii) Display Name, Salary, Department and Place for the Employees whose department
is Purchase.
(iii) Display Name and Place for female Employees.
(iv) Display details of male Employees who joined the Company before 01.07.2018.
32 Preeti Kothe is a Python programmer working in Datatech Pvt Ltd. For the Modern
Sports Ltd, he has created a csv file named sports.csv, to store the data of sports person.

Write User Defined Functions in Python as per following requirements :


4
(i) Add_person () – To accept and add data of a sports person to a CSV file ‘sports.csv’.
Each record consists of Sid, Name, Age, Game
(ii) Count_Football () – To count the number of records present in ‘sports.csv’ whose
game is Football.
SECTION E
33 An International Bank has to set up its new data center in Delhi, India.It has five blocks
of buildings – A, B, C, D and E.

Distance between the blocks and number of computers in each block areas given below:
5

6
Give answers :
(i) Suggest the most suitable block to host the server. Justify youranswer.
(ii) Draw the cable layout (Block to Block) to economically connectvarious 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. Whichtype of network
out of LAN, MAN, or WAN will be formed? Justifyyour answer.
(v) Suggest a device/software to be installed in the Delhi Campus totake care of data
security.

34 (i) Explain foreign key with example.


(ii) Roshani has created a table named BOOK in MYSQL database, LIB:
BID (Book Id) - integer
BNAME (Name of Book) - string
DOP (Date of purchase) – Date
PRICE – float
Note the following to establish connectivity between Python and MySQL:
Username - root Password - tiger Host – localhost
Roshani, now wants to display the records of books whose price is less than 400.
Help her to write the program in Python
OR
1+ 4=
(i) What is domain ? Give suitable example.
5
(ii) Ankit wants to write a program in Python to insert the following records in the table
named BOOK in MYSQL database LIB.
BID (Book Id) - integer
BNAME (Name of Book) - string
DOP (Date of purchase) – Date
PRICE – float
Note the following to establish connectivity between Python and MySQL:
Username - root Password - tiger Host – localhost
The values of BID, BNAME, DOP, PRICE has to be accepted from the user. Help
Rohan to write the program in python.

35 (i) Differentiate between rb and wb file modes in Python.


(ii) Consider a file, EMPLOYEE.DAT, containing records of the following structure:
[empid, ename, post]
Write a function, TransferData(), that reads contents from the file EMPLOYEE.DAT
and copies the records with post as “TEACHER” to the file named TEACHER.DAT.
The function should return the total number of records copied to the file
TEACHER.DAT.

OR 2+3=
(i) How are text files different from binary files? 5
(ii) A Binary file, STUDENT.DAT has the following structure:
[ rollno, sname, subject ]
Where rollno – Roll Number
sname – Student Name
subject is Student subject.
Write a user defined function, findStudent(sub), that accepts sub as parameter and
displays all the records from the binary file STUDENT.DAT, that have the value of
Student Subject as sub.

You might also like