InfyTQ Collections Quiz 2

Question 1

Time: 00:00:00

list1 = ['Prep', 'Insta', 456, 789] 
print(list1[1][3])

Error

Error

456

456

Insta

Insta

t

t

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00

arr = [1, 2, 3, 4, 5] 
arr1 = arr 
arr1[0] = 0
print(arr)

[0, 2, 3, 4, 5]

[0, 2, 3, 4, 5]

[1, 2, 3, 4, 5]

[1, 2, 3, 4, 5]

0, 2, 3, 4, 5

0, 2, 3, 4, 5

1, 2, 3, 4, 5

1, 2, 3, 4, 5

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00

arr = list() 
arr.append([1, [2, 3], 4]) 
arr.extend([7, 8, 9]) 
print(arr[0][1][1] + arr[2])

7

7

5

5

11

11

10

10

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00

tuple=("Prep")*3
print(tuple)

PrepPrepPrep

PrepPrepPrep

Error

Error

Prep

Prep

Prep*3

Prep*3

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00

string = '{2}, {1} and {0}'.format('T', 'r', 'y') 
string1 = '{0}{1}{0}'.format('Prep', 'Insta') 
print(string, string1) 


Predict the output:

y, r and T PrepInstaPrep

y, r and T PrepInstaPrep

T, y and r PrepInstaPrep

T, y and r PrepInstaPrep

r, y and T PrepInsta

r, y and T PrepInsta

y, r and T PrepInsta

y, r and T PrepInsta

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00

arr = [1, 2, 3, None, (1, 2, 3, 4, 5), ['Prep', 'Insta']] 
print(len(arr)) 

5

5

11

11

6

6

10

10

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00

 di = {} 

di[1] = 1

di['1'] = 2

di[1]= di[1]+1

var = 0

for i in di: 

    var += di[i] 

print(var) 


Output of the above code will be:

5

5

6

6

4

4

1

1

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

Please login to submit your explanation

Start

Question 8

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

di = {i: i * i for i in range(5)} 

print(di)

1, 2, 3, 4, 5

1, 2, 3, 4, 5

0, 1, 2, 3, 4

0, 1, 2, 3, 4

{0: 0, 1: 1, 2: 4, 3: 9, 4: 16}

{0: 0, 1: 1, 2: 4, 3: 9, 4: 16}

{0, 1, 2, 3, 4}

{0, 1, 2, 3, 4}

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Select the False statement regarding Dictionary In python:

The values of a dictionary can be accessed using keys

The values of a dictionary can be accessed using keys

The keys of a dictionary can be accessed using values

The keys of a dictionary can be accessed using values

Dictionaries may or may not be ordered

Dictionaries may or may not be ordered

None of the above

None of the above

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

Please login to submit your explanation

Start

Question 10

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

print(['i_love', 'python_programming'][bool('prep')]) 

python_programming

python_programming

i_love

i_love

True

True

‘I_love’, ‘python_programming’, True

‘I_love’, ‘python_programming’, True

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

Please login to submit your explanation

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%

Comments