0% found this document useful (0 votes)
37 views7 pages

QP - Hy Cs Xii 2023

Python Class 12 Half Yearly Paper

Uploaded by

hempant1978
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)
37 views7 pages

QP - Hy Cs Xii 2023

Python Class 12 Half Yearly Paper

Uploaded by

hempant1978
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/ 7

केन्द्रीय विद्यालय संगठन बेंगलुरु संभाग

अर्धवार्षिक परीक्षा – 2023-24


KENDRIYA VIDYALAYA SANGATHAN BENGALURU REGION
HALF YEARLY EXAMINATION – 2023-24
COMPUTER SCIENCE – XII
MM: 70 Time: 3 hours
1. The question paper is divided into five sections and all the questions are compulsory.
2. Section A has got 14 Select-response questions of 1 mark each and 4 Assertion reasoning based 1
mark question. Section B has eight questions of 2 marks each. Section C has six questions of 3 marks
each. Section D contains two questions of 4 marks each and Section E contains two questions of 5
marks each.
3. There are no overall choices, but internal choices are there in Section C and D.
SECTION - A
1 Which among the following keywords is also an operator? 1
a) True b) is c) for d) break

2 What will be the output of the python operation - 10 and 5 or 10 1


a) 10 b) 5 c) True d) False

3 What will be the output of the following python program? 1


s = "mandolinmaniac"
print(s.split("man"))
a) ['', 'dolin', 'iac']
b) ['man', 'dolin', 'man','iac']
c) ['dolin', 'iac']
d) ['dolin', 'man','iac']
4 Which of the following python functions returns the value for a key of a dictionary? 1
a) popitem() b) remove() c) pop() d) del

5 Which of the following python function header declaration is wrong? 1


a) def myfunction(x, y, z):
b) def myfunction(x, y=10, z=20):
c) def myfunction():
d) def myfunction(x=10, y, z=20):
6 When a python function returns more than one value in a single return statement, which of the 1
following collection objects gets returned?
a) List b) Tuple c) Dictionary d) String

7 Which type of exception will be raised for the operation print('A'+10) 1


a) ValueError
b) TypeError
c) KeyError
d) NameError
8 Which of the following modes will allow the file to be opened for only writing? 1
a) 'a+'
b) 'r+'
c) Both option a) and b)
d) Neither option a) nor option b)
9 Consider a file 'string.txt' has some characters written into it. Now the file is opened in 'rb' mode 1
1
using the file object myfile. What will be the output of the following python operation?
myfile.read(4)
myfile.seek(5,1)
myfile.read(2)
myfile.seek(-4,1)
print(myfile.tell())
a) 8 b) 7 c) 6 d) Error

1 Which of the following network devices is used to connect between two dissimilar protocols? 1
0 a) Switch b) Router c) Modem d) Gateway
11 Which network protocol provides a command line interface for communication with a remote 1
device or server?
a) Telnet b) HTTP c) PPP d) SMTP

1 Which of the following switching techniques sends small pieces of data across a network? 1
2 a) Circuit switching
b) Message switching
c) Packet switching
d) All the above.

1 Which of the following is false for XML? 1


3 a) XML is a case sensitive language.
b) XML is used to describe data for a webpage.
c) XML has fixed set of tags.
d) XML can be used as a meta language.

1 Which of the following protocols is used to receive emails? 1


4 a) POP3 b) SMTP c) FTP d) TCP

Questions 15 to 18 are ASSERTION AND REASONING based questions. Mark the correct
choice as:
i) Both A and R are true and R is the correct explanation for A
ii) Both A and R are true and R is not the correct explanation for A
iii) A is True but R is False
iv) A is false but R is True

1 Assertion: Python interactive mode allows to execute one statement/expression at a time. 1


5 Reasoning: The Python shell is useful for executing simple programs or for debugging parts of
complex programs.

1 Assertion: Positional parameters in a python function must always follow the default parameters. 1
6 Reasoning: Default parameters provide a default value whenever the argument is not passed
during a function call.

1 Assertion: Text files can only store objects as strings in them. 1


7 Reasoning: Text files can be opened in text as well as binary modes.

1 Assertion: CSV files stores data in a file with values separated by commas and we can open them 1
8 normally using open() function.
Reasoning: CSV files are simple text files with .csv extension.

2
SECTION-B
1 State True or False: 2
9 a) Nested lists inside a tuple are mutable. Eg. (10, [20,30,40], 50) can become (10,
[20,50,40], 50)
b) A python user defined function may not have a body at all and can be successfully called.
Eg.
def foo():

foo() #function call

2 Fill in the blanks: 2


0 a) The return datatype of readline() function in python is ________.
b) The block that is not mandatory in try: except: and finally: is __________.
2 Amaya has created a python program and wants to permanently modify an integer variable, 2
1 declared outside the function, by the user defined function. He has written the following code,
but he is unable to get the desired result. Help him to identify his mistake and re-write the
program to get the desired result. Also suggest to him the correct output of the program.
def change():
a = a+10
a = 20
change()
print(a)

2 Read the following programs and name the exceptions that will arise after executing the code: 2
2 a) print(int('A'))
b) a = 10
print(b)

2 What will be the lowest and the highest values of n in the program given below. Also predict the 2
3 correct output from the given choices:
import random
name = ['TOM','BOB','JIM','SID','JOE']
low = 1
high = 4
for i in range(4):
n = random.randrange(low, high+1)
print(name[n], end='#')
high=high-1
a) BOB#JOE#JIM#BOB#
b) JIM#JIM#BOB#SID#
c) BOB#JIM#JIM#BOB#
d) JOE#SID#SID#BOB#

2 Rewrite the following program after removing the errors. Also underline the corrections made. 2
4 n = int(input())
if n % 10 = 0:
n = n + 10
elif n >= 20:
n =- 5
else
n = 40
print("n=" n)
2 Write one advantage and one disadvantage of bus topology. 2
5

3
4
2 Expand the following abbreviations: 2
6 a) SMTP
b) ARPANET

SECTION – C
2 Fill in the blanks for the following questions: 3
7 a) ___________ topology is highly dependent on the central node.
b) The unit of measurement of data transfer rate is ____________.
c) The relative address of a document or a resource on a webserver is called ___________.

2 Predict the output of the following python program: 3


8 def changeme(a,b=10):
global c
a += b
b += c
c=a+b
print(a, b, c)
return b//2
a,b,c= 5,20,15
b = changeme(a,c)
print(a,b,c)

2 What will be the output of the following python program: 3


9 data = [10, 20, 30, [40,50,60],70]
x = data.pop(3)
print(x)
data[2:2]=[40,50]
print(data[4])
print(len(data))

[OR]
What will be the output of the following python program:
name = "HOME ALONE WITH MOM"
data = name.partition('ALONE')
print(data[0].lower())
print(data[2].title())
print(data[1][::-2])

3 A pre-written text file data.txt has some strings stored in it. Write a python function display() that 3
0 reads the contents of the file and displays all the words that start with the substring 'th' or 'Th'.
Eg. If the file has the following data:
“There was a man who throughout his life
thanked others for their little help”
The output should be:
There
throughout
thanked
[OR]

A pre-written text file info.txt has some strings written in it. Write a python function countme()
that reads the contents of the file and returns the count of all the words which are 'that'.

5
3 A pre-written text file info.txt has some lines written in it. Write a function display() that prints 3
1 all the lines that has the word 'India' in them.
[OR]
A pre-written text file data.txt has some lines written in it. Write a function display() that prints
all the lines that have exactly 10 words in them.

3 a) Mention two differences between a hub and a switch. (2) 3


2 b) Give one example of a popular web browser. (1)

SECTION – D
3 A binary file student.dat needs to be written with the following data in the form of dictionaries. 4
3 Rollno Name Class Marks
1001 Tom 10 75
1002 Bob 11 80
1003 Sid 10 90
a) Write a python function insert() that opens the binary file for writing and writes all the three
records in it.
b) Write python function view() that opens the binary file for reading and displays student
details whose Marks are more than 75.
[OR]
A binary file emp.dat needs to be written with the following data in the form of lists.
Empno Ename Gende Salary
r
2001 Richa F 7500
2002 Sonam F 9000
2003 Manu M 8000
a) Write a python function insert() that opens the binary file for writing and writes all the three
records in it.
b) Write python function show() that opens the binary file for reading and displays employee
details whose gender is F.
3 Write a python function push(stack) that pushes on to an empty list(stack) all the values of a 4
4 dictionary whose keys are palindromes.
Eg: for the dictionary {'ROY':100, 'ARORA':200, 'MADAM':250, 'SAHA':300, 'LEVEL':400}
the stack should have the values 200, 250 and 400 since ARORA, MADAM and LEVEL are
palindromes.

Write a python function popstack(stack) that pops out the last added element from the stack each
time the function is called and also prints a 'Stack Empty' message if all the elements have
popped out.
Also write the call statements for both the functions.
[OR]
Write a python function push(stack) that pushes on to an empty list(stack) all the values from a
list of strings, whose lengths are more than 5.

Write a python function popstack(stack) that pops out the last added element from the stack each
time the function is called and also prints a 'Stack Empty' message if all the elements have
popped out.
Also write the call statements for both the functions.

SECTION – E
3 Rohit wants to create a python application that writes a set of records in a csv file info.csv. He is 5
5 having some issues and has left a few blank lines. On behalf of Rohit, you are directed to write
the missing codes.

6
_____________ # Statement 1
f = open('info.csv', 'w', newline='')
csvwriter = __________________ # Statement 2
head = ['Id', 'Book', 'Quantity', 'Price']
data = [[101, 'Stardust', 100, 50], [102, 'Athabasca', 200, 300], [103, 'Troy', 150, 180]]
___________________ # Statement 3
___________________ # Statement 4
___________________ # Statement 5

a) Statement 1 : Write a statement that enables python to work with csv files.
b) Statement 2 : Write a statement to initialize the csvwriter object.
c) Statement 3 : Write a statement to write the head object to the file.
d) Statement 4 : Write a statement to write the data object to the file.
e) Statement 5 : Write a statement end the program be releasing the file handle f.

3 Tribor infotech has their new campus in Bangalore. They have four buildings on their campus 5
6 that need to be connected through a network. The details of the number of computers in each
building and distance between the buildings are as below.

Accounts HR

Tech Admin

Building Computers Buildings Distance


Accounts 150 Accounts - HR 75m
HR 100 Accounts – Tech 90m
Tech 75 Accounts - Admin 150m
Admin 300 HR – Tech 200m
HR – Admin 60m
Tech - Admin 80m

Answer the following questions based on the above case study:


a) Suggest the placement of the server on the campus with Justification to do so.
b) Draw a suitable cable layout to connect all the buildings in a local area network.
c) Suggest the placement of Switches and Repeaters on the campus.
d) Suggest the high speed wired communication line between Bangalore campus to Mysure
Office.
e) Suggest the protocol be used to connect to the ISP through a conventional telephone line
from the campus.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy