0% found this document useful (0 votes)
57 views10 pages

QP - 02

The document is a pre-board examination paper for Class XII Computer Science (083) by Kendriya Vidyalaya Sangathan, Ahmedabad Region, consisting of 35 questions divided into 5 sections with varying marks. It includes multiple-choice questions, programming tasks, and SQL queries, all requiring answers in Python. The total time allowed for the exam is 3 hours, with 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)
57 views10 pages

QP - 02

The document is a pre-board examination paper for Class XII Computer Science (083) by Kendriya Vidyalaya Sangathan, Ahmedabad Region, consisting of 35 questions divided into 5 sections with varying marks. It includes multiple-choice questions, programming tasks, and SQL queries, all requiring answers in Python. The total time allowed for the exam is 3 hours, with 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/ 10

KENDRIYA VIDYALAYA SANGATHAN, AHMEDABAD REGION

COMPUTER SCIENCE (083)


PRE-BOARD EXAMINATION -2023-4
Class: XII
Time allowed: 3 Hours Maximum Marks: 70
General Instructions:
• Please check this question paper contains 35 questions.
• The paper is divided into 5Sections- 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.

Que Question Marks


s No
SECTION A
1 State True or False 1
“Python has a set of keywords that can also be used to declare
variables”
2 Which of the following is not part of a DDL query? 1
a) DROP b) MODIFY
c) DISTINCT d) ADD
3 What will be the output of the following statement: 1
>>>Print(3-2**2**3+99/11)
a) 244 b) 244.0
c) -244.0 d) Error

4 What will the following expression be evaluated to in 1


Python? print(2**3 + (5 + 6)**(1 + 1))
a) 129 b) 8 c) 121 d) None
5 Which of the following function is used to established connection 1
between Python and MySQL database –
a) connection() b) connect() c) Connect() d) None
6 Which of the following is used to receive emails over Internet? 1
a) SMTP b) POP3 c) PPP d) VoIP
7 What will the following code do? 1
dict={"Exam":"AISSCE", "Year":2022}
dict.update({"Year”:2023} )

a. It will create new dictionary dict={” Year”:2023}and old dictionary


will be deleted
b. It will throw an error and dictionary cannot updated
c. It will make the content of dictionary as
[1]
dict={"Exam":"AISSCE", "Year":2023}
d. It will throw an error and dictionary and do nothing
8 Which of the following statement(s) would give an error after executing 1
the following code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Thank you" # Statement 5

(a) Statement 3 (b) Statement 4


(b) Statement 5 (d) Statement 4 and 5
9 What will be the datatype of d, if d = (15) ? 1
(a) int (b) tuple (c) list (d) string
10 Which of the following is a valid identifier in Python: 1
(a) elseif (b) for (c) pass (d) 2count
11 What is the size of IPv4 address? 1
(a)32 bits (b) 64 bits (c) 64 bytes (d) 32 bytes
12 Consider the code given below: 1
Which of the following statements should be given in the blank for
#Missing Statement, if the output produced is 110?
Options:

global a
a.
global b=100
b.
global b
c.
global a=100
d.
13 Which file mode can be used to open a binary file in both append and 1
read mode?
a) w+ b) wb+ c) ab+ d) a+
14 In MYSQL database, if a table STD, has degree 4 and cardinality 5, 1
and another table, EMP has degree 3 and cardinality 6, what will be
the degree and cardinality of the Cartesian product of STD and EMP ?
a. 12, 11 b. 7, 30
c. 11, 12 d. 30, 7
15 Fill in the blank: 1
application provides access to command line interface
on a remote computer.
(a) FTP (b) PPP (c) Telnet (d) SMTP

[2]
16 Select the correct output of the code: 1

for i in "QUITE":

print([i.lower()], end= "#")

(a) q#u#i#t#e#
(b) [‘quite#’]
(c) ['q']#['u']#['i']#['t']#['e']#
(d) [‘quite’] #

Q17 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
(c) A is True but R is False
(d)A is false but R is True
17 Assertion (A):- In Python, statement return [expression] exits a function. 1
Reasoning (R):- Return statement passes back an expression to the caller. A
return statement with no arguments is the same as return None.
18 Assertion (A): CSV module allows to write a single record into each 1
row in CSV file using writerow() function.
Reason (R): The writerow() function creates header row in csv file by
default.
SECTION – B

19 Differentiate between Web server and web browser. Write any two 2
popular web browsers.

OR
(i) Define the term bandwidth with respect to networks.
(ii) How is http different from https?
20 Rewrite the following code in python after removing all the syntax 2
errors
Underline each correction done in the code.

num1, num2 = 10,45


While num1 % num2 = 0
num1+= 20
Num2+= 30
else:
print(‘HelLO’)

21 Study the following program and select the possible output(s) from the 2
options (i) to (iv) following it. Also, write the maximum and the
minimum values that can be assigned to the
variable Y.
import random
X=random.random()
Y=
random.randint(0,4)
[3]
print(int(X),":",Y+int(X))
(i) 0 : 0
(ii) 1 : 6
(iii) 2 : 4
(iv) 0 : 3
OR
Write a function, lenWords(STRING), that takes a string as an argument
and returns a tuple containing length of each word of a string.
For example, if the string is "Hello how r you", the
tuple will have (4, 3, 1, 2)
22 Predict the output of the Python code given below : 2
myvalue = ["A", 40, "B", 60, "C", 20]
alpha = 0
beta = ""
gama = 0
for i in range(1,6,2):
alpha += i
beta += myvalue[i-1]+ "#"
gama += myvalue[i]
print(alpha, beta, gama)
23 Write the Python statement for each of the following tasks using BUILT- 2
IN functions/methods only:
(i) To delete an element 150 which has 4th index in the list L1.
(ii) To count number of words present in string :
Ex : s = “how are you friends”
Ans : 4
OR
(i) Given is a Python string declaration:
s=”Up Above The World So High”
Write the output of:
print(s[::-4])
(ii)Write the output of the code given below:
D={‘month’:’DECEMBER’,’exam’:’PREBOARD1’}
D[‘month’]=’JANUARY’
D[‘EXAM’]=’PRE2’
print(D.items())
24 Mr. Bhaumit has just created a table named “Emp” containing columns 2
Ename, Department and Salary. After creating the table, he realized
that he has forgotten to add a primary key column in the table. Help
him in writing an SQL command to add a primary key column EmpId of
integer type to the table Employee.
Thereafter, write the command to insert the following record in the
table:

[4]
EmpId- 101
Ename- Shweta
Department: Computer
Salary: 45500
OR

Nandan is working in a database named SPORT, in which he has


created a table named “Games” containing columns SportId,
SportName, no_of_players, and category.
After creating the table, he realized that the attribute, category has to
be deleted from the table and a new attribute TypeSport of data type
string has to be added. This attribute TypeSport cannot be left blank.
Help Nandan write the commands to complete both the tasks.
25 def Display(str): 2

m=""
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()

elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)
Display('[email protected]')

[5]
SECTION - C

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

27 Write output of the queries (i) to (iii) based on the table Sportsclub 3
Table Name: Sportsclub

playerid pname sports country rating salary

10001 PELE SOCCER BRAZIL A 50000

10002 FEDERER TENNIS SWEDEN A 20000

10003 VIRAT CRICKET INDIA A 15000

10004 SANIA TENNIS INDIA B 5000

10005 NEERAJ ATHLETICS INDIA A 12000

10006 BOLT ATHLETICS JAMAICA A 8000

10007 PAUL SNOOKER USA B 10000

(i) SELECT DISTINCT sports FROM Sportsclub;


(ii) SELECT sports, MAX(salary) FROM Sportsclub GROUP
BY sports HAVING sports<>'SNOOKER';
(iii) SELECT pname, sports, salary FROM Sportsclub
WHERE country='INDIA' ORDER BY salary
DESC;
[6]
28 Write a function test() in Python to read a text file, Alpha.txt and 3
displays those lines which begin with the word ‘You’.
OR
A pre-existing text file data.txt has some words written in it. Write a
python function displaywords() that will print all the words that are
having length greater than 3.
Example:
For the fie content:
A man always wants to strive higher in
his life He wants to be perfect.

The output after executing displayword() will be:


Always wants strive higher life wants perfect

29 Based on the given set of tables write answers to the following 3


questions. Table: flights
flightid model company
10 747 Boeing
12 320 Airbus
15 767 Boeing

Table: Booking
ticketno passenger source destination quantity price Flightid
10001 ARUN BAN DEL 2 7000 10
10002 ORAM BAN KOL 3 7500 12
10003 SUMITA DEL MUM 1 6000 15
10004 ALI MUM KOL 2 5600 12
10005 GAGAN MUM DEL 4 5000 10
a) Write a query to display the passenger, source, model and price for all
bookings whose destination is KOL.
b) Identify the column acting as foreign key and the table name where it
is present in the above table.
c) Increase the price by 10% whose quantity is greater than 2.
30 Write a function in Python, Push(SItem) where , SItem is a dictionary containing the 3
details of stationary items– {Sname:price}.
The function should push the names of those items in the stack who have price
greater than 75. Also display the count of elements pushed into the stack.
For example:
If the dictionary contains the following data

Ditem={"Pen":106,"Pencil":59,"Notebook":80,"Eraser":25}
The stack should contain
Notebook
[7]
Pen
The output should be:
The count of elements in the stack is 2

SECTION -D
31 Tarun creates a table RESULT with a set of records to maintain the marks 4
secured by students in Sem 1, Sem2, Sem3 and their division. After creation of
the table, he has entered data of 7 students in the table.
Table: RESULT

ROLL_NO SNAME SEM1 SEM2 SEM3 DIVISION

101 KARAN 366 410 402 I

102 NAMAN 300 350 325 I

103 ISHA 400 410 415 I

104 RENU 350 357 415 I

105 ARPIT 100 75 178 IV

106 SABINA 100 205 217 II

107 NEELAM 470 450 471 I

Based on the data given above answer the following questions:

I) If two columns are added and 2 rows are deleted from the table result,
what will be the new degree and cardinality of the above table?
II) Insert the following record into the table – Roll No- 108, Name- Aadit,
Sem1- 470, Sem2-444, Sem3-475, Div – I.
III) Increase the SEM2 marks of the students by 3% whose name
begins with ‘N’.
IV) Add a column REMARKS in the table with datatype as varchar with 50
characters
32 Write a Program in Python that defines and calls the following user defined 4
functions:

a) add() – To accept and add data of an employee to a CSV file ‘furdata.csv’.


Each record consists of a list with field elements as fid, fname and 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.
SECTION - E
33 Vinayak Corporation, an Uttarakhand based IT Training company, is planning to 5
set up training centres in various cities in next 2 years. Their first campus is
coming up in Kashipur district. At Kashipur campus, they are planning to have 3
different blocks for App development, Web designing and Movie Editing. 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
[8]
between various blocks/locations and other given parameters.

KASHIPUR
APP CAMPUS
DEVELOP MOVIE
MENT EDITING
MUSSOORIE
CAMPUS
WEB
DESIGNING

Distance between various blocks/locations:


Block Distance
App development to Web designing 28 m
App development to Movie editing 55 m
Web designing to Movie editing 32 m
Kashipur Campus to Mussoorie Campus 232 km
Number of Computers :

Block Number of Computers


App development 75
Web designing 50
Movie editing 80

(i) i) Suggest the most appropriate block/location to house the SERVER in 1 the Kas
effective connectivity. Justify your answer.
ii) Suggest a device/software to be installed in the Kashipur Campus
to take care of data security.

iii) Suggest the best wired medium and draw the cable layout (Block to 1
Block) to economically connect various blocks within the Kashipur
Campus.

iv) Suggest the placement of the following devices with appropriate 1


reasons:
a. Switch / Hub
b. Repeater

v) Suggest the protocol that shall be needed to provide Video Conferencing


solution between Kashipur Campus and Mussoorie Campus.
34 a) Difference between text and binary file. 2+3
b)Write a binary file “book.dat” that has structure [BookNo, Book_Name,
Author, Price]. Write function CreateFile() to take input data for a record
and add to book.dat and another user defined function CountRec(Author)
which accepts the Author name as parameter and count and return number
of books by the given Author.

OR
a) Difference between seek() and tell() with example
[9]
b) Kharanshu is a programmer, now he want to create a program as per
data given. AddStudents() to create a binary file called STUDENT.DAT
containing student information – roll number, name and marks (out of
100) of each student.
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.

35 a) Define degree and cardinality 1+4


b) Rythm wants to write a program in Python to insert the following
record in the table named Student in MYSQL database- KVS:
RollNo – integer
Name – string
Class – integer
Marks – integer

Note the following to establish connectivity between Python and MYSQL:


• Username is root
• Password is tiger
• The table exists in a MYSQL database named school.
• The details (RollNo, Name, Class and Marks) are to be
accepted from the user.
Help Rythm to write the program in Python.
OR
a) Give one difference between foreign key and candidate key.
b) Pranav has created a table named Std in MYSQL database,
SCHOOL:
rno(Roll number )- integer
name(Name) - string
DOB (Date of birth) – Date
Fee – float
Note the following to establish connectivity between Python and
MySQL:
Username - root
Password - tiger
Host - localhost
Pranav, now wants to display the records of students whose fee is more
than 5000. Help Pranav to write the program in Python.

[10]

You might also like