Contents

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]

a

Explanation: Execute in the shell to verify.


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]

c

Explanation: pop() removes the element at the position specified in the parameter.


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]

a

Explanation: pop() by default will remove the last element.


What will be the output of the following Python code?
a) 1                                                        
b) 3
c) 5                                                        
d) 6

a

Explanation: Execute in the shell to verify.


What will be the output of the following Python code?
a) 1 2 3 4                                              
b) 4 5 6 7
c) 1 3 8 12                            
d) 2 5 9 13

d

Explanation: Execute in the shell to verify.


What will be the output of the following Python code?
a) 1                                                        
b) 2
c) 4                                                        
d) 5

d

Explanation: Execute in the shell to verify.