Quiz on Lists in Python
Q.1. List can contain data of only one data type
Q.2. What is the output of following program?
list1 = ['pear', 'mango', 'apple', 'pomegranate']
print(max(list1))
Q.3. What is the output of following program?
L = [70, 20, 90, 10, 50]
L.sort()
print(L)
Q.4. Which statement of the following is false?
Q.5. What is the output of following program?
l = [1,2,3,4,5,6,7,8,9]
print(5 in l)
Q.6. Which of the following is the correct syntax to get "[5,4,3,2,1]" as output for list:
l = [1,2,3,4,5,6,7,8,9]
l = [1,2,3,4,5,6,7,8,9]
Q.7. Initializing a list as follows would give an error:
list1 = ["abc", 34, True, 40, "male"]
list1 = ["abc", 34, True, 40, "male"]
Q.8. Given: l = [[1,2,3],[4,5,6],[7,8,9]]
Which of the following will give the output as 6
Which of the following will give the output as 6
Q.9. print(l[8]) in l = [7,9,6,2,8,3,5,1] would give
Q.10. What would be the output of following program?
l = [65,3,6,75,4,36,67,56,54]
l.pop(2)
l.pop()
l.pop(0)
print(l)
Q.11. Determine Output of the following snippet of code:
list = ["Hello", "Python","and","Java"]
print(list[0][0]+list[1][1]+list[2][2]+list[3][3])
Q.12. Whats the total number of elements, max number of rows and columns in the 2-dimentional list given
below:
l = [[1],[2,3],[7,8,9],[3],[9,4,5,1],[9,8]]
l = [[1],[2,3],[7,8,9],[3],[9,4,5,1],[9,8]]
Q.13. What would be contents of the list if following code is executed?
l = list(range(1,20,3))
Q.14. Contents of list after following code is executed
l = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
l[7] = 15
Q.15. What will be the output of following code:
l = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
print(sorted(l,reverse=True))
Instructions:-
- This Quiz is based on Lists in Python
- Each correct answer will carry 2 points
- Once an option is selected you cannot select any other, So choose wisely
- Do not refresh the page as it will reset the quiz
- Once the time is up the quiz will automatically get submitted with no of Question responded
- Your total score alongwith your name will be shown after submission of the Quiz
- Wish you ALL THE BEST 👍👍
START
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP