Explanation: sum returns the sum of all elements in the list.
Problem Solving and Python Programming MCQs | Page - 23
Dear candidates you will find MCQ questions of Problem Solving and Python Programming here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Explanation: execute in the shell to verify.
Explanation: slicing is allowed in lists just as in the case of strings.
Explanation: -1 corresponds to the last index in the list.
Explanation: execute in the shell to verify.
Explanation: execute in the shell to verify.
Explanation: when assigning names1 to names2, we create a second reference to the same list. changes to names2 affect names1. when assigning the slice of all elements in names1 to names3, we are creating a full copy of names1 which can be modified independently.
Explanation: execute in the shell to verify.
Explanation: elements are compared one by one.
Explanation: we use the function append to add an element to the list.
Jump to