HALFYEARLY_MARKINGSCHEME
HALFYEARLY_MARKINGSCHEME
a) Error
b) None
c) False
d) True
1
7 If my_dict is a dictionary as defined below, then which of the following statements will raise an 1
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))
a) 80#80
b) 80#100
c) 80#35
d) 80#20
13 Identify the type of topology from the following: 1
(i) In it, each node is connected with the help of a single co-axial cable.-Bus topology
2
15 Evaluate the following expression: 1
>>>(not True) and False or True-True
16 Fill in the blank: 1
Voice over Internet Protocol (VoIP) is a communication methodology designed to deliver
both voice and multimedia communications over Internet protocol.
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): Keyword arguments were the named arguments with assigned values being 1
passed in the function call.
Reasoning (R): Default arguments cannot be skipped while calling the function while
keyword arguments are in function call statement- c). A is True but R is False
21 Assertion (A): Stack is a linear data structure that works on the principle of FIFO (First In 1
First OUT)
Reasoning (R): The stack is created with the help of a list with some restrictions. It manages
a pointer called stack pointer (SP) that will increase or decrease by 1, if an element is entered
or removed from the stack respectively. d). A is false but R is True
SECTION B
A mutable object can be updated whereas an immutable object cannot be updated. Mutable
object: [1,2] or {1:1,2:2}
Immutable object: (1,2) or ‘123’
3
25 Write the Python statement for each of the following tasks using BUILTIN functions/methods 2
only.
i)To check whether a string named, ‘message’ contains only alphabets and numbers.
Message.isalnum()
ii)To get the index of the element ‘apple’ in a list named ‘fruit’ fruit.index(‘apple’)
26 What will be the output of following Python Code: 2
a) 50 # 51 # 52 # 53 # 54 # 55 # b) 54 # 53 # 54 # 55#
c) 53 # 54 # 55 # 56 # d) 51 # 52 # 53 # 54 # 55
27 i)peep operation is inspecting the value at the stack‟s top without removing it. 2
ii) Define data structure.
28 2
Compare optical fiber and co-axial transmission media.
SECTION –C
29 Write a function RainCount() in Python, which should read the content of a text file 3
“RAIN.TXT” and then count and display the count of occurrence of word RAIN (case-
insensitive) in the file.
Example: If the file content is as follows:
It rained yesterday
It might rain today
I wish it rains tomorrow too
I love Rain
The RainCount() function should display the output as: Rain – 2
30 numb=int(input("enter any number")) 3
facts=[]
for a in range(1,numb+1):
if numb%a==0:
facts.append(a)
print(facts)
for i in range(len(facts)):
print(facts.pop(),end=' ')
31 A list contains following record of a doctor:[Doc_ID, Doc_name, Phone_number, Speciality] 3
Write the following user defined functions to perform given operations on the stack named
"Doctor":
(I) push_doctor(Doctor, new_Dr): This function takes the stack Doctor and a new record
new_Dr as arguments and pushes the new record onto the stack.
(II) pop_doctor(Doctor): This function pops the topmost doctor record from the stack and
returns it. If the stack is already empty, the function should display "Underflow".
(III) peep(Doctor): This function displays the topmost element of the stack without deleting it.
If the stack is empty, the function should display 'None’
4
SECTION D
32 i)When is ValueError exception raised in Python?-1 4
It is raised when a built-in method or operation receives an argument that has the right
data type but mismatched or inappropriate values
ii). Give an example code to handle ValueError? The code should display the message "Enter
the correct value" in case of ValueError exception, and the message "Some error occurred" in
case of any other exception.-3
try:
numerator=50
denom=int(input("Enter the denominator"))
quotient=(numerator/denom)
print ("Division performed successfully")
except ValueError:
print ("Enter the correct value ")
except:
print("Some error occurred ")
33 i) Write a function LShift(Arr,n) in Python, which accepts a list Arr of numbers and n is a 2
numeric value by which all elements of the list are shifted to left.
Sample InputData of the list
Arr= [ 10,20,30,40,12,11], n=2 Output Arr = [30,40,12,11,10,20]
ii) 2
Find the output for the following code
c&&vVpP
34 A csv file “result.csv” contains record of student in following order 4
[rollno, name, sub1,sub2,sub3,total]
Initially student total field is empty string as given in example data below
['1', 'Anil', '40', '34', '90', '']
['2', 'Sohan', '78', '34', '90', '']
['3', 'Kamal', '40', '45', '9', '']
Another file "final.csv" is created which reads records of “result.csv” and copy all records after
calculating total of marks into final.csv. The contents of final.csv should be
['1', 'Anil', '40', '34', '90', '164']
['2', 'Sohan', '78', '34', '90', '202']
['3', 'Kamal', '40', '45', '9', '94']
SECTION E
36 JK Furniture has hired Ms Asha, a programmer to manage their inventory. The following 5
information about each product has to be stored.
ProductID -Integer,
ProductName-String,
Quantity-Integer,
Price-Float
You, as a programmer of the company, have been assigned to do this job for Ms. Asha.
Suggest:
(I) What type of file (text file, csv file, or binary file) will you use to store this data? Give one
5
valid reason to support your answer.
(II) Write a function to input the data of a product and append it in the file that you suggested
in part (I) of this question.
(III) Write a function to read the data from the file that you suggested in part (I) of this
question and display the details of products with a price higher than Rs. 1000.
Text file: A text file allows for easy maintenance of data, as it can be opened and
manipulated with any text editor also.
CSV File: A CSV file allows for easy maintenance of data, as it can be opened and
manipulated with any spreadsheet application also.
Binary File: A binary file cannot be opened and manipulated with any general
purpose application, and hence, it prevents any unintentional change in the data
37 Kendriya Vidyalaya Jawahar Nagar is setting up the network between its different Wings of 5
school campus. There are 4 wings named as SENIOR(S), JUNIOR(J), ADMIN(A) and
HOSTEL(H).
(a)Draw the cable layout to efficiently connect various wings of Kendriya Vidyalaya Jawahar
Nagar and suggest the topology.-1
(b) Name the most suitable wing where the Server should be installed. Justify your answer.-1
(c) Suggest a device and its placement that should be used to connect with the Internet
provided by BSNL Telephone Network.- MODEM 1
(d)Suggest the best wired medium to economically connect various wings of Kendriya
Vidyalaya Jawahar Nagar- CO AXIAL CABLE,TWISTED PAIR CABLE -1
(e) Which protocol will be used to transfer the Accounts, salary and admission files from
Admin campus to Regional Office .- FTP-1