Call
whatsapp
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
9447387064 | 9847003556
0471-2335855 | 8089080088 | 0471-2334855
Cisco Training in Trivandrum, Trinity Technologies

No.1 Training Institute in Kerala

PYTHON QUESTIONS : PART 5

What is the output of the following?

X='abcd'

for i in x:

        print(i)

        x.upper()

a B C D

a b c d

A B C D

error

SHOW ANSWER

What is the output of the following?

d={0:'a',1:'b',2:'c'}

for i in d:

     print(i)

0 1 2

a b c

0 a 1 b 2 c

none of the mentioned

SHOW ANSWER

What is the output of the following?

for in range(int(2.0)):

          print(i)

0.0.1.0

0 1

error

none of the mentioned

SHOW ANSWER

What is the output of the following?

a=[0, 1,2, 3]

for a[0] in a:

        print(a[0])

0 1 2 3

0 1 2 2

3 3 3 3

error

SHOW ANSWER

Which of the following statement is true?

The break statement terminates the loop containing it.

The continue statement is used to skip the rest of the code inside the loop.

The break and continue statements are almost always used with if, if-else and if elif else statements

All of the above

SHOW ANSWER

What is the output of the following code?

for char in 'PYTHON STRING':

if char =' ':

    break

print(char, end =")

if char=0'

    continue

PYTHON

PYTHONSTRING

PYTHN

TRING

SHOW ANSWER

Which of the following statement is true about the pass statement?

The Python interpreter ignores the pass statement like comments.

The pass statement terminates the loop containing it.

It is used as a placeholder for future implementation of functions, loops etc

All of the above.

SHOW ANSWER

Which of the following commands will create a list?

list1=list()

list1=[]

list1=list([1,2,31])

all of the mentioned

SHOW ANSWER

What is the output when we execute list("hello")?

['h','e ','1','1','o']

['hello']

['llo']

['olleh']

SHOW ANSWER

Suppose list is [2445,133,12454,123], what is max (list1)?

2445

133

12454

123

SHOW ANSWER

Suppose list1 is [1,5,9], what is sum(list1)?

1

9

15

Error

SHOW ANSWER

What is the output when following code is executed?

>>>list1= [11, 2, 23]

>>>list2 = [11, 2, 2]

>>>list1 < list2 is

True

False

Error

Non

SHOW ANSWER

What will be the output?

numbers = [1, 2, 3,4]

numbers.append([5,6,7,8])

print(len(numbers))

4

5

8

12

SHOW ANSWER
BACK | NEXT
TRINITY SOFTWARE SOLUTIONS,IInd floor, Radheyam Towers, Gandhari Amman Kovil Road, Pulimood, Trivandrum - 1
0471-2334855 | 2335855 | 9447387064 | 9847003556 info@trinitytechnology.in