You are on page 1of 13

IAT 2

Internal Assessment 2

Hi nithya, when you submit this form, the owner will be able to see your name and email address.

Required

1.. What is the value of x x = 0 while (x < 100): x+=2 print(x)Required to answer.
Single choice.
(2 Points)
101

99

None of above

100

2. For loop in python isRequired to answer. Single choice.


(2 Points)
Exit control loop

Entry control loop

Simple loop

None of above

3.Which one of the following is a valid Python if statement :Required to answer.


Single choice.
(2 Points)
if (a >= 2)

if a => 2;

if a >= 22

if a>=2 :

4.while loop in Python is used for what type of iterationRequired to answer.


Single choice.
(2 Points)
indefinite
discriminant

definite

indeterminate

5.Which of the following is a valid for loop in Python?Required to answer. Single


choice.
(2 Points)
for(i=0; i < n; i++)

for i in range(0,5):

for i in range(0,5)

for i in range(5)

6.A function must always return a value to where it is called fromRequired to


answer. Single choice.
(2 Points)
Nested function

Function composition

Fruitful function

Void function

7.What will be the output of the following Python code? >>>example = "snow
world" >>>example[3] = 's' >>>print exampleRequired to answer. Single choice.
(2 Points)
snow

snow world

snos world

Error

8. In which of the following loop in python, we can check the condition ?Required
to answer. Single choice.
(2 Points)
for loop
While loop

Do while loop

None of above

9.I went to interview at a village. There were 100 houses in a row. When I
interviewed the first 15 houses, I was too exhausted then I stopped. What
statement is used in the exampleRequired to answer. Single choice.
(2 Points)
Continue

Break

Pass

None of above

10.Which of the following will evaluate to true? I. True AND False II. False or True
III. False AND (True or False)Required to answer. Single choice.
(2 Points)
I

II

I and II

II and III

11.What will be the output of below Python code? tuple1=(5,1,7,6,2)


tuple1.pop(2) print(tuple1)Required to answer. Single choice.
(2 Points)
Error

(5,1,6,2)

(5,1,7,6)

(5,1,7,6,2)

12.If two functions f and g is denoted f(g(x))Required to answer. Single choice.


(2 Points)
Function
Nested function

Function with pa

function composition

13.What will following Python code return? str1="Stack of books"


print(len(str1))Required to answer. Single choice.
(2 Points)
13

14

15

16

14.What will be printed by the following code when it executes? sum = 0 values =
[1,3,5,7] for number in values: sum = sum + number print(sum)Required to
answer. Single choice.
(2 Points)
4

16

15.How to convert the uppercase letters in the string to lowercase in Python?


Required to answer. Single choice.
(2 Points)
lowercase()

capilaize()

lower()

toLower()

16.Suppose t = (1, 2, 4, 3), which of the following is incorrect?Required to answer.


Single choice.
(2 Points)
print(t[3])

t[3] = 45

print(max(t))

print(len(t))

17.There were three computer in the shop, when Chhay went in the store. He pick
the first computer and he skip to take the third computer. What statement that
used in this exampleRequired to answer. Single choice.
(2 Points)
Break

Pass

Continue

None of above

18.Suppose list1 is [1, 5, 9], what is sum(list1)Required to answer. Single choice.


(2 Points)
1

15

None

19.: What does the following code print? if 4 + 5 == 10: print("TRUE") else:
print("FALSE") print("TRUE"). Single choice.
(2 Points)
True

True False

False True

True False True

20.How to access substring “Kevin” from the following string declaration in


Python: str = "My name is Kevin"Required to answer. Single choice.
(2 Points)
str(11:16)

str[11:16]

str[11][16]

str[11-17]

21.names1 = ['Amir', 'Bala', 'Chales'] if 'amir' in names1: print(1) else:


print(2)Required to answer. Single choice.
(2 Points)
1

Error

None

22.Which of the following is the correcy way to access a specific element from a
Multi-Dimensional List?Required to answer. Single choice.
(2 Points)
list[row_size:column_size

list[rowsize][colsize]

list[(row_size)(column_size)

None of the above

23.What will be the output of the following Python code? >>>my_tuple = (1, 2, 3,
4) >>>my_tuple.append( (5, 6, 7) ) >>>print len(my_tuple)Required to answer.
Single choice.
(2 Points)
1

Error

24.What will be the output of given Python code? str1="hello" c=0 for x in str1:
if(x!="l"): c=c+1 else: pass print(c)Required to answer. Single choice.
(2 Points)
2

25.x = 'abcd' for i in x: print(i) x.upper()Required to answer. Single choice.


(2 Points)
Print a b c d one by one

Print A B C D one by one

print A B C d one by one

Print a B C D one by one

26.numbers = [1, 2, 3, 4] numbers.append([5,6,7,8]) print(len(numbers))Required


to answer. Single choice.
(2 Points)
None of above

27.. What will be the output of below Python code? str1="Aplication"


str2=str1.replace('a','A') print(str2)Required to answer. Single choice.
(2 Points)
application

Application

ApplicAtion

applicAtion

28.What will be the output of below Python code? str1="Information"


print(str1[2:8])Required to answer. Single choice.
(2 Points)
format

formatio

orma

ormat

29.L = ['a', ['bb', 'cc'], 'd'] print(len(L))Required to answer. Single choice.


(2 Points)
3

None of the above

30.What will be the output of the following Python code? def f1(): global x x+=1
print(x) x=12 print("x")Required to answer. Single choice.
(2 Points)
Error

13

13 x

31.Which of the following loop is not supported by the python programming


language ?Required to answer. Single choice.
(2 Points)
For loop

While loop

Do while loop

Nested for loop

32.Which among the following are mutable objects in Python? (i) List (ii) Integer
(iii) String (iv) TupleRequired to answer. Single choice.
(2 Points)
i
i and ii

iii and iv

iv

33.. What is the output of the following addition (+) operator a = [10, 20] b = a b
+= [30, 40] print(a) print(b)Required to answer. Single choice.
(2 Points)
[10, 20, 30, 40] [10,20,30,40]

[10,20] [10,20,30,40]

Option 2

34.. What will be the output of above Python code? str1="6/4"


print("str1")Required to answer. Single choice.
(2 Points)
6/4

str1

1.5

35.Suppose you run the following code: n = [[9, 8, 7], [6, 5, 4], [3, 2, 1]] print n[2]
What gets printed?Required to answer. Single choice.
(2 Points)
[6,5,7]

[3,2,1]

36.Q-4: What does the following code print? x = -10 if x < 0: print("The negative
nos", x, " is not valid here.") print("This is always printed"). Single choice.
(2 Points)
This is always printed

The negative nos -10 is not valid here This is always printed
The negative number -10 is not valid here

It will cause an error because every if must have an else clause.

37.What is the output of the following range() function for num in range(2,-5,-1):
print(num, end=", ")Required to answer. Single choice.
(2 Points)
2, 1, 0

2, 1, 0, -1, -2, -3, -4, -5

2, 1, 0, -1, -2, -3, -4,

38.Question: Which of the following is Exit control loop in python ?Required to


answer. Single choice.
(2 Points)
1.for loop

2.while loop

3.do while loop

4.None of the above

39.What will be the result after the execution of above Python code?
list1=[3,2,5,7,3,6] list1.pop(3) print(list1)Required to answer. Single choice.
(2 Points)
[2,5,7,6]

[3,2,5,3,5,6]

[3,2,5,3,6]

[3,2,7,3,6]

40.What will be the output of below Python code? tupl=() tupl1=tupl*2


print(len(tupl1))Required to answer. Single choice.
(2 Points)
Errot

2
0

41.Given a string s = “Welcome”, which of the following code is incorrect?


Required to answer. Single choice.
(2 Points)
print s[0]

print s.lower()

s[1] = ‘r’

print s.strip()

42.On assigning a value to a variable inside a function, it automatically becomes a


global variable. State whether true or false.Required to answer. Single choice.
(2 Points)
True

False

Error

None of above

43.What will be the output of the following Python code? >>>t1 = (1, 2, 4, 3)
>>>t2 = (1, 2, 3, 4) >>>t1 < t2Required to answer. Single choice.
(2 Points)
True

False

Error

None

44.What will be the output of the following Python code? def function1(var1=5,
var2=7): var2=9 var1=3 print (var1, " ", var2) function1(10,12)Required to answer.
Single choice.
(2 Points)
57

39
10 12

Error

45.What will be the output of the following Python code? >>>max("what are
you") a) error b) u c) t d) yRequired to answer. Single choice.
(2 Points)
Error

46.Which of the following is not a boolean expression. Single choice.


(2 Points)
True

3+4==7

3+4

3==7

47.Given two variables, num1 and num2, which of the following would mean that
both num1 and num2 are positive integers?Required to answer. Single choice.
(2 Points)
num1 = num2)

num1 = num2) OR (num1 ≠ num2)

(num1 = num2) AND (num1<0)

(num1 = num2) AND (num2>0)

48.What will be the output of below Python code? tupl=([2,3],"abc",0,9) tupl[0]


[1]=1 print(tupl)Required to answer. Single choice.
(2 Points)
([2,3],"abc",0,9)

([1,3],"abc",0,9)

([2,1],"abc",0,9)
Error

49.What does break statement do?Required to answer. Single choice.


(2 Points)
Stop

Skip

Repeat

Print

50.What we put at the last of the loop ?Required to answer. Single choice.
(2 Points)
1.semicolon

2.colon

3.comma

4.None of the above

Submit
This content is created by the owner of the form. The data you submit will be sent to the form owner. Microsoft is not
responsible for the privacy or security practices of its customers, including those of this form owner. Never give out
your password.

Powered by Microsoft Forms

 | 

Privacy and cookies

 | Terms of use

You might also like