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

Cs 12th Term 1 2023-24

Computer science

Uploaded by

Meghrai Tudu
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 views8 pages

Cs 12th Term 1 2023-24

Computer science

Uploaded by

Meghrai Tudu
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/ 8

NAVODAYA VIDYALAYA SAMITI, REGIONAL OFFICE BHOPAL

MID TERM/TERM-1 EXAMINATION 2023-24

Computer Science(083)

Time Allowed: 03:00 Hrs. Class : XII 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 3 questions (31 to 33). Each question carries 5 Marks.
 Section E, consists of 2 questions (34 to 35). Each question carries 4 Marks.
 All programming questions are to be answered using Python Language only.
Q. Section- A Marks
No.

1 What will be the output of the following statement: print(3-2**2**3+99/11) 1


(a) 244
(b) 244.0
(c) -244.0
(d) Error

2 Predict the output: 1


def sum(x, y):
return x + y
total=sum(10, sum(5, 10))
print(total)
(a) 25
(b) 10
(c) 5
(d) 15

3 Find the invalid identifier from the following 1

(a) none
(b) address
(c) Name
(d) Pass

4 Given the following dictionaries – 1

Which statement will merge the contents of both dictionaries?


(a) dict_exam.update(dict_result)
(b) dict_exam + dict_result
(c) dict_exam.add(dict_result)
(d) dict_exam.merge(dict_result)

5 _______ is an empty statement in Python 1


(a) Jump
(b) break
(c) Empty
(d) pass

6 Consider a tuple tup1 = (10, 15, 25, and 30). Identify the statement that will 1
result in an error
(a) print(tup1[2])
(b) tup1[2] = 20
(c) print(min(tup1))
(d) print(len(tup1))

7 Whether the following statement is True or False: An exception may be raised 1


even if the program is syntactically correct

8 Which of the following option is not correct? 1


(a) if we try to read a text file that does not exist, an error occurs.
(b) if we try to read a text file that does not exist, the file gets created.
(c) if we try to write (mode) on a text file that does not exist, no error
occurs.
(d) if we try to write (mode) on a text file that does not exist, the file gets
Created.

9 Which of the following function header is correct? 1


(a) defcal_si(p=100, r, t=2)
(b) defcal_si(p=100, r=8, t)
(c) defcal_si(p, r=8, t)
(d) defcal_si(p, r=8, t=2)

10 Which of the following mode in file opening statement results or generates an 1


error if the file does not exist?
(a) a+
(b) r+
(c) w+
(d) None of the above

11 The correct syntax of seek() is : 1


(a) file_object.seek(offset [, reference_point])
(b) seek(offset [, reference_point])
(c) seek(offset, file_object)
(d) seek.file_object(offset)
12 Fill in the blank: In case of _____________ switching, before a communication 1
starts, a dedicated path is identified between the sender and the receiver.

13 Which of the following statement is incorrect in the context of binary files? 1


(a) Information is stored in the same format in which the information is
held in memory.
(b) No character translation takes place
(c) Every line ends with a new line character
(d) pickle module is used for reading and writing

14 A _________is a list where insertion and deletion can take place only at one end 1
called______
(a) Stack, Rear
(b) Stack, Front
(c) Queue, Top
(d) Stack, Top

15 While popping the element from the stack, a condition will be raised if list has no 1
elements, this condition is known as ____________.
(a) Underflow
(b) Overflow
(c) List is Empty
(d) Blank List

16 _____________ is a disturbance caused by the electric or magnetic fields of one 1


telecommunication signal affecting a signal in an adjacent circuit.

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 [6]
(c) A is True but R is False
(d)A is false but R is True

17 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.

18 Assertion(A): Python Standard Library consists of various modules. 1


Reasoning(R): A function in a module is used to simplify the code and avoids
repetition.
Section B

19 Observe the following code carefully and rewrite it after removing all syntax 2
and logical errors. Underline all the corrections made.
Value=30
for VAL in range(0,Value)
If val%4==0:
print (VAL*4)
Elseif val%5==0:
print (VAL+3)
else
print(VAL+10)

20 Evaluate the following expressions: a) 6 * 3 + 4**2 // 5 – 8 b) 10 > 5 and 7 > 2


12 or not 18 > 3

21 Differentiate between actual parameter(s) and a formal parameter(s) with a 2


suitable example for each.
OR
Explain the use of global key word used in a function with the help of a suitable
example.

22 Write a function, lenWords(STRING), that takes a string as an argument and 2


returns a tuple containing length of each word of a string.
For example, if the string is "Come let us have some fun", the
tuple will have (4, 3, 2, 4, 4, 3)

23 Output prediction: 2
Name="PythoN3.1"
R=""
for x in range(len(Name)):
if Name[x].isupper():
R=R+Name[x].lower()
elif Name[x].islower():
R=R+Name[x].upper()
elif Name[x].isdigit():
R=R+Name[x-1]
else:
R=R+"#"
print(R)

24 (i) Expand the following terms: 2


POP3 , URL
(ii) Give one difference between XML and HTML.
25 What is the major difference between Website and Webpages? 2

Section-C

26 Write a method COUNTLINES() in Python to read lines from text file 3


‘TESTFILE.TXT’ and display the lines which are not starting with any
vowel.

Example:
If the file content is as follows:

An apple a day keeps the doctor away.


We all pray for everyone’s safety.
A marked difference will come in our country.
The COUNTLINES() function should display the output as:1
The number of lines not starting with any vowel - 1

OR
Write a function in Python that counts the number of “Me” or “My” words
present in a text file “STORY.TXT”. If the “STORY.TXT” contents are as
follows:
My first book was Me and 3 Page 8 of 11 My Family. It gave me chance
to be Known to the world.
The output of the function should be: Count of Me/My in file: 4

27 Write a function countNow(PLACES) in Python, that takes the dictionary, 3


PLACES as an argument and displays the names (in uppercase)of the places
whose names are longer than 5 characters. Consider the following dictionary -
PLACES={1:"Delhi",2:"London",3:"Paris",4:"New York",5:"Doha"}
The output should be:
LONDON
NEW YORK

28 What possible output(s) are expected to be displayed on screen at the time of 3


execution of the program from the following code? Also specify the maximum
values that can be assigned to each of the variables HIGH and LOW?
import random
A=[22,33,44,55,66,77]
LOW=random.randint(1,3)
HIGH=random.randint(2,4)
for p in range(LOW,HIGH + 1):
print(A[p],end='*')
(i)11*22*33* (ii)33*44*55* (iii) 55*66*77* (iv) 33*44*55*66*
29 Find and write the output of the following Python code : 3
def games(Str1):
Str2=""
I=0
while I<len(Str1):
if Str1[I]>="A" and Str1[I]<="Z":
Str2=Str2+Str1[I+1]
elif Str1[I]>="a" and Str1[I]<="z":
Str2=Str2+ (Str1[I-1])
else:
Str2=Str2+"@"
I=I+1
print(Str2)
games("Hockey#In-door")

30 i) Rearrange the following terms in increasing order of speedy medium of data 1+2
transfer. Telephone line, Fiber Optics, Coaxial Cable, Twisted Paired Cable.
ii) Write two advantages of Fiber optics over Twisted pair cable

Section D

31 1- A binary file “STOCK.DAT” has structure [ITEMID, ITEMNAME, 2.5+2.5


QUANTITY, PRICE].
(i) Write a user defined function Create( ) to input data for a record and
add to
Book.dat.
(ii) Write a function GetPrice(ITEMID) in Python which accepts the
ITEMID as parameter and return PRICE of the Item stored in Binary file
STOCK.DAT.
OR

A binary file “EMPLOYEE.DAT” has structure (EMPID, EMPNAME,


SALARY). Write a function CountRecord( ) in Python that would read
contents of the file “EMPLOYEE.DAT” and display the details of those
Employees whose Salary is less than 15000. Also display number of
employees having Salary less than 15000.

32 Somnath of class 12 is writing a program to create a CSV file “emp.csv” which 5


will contain employee code and name of some employees. He has written the
following code. As a programmer, help him to successfully execute the given
task.

import #Line 1 as module


defaddemp(empcode,name):#to write/add data into the CSV file
fobj=open('emp.csv',_______)#Line 2
writer=module. (fobj)
writer.________([empcode,name]) #Line 3
fobj.close()
#csv file reading code
defreademp():
with open('emp.csv',' ') as fobj:
filereader=module.reader(fobj)
for row in filereader:
for data in row:
print(data,end='\t')
print(end='\n')
fobj.____________ #Line 4
addemp('e210','Hari')
addemp("e111",'Suman')
addemp("e424",'Vikash')
reademp() #Line 5
i) Name the module he should import in Line 1.
ii) In which mode Somnathshould open the file to add data into the file
iii) Fill in the blank in Line 3 to write the data in a csv file.
iv) Fill in the blank in Line 4 to close the file.
v) Write the output he will obtain while executing Line 5

33 Modern Public School of Ahmedabad is Setting up the network 5


between its different Wings of school campus. There are 4 wings
named as SENIOR(S), JUNIOR(J), ADMIN(A) and HOSTEL(H).

Distance between various wings are given below:


Wing A to Wing S 100m
Wing A to Wing J 200m
Wing A to Wing H 400m
Wing S to Wing J 300m
Wing S to Wing H 100m
Wing J to Wing H 450m

Number of Computers installed at various wings are as follows:


Wings Number of Computers
Wing A 20
Wing S 180
Wing J 60
Wing H 35

i) Suggest the best wired medium and draw the cable layout to efficiently
connect various wings of Modern Public School, Ahmedabad.
ii) Name the most suitable wing where the Server should be installed. Justify
your answer.
iii) Suggest a device/software and its placement that would provide data
security for the entire network of the School.
iv) Suggest a device and the protocol that shall be needed to provide wireless
Internet access to all smart phone/laptop users in the campus of Modern Public
School,
v) Name the device which is required for connecting computers in the blocks.

Section-E

34 Consider stack implementation: 1.5+1.5


i) Write a function in Python PUSH(Arr), where
Arr is a list of numbers. From this list push all
numbers divisible by 5 into a stack
implemented by using a list.
ii) Write a function display(ST), to display the
stack if it has elements, otherwise display
appropriate error message.
OR
i) Write a function display(Arr), to display the
stack if it has elements, otherwise display
appropriate error message.
ii) Write a function in Python POP(Arr), where
Arr is a stack implemented by a list of
numbers. The function returns the value
deleted from the stack.

35 Write the Python statement for each of the following tasks using BUILT-IN list/ 4
string functions/methods only:
(i) To insert an element 200 at the third position, in the list L1.
(ii) To check whether a string named, message ends with a full stop /
period or not
(iii) Returns copy of string with its first character capitalized.
(iv) Removes first occurrence of the item from a given list

You might also like