Python quiz List

Python Quiz

python quiz and python notes study material, all are available in this web pages basically it provides Lists, list of items , list length and type array

Grammer Quiz

10
Created on By wefru

python-list

python-list

1 / 20

1. Which of the following commands will create a list?

2 / 20

2. What is the output when we execute list(“hello”)?

3 / 20

3. Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?

4 / 20

4. Suppose list1 is [2445,133,12454,123], what is max(list1)?

5 / 20

5. Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?

6 / 20

6. Suppose list1 is [1, 5, 9], what is sum(list1)?

7 / 20

7. To shuffle the list(say list1) what function do we use?

8 / 20

8. Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?

9 / 20

9. Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?

10 / 20

10. Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?

11 / 20

1. What will be the output of the following Python code?

  1. >>>names = ['Amir', 'Bear', 'Charlton', 'Daman']
  2. >>>print(names[-1][-1])

12 / 20

2. What will be the output of the following Python code?

  1. names1 = ['Amir', 'Bear', 'Charlton', 'Daman']
  2. names2 = names1
  3. names3 = names1[:]
  4. names2[0] = 'Alice'
  5. names3[1] = 'Bob'
  6. sum = 0
  7. for ls in (names1, names2, names3):
  8.     if ls[0] == 'Alice':
  9.         sum += 1
  10.     if ls[1] == 'Bob':
  11.         sum += 10
  12. print sum

13 / 20

3. Suppose list1 is [1, 3, 2], What is list1 * 2?

14 / 20

4. Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is:

15 / 20

5. What will be the output of the following Python code?

  1. >>>list1 = [11, 2, 23]
  2. >>>list2 = [11, 2, 2]
  3. >>>list1 < list2 is

16 / 20

6. To add a new element to a list we use which command?

17 / 20

7. To insert 5 to the third position in list1, we use which command?

18 / 20

8. To remove string “hello” from list1, we use which command?

19 / 20

9. Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)?

20 / 20

10. Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)?

Your score is

The average score is 56%

0%

Leave a Reply