0% found this document useful (0 votes)
77 views14 pages

CH 1-10 70m SETA

Answers

Uploaded by

littlesnowigloo
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)
77 views14 pages

CH 1-10 70m SETA

Answers

Uploaded by

littlesnowigloo
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/ 14

BRINDHAVAN VIDHAYALAYA PUBLIC SCHOOL

Class XII Computer Science (083) – Answer key Marks: 70


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

Section A
1. The output of the code will be :
1. s=“Wonders of World”
print(s.count(‘O’) + s.index(‘o’))
(a) 3 (b) 4
(c) 2 (d) 1

2. What is the output of the following:


my_dict = {‘a’,1,’b’,2,’c’,3}
result = my_dict.get(‘b’,0)
print(result)
a) 1 b) 2 c) 3 d) 0

3. Which of the following are random number generators ?


(a) randint() (b) randrange()
(c) random() (d) All of these

4. Which of the following are sequence of character data?


(a) Lists (b) Tuples
(c) Strings (d) Dictionaries

5. A device that connects two dissimilar networks is


(a) modem (b) repeater
(c) bridge (d) gateway

6. In which file, no delimiters are used for line and no translations occur?
(a) Text file (b) Binary file
(c) CSV file (d) None of these

7. State True or False


“Multiple elements can be added at the end of list by the append method”. - False

8. These operators are used to make a decision on two conditions.


(a) Logical (b) Arithmetic
(c) Relational (d) Assignment
Install NODIA App to See the Solutions.
Click Here To Install
Page 2 Sample Paper 1 Computer Science Class 12

9. Abbreviations: SMTP, IMAP Simple mail transfer protocol,Internet mail access protocol

10. a = 1.0
b = 1.0
a is b # Line 1
Output of Line 1 will be
(a) False (b) True
(c) 1.0 (d) 0.0

11. Which of the following method is used to check if a key exists in a python dictionary?

a) check() b) find() c) in operator d) None of these

12. In complex number a + ib, a represents as


(a) real part (b) imaginary part
(c) special part (d) None of these

13. a = 6
b = 5.5
sum = a+b
print(sum)
print(type (sum))
(a) 11.5 (b) 10.5
<class ‘float’> <class ‘float’>
(c) None (d) None of these
<class ‘int’>

14...........Difference between pop and popitem method.

15...........L=[1,2,3,4,[‘a’,’v’,’e’,’f’],3,8] write a index to access the “v” element. L[3][1]

16...........method takes a string and writes it in the file.


(a) writelines() (b) write()
(c) writerow() (d) writer()

Directions : (Q.Nos.-17 and 18) are Assertion and Reason based Questions.

17. Assertion (A) Built-in functions are predefined in the system and can be directly used in any program.
Reason (R) id( ) and type( ) are built-in functions in Python.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
(d) A is false but R is true.

18. Assertion (A) The CSV files are like TEXT files and are comma separated value files.
Reason (R) The data stored in CSV files are separated by comma by default. Although the delimiter can be
changed.
(a) Both A and R are true and R is the correct explanation for A.
(b) Both A and R are true but R is not the correct explanation for A.
(c) A is true but R is false.
Page 3 Sample Paper 1 Computer Science Class 12
(d) A is false but R is true.
Page 4 Sample Paper 1 Computer Science Class 12

Section - B
19. Riya was asked to accept a list of even numbers ,but she did not put the relevant condition while accepting the
list of numbers. She wrote a user defined function odd to even (L) that accepts the list L as an argument and
converts all the odd numbers into even by multiplying them by 2.
def oddtoeven (L)
for i in range (len(L)): if
(L[i]%2!= 0)
L[i]= L[i] * 2
print (L)
There are some errors in the code . Rewrite the correct code.

20. How are E-mail and chat applications different?

21. Observe the code and write the output


(a) ‘arihant publication’.
count(‘hant’, 0, 10)
Ans: 1
(b) dic = {}
dic [(1, 2, 4)] = 8
dic [(4, 2, 1)] = 10
dic [1, 2)] = 24
sum = 0
for i in dic :
sum = sum + dic[i] print
(sum)
Ans: 42

22. Difference between LAN and WAN

23. (a) Write the full forms of


(i) URL – Uniform resource locator
(ii) VoIP – Voice over Internet protocol
(b) Write the use of SMTP.

24. Find the output of following code.


dic = {“Nitin” : (21, “NIIT”), “Ankit” : (15, “NIIT”)}
print(“The original dictionary : ”, str(dic)) result=
[(key, i, j) for key, (i, j) in dic.items()] print(“The
list after conversion : ”, str(result))
Ans:
The original dictionary : {'Nitin': (21, 'NII'), 'Anki': (15, 'NIIT')}
The list after conversion : [('Nitin', 21, 'NII'), ('Anki', 15, 'NIIT')]

or
Page 5 Sample Paper 1 Computer Science Class 12

What output will be generate when the following Python code is executed?
def ChangeList ():
l=[]
l1=[]
l2=[]
for i in range(1, 10):
l.append(i)
for i in range(10, 1, –2):
l1.append(i)
for i in range(len (l1)):
l2.append(l1[i] + l[i])
l2.append (len(l)– len(l1)) print(l2)
ChangeList()

25. Write a Python program to find the occurrence of “MY” or “my” in the text file.

Section-C

26. Write a function countEU() in Python, which should read each character of a text file. IMP.TXT should count and
display the occurrence of alphabets E and U (including small cases e and u too).
e.g. If the file content is as follows :
Pinaky has gone to his friend’s house.
His friend’s name is Ravya. Her house is 12 km from Pinaky’s house.
The countEU() function should display the output as E : 8
U:3

27. Write a Python program to find the longest word in file “status.txt”. If contents of status.txt are Welcome to your one- step
solutions for all your study, practice and assessment need for various competitive and recruitment examinations and school
segment. We have been working tirelessly for over a decade to make sure that you have best in class study resources
because you deserve SUCCESS AND NOTHING LESS...
Output should be
Longest word : examinations

28. Write the definition of a function Reverse (x) in Python, to display the elements in reverse order such that each
displayed element is the twice of the original element (element *2) of the List x in the following manner: Example :
If List x contains 7 integers is as follows:
x [0] x [1] x [2] x [3] x [4] x [5] x [6]
4 8 7 5 6 2 10

After executing the function, the array content should be displayed as follows:
Page 6 Sample Paper 1 Computer Science Class 12
20 4 12 10 14 16 8

Ans:
def reverse(x):
for i in (len(x)-1,-1,-1):
print(x[i]*2)
L=[4,8,7,5,6,2,10]
reverse(L)
29. Julie has created a dictionary containing names and marks as key value pairs of 6 students. Write a program, with
separate user defined functions to perform the following operations
(a) Push the keys (name of the student) of the dictionary into a stack, where the corresponding value (marks) is greater
than 75.
(b) Pop and display the content of the stack.
For example If the sample content of the dictionary is as follows R={“OM”:76,
“JAI”:45, “BOB”:89, “ALI”:65, “ANU”:90, “TOM”:82}
The output from the program should be: TOM ANU BOB OM

30. Alam has a list containing 10 integers. You need to help him create a program with separate user defined functions to
perform the given operations based on this list.
(a) Traverse the content of the list and push the even numbers into a stack.
(b) Pop and display the content of the stack.
For example, If the sample content of the list is as follows N =
[12, 13, 34, 56, 21, 79, 98, 22, 35, 38]
Sample Output of the code should be: 38 22 98
56 34 12

Section – D
31.Red Pandas Infosystems has its 4 blocks of buildings. The number of computers and distances between them is given below :
Page 7 Sample Paper 1 Computer Science Class 12

Building Number of Computers


HR 15
ADMIN 100
SYSTEM 25
PERS 30

Building Distance
HR -Admin 10 m
HR- System 50 m
HR- Pers 750 m
Admin- System 300 m
Admin- Pers 20 m
System-Pers 250 m

Answer the following questions with respect to the above :


(i) Suggest a suitable cable layout for the network.
(ii) Suggest the best place to house the server of the network. - Admin
(iii) Which topology should be used to connect computers in each building? - Star topology
(iv) What kind of network will be formed here? (LAN/MAN/WAN) LAN
(v) Write one advantage of the topology suggested by you. - Star topology

32. (a) Find the output of the following Python program:


def makenew (mystr):
newstr = “”
count = 0
for i in mystr:
if count%2!=0:
newstr = newstr + str (count)
else:
if islower (i):
newstr = newstr + upper (i) else:
newstr = newstr + i
count + = 1
newstr = newstr + mystr [:1]
print(“The new string is:”,
newstr)
makenew(“sTUdeNT”)

b) Define flush function.


(c) Difference between tell method and seek method

33. What is CSV file?


Write a program using two functions :
(a) addCustomer( ): To write Customer code, Customer name and Amt in file “cust.csv”.
Page 8 Sample Paper 1 Computer Science Class 12
The details of the customers are as follows :
[‘CustCode’, ‘CustName’, ‘Amount’]
[‘001’, ‘Nihir’, ‘8000’]
[‘104’, ‘Akshay’, ‘5000’]
(b) readCustomer( ): To read the details of the customers and display them.

Section – E

34. When do we use CSV file?


Write a program using following functions :
getlnventory() : Write code to accept as many inventory records and store them to the csv file Inventory.csv
storing records of inventory as per following structure PCode
Invname Price Reorder
Display() : To display the detail that store in Inventory.csv

35.Below is a program to delete the line having word (passed as argument). Answer the questions that follow to execute the
program successfully.
import ......
def filedel (word):
file1 = open (“Python. txt ”,
“......”)
nfile = open (“algo1.txt”, “w”) while
True:
line = file1.readline( ) if
not line:
break else
:
if word in line :
......
else :
print(line) nfile.
........................(line)
file1.close()
nfile.close() filedel
(‘write’)
(i) Name the module that should import in Line 1.
(ii) In which mode, above program should open the file to delete the line?
(iii) Fill the blank in Line 11 and Line 14.
Page 9 Sample Paper 1 Computer Science Class 12
Page 10 Sample Paper 1 Computer Science Class 12
Page 11 Sample Paper 1 Computer Science Class 12
Page 12 Sample Paper 1 Computer Science Class 12
Page 13 Sample Paper 1 Computer Science Class 12
Page 14 Sample Paper 1 Computer Science Class 12

You might also like