ST Class Xi Periodic Test-3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ST.

XAVER’S HIGH SCHOOL, KHANDAGIRI

PERIODIC TEST-3

SUB:- COMPUTER SCIENCE

CLASS-XI

TIME-2 HRS F.M-35

Q 1)The equivalent for loop for the following while loop is ____________. [1]

i=1

while(i<=20):

i+=2

Q 2)Predict the output of the following code: [1]

for x in range(10):

print(x)

Q 3) Find the output of the following : [1]

for tr in range (-600,0,200):

print (tr, end=” ”)

Q 4)Write a program to display the first 5 multiples of 9. [3]

Q 5) What will be the output of the following program code ? [5]

str= ”MyPython Programming”

Ctr= len(str)

(a) print (str [0:5])


(b) print (str [1:5])
(c) print (str [ :-4])
(d) print (str[0:16])
(e) print (str[ : 20-4])
Q 6) What will be the output of the following program segment? [3]

str = “ aNDarIeL”;

nstr = “ “

for i in range (len(str)):

if str[i] . isupper( ):

nstr = nstr+str[i].lower( )

else:

nstr = nstr+str [i]. upper ( )

print (nstr)

Q 7) Input a string “ Green Revolution”. Write a program to print the string in reverse. [3]

Q 8) Suppose str= “\t\t BookWorld\n”, [1]

What is str.strip( ) ?.

Q 9)What is the output of the following ? [1]

Print (‘Hello World’. istitle( ))

Q 10) Suppose list = [12,3,22,”Rachna”,”Sagar”] [1]

What is list[ :-2] ?.

Q 11) list = [12,3,22,”mango”,”hello”]. [1]

What will be the output of print (list[-1][-1]) ?.

Q 12) What does each of the following expression evaluate to ?. [9]

Suppose that L is the list

[“These”, ”are”, ”a”, [“few”, ”words”], ”that”, ”we”, ”will”, ”use”].

(a) L [3:4]
L [3:4] [0]
L [3:4] [0] [1]
L[3:4] [0] [1] [2]
(b) “few” in L
(c) “few” in L[3]
(d) [ L [1]] + L [3]
(e) L [4: ]
(f) L[0 : :2]
Q 13) What will be the output of the following statement ? [4]

(i) list1 =[12,32,65,26,80,10]


list1.sort( )
print (list1)
(ii) list1 =[12,32,65,26,80,10]
sorted (list1)
print (list1)
(iii) list1= (1,2,3,4,5,6,7,8,9,10)
list1[ : : -2]
list1 [ :3] + list1 [3 : ]

(iv) list1= [1,2,3,4,5]


list1 [len (list1) -1]

Q 14) Consider the following list Mylist. What will be the elements of Mylist after the operation.

Mylist =[10,20,30,40] [1]

Mylist . append ([50,60])

You might also like