Quizzes on Data Structure

  1. Output of: max(''please help ‘’)
    a. please, help
    b. Error
    c.p

  2. What command is used to shuffle a list ‘L’?

a. L.shuffle(), b. random.shufflelist(L) c. shuffle(L) d.random.shuffle(L)

3.What is the output of the following program?
language = [‘P’, ‘y’, ‘t’, ‘h’, ‘o’, ‘n’]
print(language[:-4])
a. [‘t’] b. [‘P’,‘y’] c. [‘P’,‘y’,‘t’] c.[‘t’,‘h’,‘o’,‘n’]

4.Suppose a tuple test contains 5 elements. How can you set the 3rd element of the tuple to ‘Python’?
a. test[2] = ‘Python’
b. test[3] = ‘Python’
c. test(2) = ‘Python’
d. Elements of tuple cannot be changed

  1. How can you change num = {‘one’: 1, ‘two’: 3} to num = {‘one’: 1, ‘two’: 2}
    a. num[2] = ‘two’
    b. num[1] = ‘two’
    c. num[‘two’] = 2
    d. num[‘two’] = ‘2’
  1. b
  2. d
  3. b
  4. d
  5. c
1 Like
  1. a
  2. d
  3. b
  4. d
  5. c
1 Like

1 error
2 shuffle(L)
3 [‘P’,‘y’]
4 Elements of tuple cannot be changed
5 num[‘two’] = 2

1 Like

sorry i missed the option for the first question d.s. “s” is the output of first question
. Remaining all the ans are correct.

sorry I missed the option for the first question d) s. “s” is the output of the first question.

sorry I missed the option for the first question d) s. “s” is the output of the first question.

  1. p
    2.random.shuffle(L)
    3.[‘P’,‘y’]
  2. elements of tuple cannot be changed
    5.num[‘two’]=2
1 Like

Quizzes on Data Structure

1.b
2.d
3.b
4.d
5.c

1 Like

@aravindmurali1997. appreciating your effort. keep practicing

1 Like

@swarnadhanesh verygood keep practicing.

1 Like