0% found this document useful (0 votes)
39 views4 pages

Computer Science Hometest 5

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)
39 views4 pages

Computer Science Hometest 5

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

BRIMMING HIGH INTERNATIONAL SCHOOL, KANCHIPURAM

HOME TEST-5
COMPUTER SCIENCE-XII A/B & C
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 10 questions carrying 01 mark each.
4. Section B has 05 Very Short Answer type questions carrying 02 marks each.
5. Section C has 02 Short Answer type questions carrying 03 marks each.
6. Section D has 01 Long Answer type questions carrying 04 marks each.

TOTAL MARKS- 30

SECTION –A 10X1=10
1.State True or False:

“In a Python loops can also have else clause”


2. What is the output of the following code?

(A)hAPPY#HOUR1122#33 (B)Happy#hOUR12#3
(C)hAPPY#HOUR112233 (D)Happy Hour11 22 33 #
3. Consider the given expression:
17%5==2 and 4%2>0 or 15//2==7.5
Which of the following will be correct output if the given expression is evaluated?
(a)True (b) False (c)None (d)Null
4. Select the correct output of the code:
s = "Question paper 2022-23"
s= s.split('2')
print(s)
a. ['Question paper ', '0', '', '-', '3'] b. ('Question paper ', '0', '', '-', '3')
c. ['Question paper ', '0', '2', '', '-', '3'] d. ('Question paper ', '0', '2', '', '-', '3')

5. What will be the output of following code if


a = “abcde”
a [1:1 ] == a [1:2]
type (a[1:1]) == type (a[1:2])

6. Select the correct output of the code:


a = "foobar"
a = a.partition("o")
print(a)
(a) ["fo","","bar"] (b) ["f","oo","bar"] (c) ["f","o","bar"] (d) ("f","o","obar")
7. Identify the output of the following python code:
D={1:"one",2:"two", 3:"three"}
L=[]
for k,v in D.items():
if 'o' in v:
L.append(k)
print(L)
(a) [1,2] (b) [1,3] (c)[2,3] (d)[3,1]
8. Which of the following is not a tuple in python?

(a) (10,20) (b) (10,) (c) (10) (d) All are tuples.

9. What will be the output of the following Python code snippet?

d1 = {"john":40, "peter":45}

d2 = {"john":466, "peter":45}

d1 > d2

a. True b. False c. Error d. None


10. Consider the code given below:

b=5

def myfun(a):

# missing statement.

b=b*a

myfun(14)
print(b)

Which of the following statements should be given in the blank for # Missing statement, if the output
produced is 70?

a. global a b. global b=70 c. global b d. global a=70

SECTION B 5x2=10

11. Write difference between mutable and immutable property, Explain it with its example.

12. Write the Python statement for each of the following tasks using BUILT_IN functions/ methods only:

i) str="PYTHON@LANGUAGE"

(A) To print the above string from index 2 onwards.

(B) To initialize an empty dictionary named as d.)

13. What possible outputs are expected to be displayed on the screen at the time of execution of the
program from the following code?
import random
temp=[10,20,30,40,50,60]
c=random.randint(0,4)
for i in range(0, c):
print(temp[i],”#”)
a) 10#20# b) 10#20#30#40#50# c) 10#20#30# d) 50#60#

14. Write the Python statement for each of the following tasks using BUILT_IN functions/ methods only:

(A) s=”LANGUAGE"-To convert the above string into list.

(B) To initialize an empty tuple named as t.


15. Find possible o/p (s) at the time of execution of the program from the following code? Also specify the
maximum values of variables Lower and Upper.

import random as r

AR=[20, 30, 40, 50, 60, 70];

Lower =r.randint(1,3)

Upper =r.randint(2,4)

for K in range(Lower, Upper +1):

print (AR[K],end=”#“)

(i) 10#40#70# (ii) 30#40#50# (iii) 50#60#70# (iv) 40#50#70#


SECTION –C 2X3=6

16. Predict the output of the Python code given below:

def func(n1 = 1, n2= 2):

n1= n1 * n2

n2= n2 + 2

print(n1, n2)

func( )

func(2,3)

17. Predict the output of the Python code given below:


T= [“20”, “50”, “30”, “40”]
Counter=3
Total= 0
for I in [7,5,4,6]:
newT=T[Counter]
Total= float (newT) + I
print(Total)
Counter=Counter-1

SECTION –D 1X4=4

18.i) Identify the output of the following code snippet:


text = "The_quick_brown_fox"
index = text.find("quick")
result = text[:index].replace("_", "") + text[index:].upper()
print(result)
(A) Thequick_brown_fox (B) TheQUICK_BROWN_FOX
(C) TheQUICKBROWNFOX (D) TheQUICKBROWN_FOX

ii) What id the output of following code snippet?


country = "GlobalNetwork"
result = "-".join(country.split("o")).upper()
print(result)

(A) GL-BALNETW-RK (B) GL-BA-LNET-W-RK


(C) GL-BA-LNET-W-RK (D) GL-BA-LNETWORK

You might also like