11. |
What will be the output of the following Python code?
print('abcdefcdghcd'.split('cd', -1))
|
||||||||
Answer:
Option (b) |
12. |
Which of the following commands will create a list?
|
||||||||
Answer:
Option (d) |
13. |
What is the output when we execute list(“hello”)?
|
||||||||
Answer:
Option (a) |
14. |
To shuffle the list(say list1) what function do we use?
|
||||||||
Answer:
Option (c) |
15. |
Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?
|
||||||||
Answer:
Option (d) |
16. |
What will be the output of the following Python code?
a=[10,23,56,[78]] b=list(a) a[3][0]=95 a[1]=34 print(b)
|
||||||||
Answer:
Option (c) |
17. |
What will be the output of the following Python code?
print(list(zip((1,2,3),('a'),('xxx','yyy')))) print(list(zip((2,4),('b','c'),('yy','xx'))))
|
||||||||
Answer:
Option (d) |
18. |
To which of the following the “in” operator can be used to check if an item is in it?
|
||||||||
Answer:
Option (d) |
19. |
To remove string “hello” from list1, we use which command?
|
||||||||
Answer:
Option (a) |
20. |
Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)?
|
||||||||
Answer:
Option (d) |