Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a list of non negative integers, arrange them such that they form the largest number. For example: Given [3, 30, 34, 5, 9], the

Given a list of non negative integers, arrange them such that they form the largest number.

For example:

Given [3, 30, 34, 5, 9], the largest formed number is 9534330.

Note: The result may be very large, so you need to return a string instead of an integer.

Please note that python code for above question should pass large test cases, and all corner test cases, reasoning for below MCQs is also needed, please dont copy (unhelpful if copied or didn't answer all)

1. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()?

a) [3, 4, 5, 20, 5, 25, 1, 3]

b) [1, 3, 3, 4, 5, 5, 20, 25]

c) [25, 20, 5, 5, 4, 3, 3, 1]

d) [3, 1, 25, 5, 20, 5, 4, 3]

2. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.extend([34, 5])?

a) [3, 4, 5, 20, 5, 25, 1, 3, 34, 5]

b) [1, 3, 3, 4, 5, 5, 20, 25, 34, 5]

c) [25, 20, 5, 5, 4, 3, 3, 1, 34, 5]

d) [1, 3, 4, 5, 20, 5, 25, 3, 34, 5]

3. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)?

a) [3, 4, 5, 20, 5, 25, 1, 3]

b) [1, 3, 3, 4, 5, 5, 20, 25]

c) [3, 5, 20, 5, 25, 1, 3]

d) [1, 3, 4, 5, 20, 5, 25]

4. Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop()?

a) [3, 4, 5, 20, 5, 25, 1]

b) [1, 3, 3, 4, 5, 5, 20, 25]

c) [3, 5, 20, 5, 25, 1, 3]

d) [1, 3, 4, 5, 20, 5, 25]

5. What will be the output of the following Python code?

>>>"Welcome to Python".split()

a) ["Welcome", "to", "Python"]

b) ("Welcome", "to", "Python")

c) {"Welcome", "to", "Python"}

d) "Welcome", "to", "Python"

6. What will be the output of the following Python code?

>>>list("a#b#c#d".split('#'))

a) ['a', 'b', 'c', 'd']

b) ['a b c d']

c) ['a#b#c#d']

d) ['abcd']

7. What will be the output of the following Python code?

myList = [1, 5, 5, 5, 5, 1]

max = myList[0]

indexOfMax = 0

for i in range(1, len(myList)):

if myList[i] > max:

max = myList[i]

indexOfMax = i

>>>print(indexOfMax)

a) 1

b) 2

c) 3

d) 4

8. What will be the output of the following Python code?

myList = [1, 2, 3, 4, 5, 6]

for i in range(1, 6):

myList[i - 1] = myList[i]

for i in range(0, 6):

print(myList[i], end = " ")

a) 2 3 4 5 6 1

b) 6 1 2 3 4 5

c) 2 3 4 5 6 6

d) 1 1 2 3 4 5

9. What will be the output of the following Python code?

>>>list1 = [1, 3]

>>>list2 = list1

>>>list1[0] = 4

>>>print(list2)

a) [1, 3]

b) [4, 3]

c) [1, 4]

d) [1, 3, 4]

10. What will be the output of the following Python code?

def f(values):

values[0] = 44

v = [1, 2, 3]

f(v)

print(v)

a) [1, 44]

b) [1, 2, 3, 44]

c) [44, 2, 3]

d) [1, 2, 3]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Regulation of normal activities of the human heart take place?

Answered: 1 week ago