InfyTQ Libraries and Functions (Python) Quiz 4

Question 1

Time: 00:00:00
The output of the following code will be:

Sum={}

def insert(val):

if val in Sum:

Sum[val] += 1

else:

Sum[val] = 1

insert('Banana')

insert('Bat')

insert('Banana')

print (len(Sum))

3

3

1

1

2

2

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 2

Time: 00:00:00
Predict the output:

num = 50

def prepinsta():

global num

num = 2

prepinsta()

print('Value of num is', num)

2

2

50

50

Error

Error

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 3

Time: 00:00:00
Predict the Output:

print(float('-infinity'))

Infinite loop

Infinite loop

-infinity

-infinity

-inf

-inf

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 4

Time: 00:00:00
What will be the output of the following code:(available)

print(any([2>8, 4>2, 1>2]))

2 2 1

2 2 1

True

True

False

False

8 4 2

8 4 2

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 5

Time: 00:00:00
print(all(3,0,4.2))

Predict the output?

3 0 4.2

3 0 4.2

7.2

7.2

Error

Error

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 6

Time: 00:00:00
The output of the following code will be:

print(min(max(False,-5,-1), 1,6))

-1

-1

-5

-5

1

1

False

False

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 7

Time: 00:00:00
Both ‘a’ and ‘b’ are integers in the function divmod(a,b), is evaluated as:(reframe)

(a%b, a//b)

(a%b, a//b)

(a//b, a*b)

(a//b, a*b)

(a//b, a%b)

(a//b, a%b)

(a/b, a%b)

(a/b, a%b)

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 8

Time: 00:00:00
print(list(enumerate([3, 2])))

What will be the output?

Error

Error

[(0, 3), (1, 2)]

[(0, 3), (1, 2)]

[(0, 2), (1, 3)]

[(0, 2), (1, 3)]

[(2, 3)]

[(2, 3)]

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 9

Time: 00:00:00
Only Integer as an argument is accepted by which of the following functions?

ord()

ord()

min()

min()

chr()

chr()

any()

any()

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 10

Time: 00:00:00
What will be the output of the following code

print(len(["hello",2, 4, 6]))

8

8

4

4

13

13

6

6

Once you attempt the question then PrepInsta explanation will be displayed.

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/0

Accuracy

0%