Problem Solving And Python Programming Set 12
On This Page
This set of Problem Solving and Python Programming Multiple Choice Questions & Answers (MCQs) focuses on Problem Solving And Python Programming Set 12
Q1 | Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
- [2, 33, 222, 14]
- error
- 25
- [25, 14, 222, 33, 2]
Q2 | >>>print(names[-1][-1])
- a
- daman
- error
- n
Q3 | print sum
- 11
- 12
- 21
- 22
Q4 | Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is:
- [0, 1, 2, 3]
- [0, 1, 2, 3, 4]
- [0.0, 0.5, 1.0, 1.5]
- [0.0, 0.5, 1.0, 1.5, 2.0]
Q5 | >>>list1 < list2 is
- true
- false
- error
- none
Q6 | To add a new element to a list we use which command?
- list1.add(5)
- list1.append(5)
- list1.addlast(5)
- list1.addend(5)
Q7 | To insert 5 to the third position in list1, we use which command?
- list1.insert(3, 5)
- list1.insert(2, 5)
- list1.add(3, 5)
- list1.append(3, 5)
Q8 | To remove string “hello” from list1, we use which command?
- list1.remove(“hello”)
- list1.remove(hello)
- list1.removeall(“hello”)
- list1.removeone(“hello”)
Q9 | Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)?
- 0
- 1
- 4
- 2
Q10 | Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)?
- 0
- 4
- 1
- 2
Q11 | Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()?
- [3, 4, 5, 20, 5, 25, 1, 3]
- [1, 3, 3, 4, 5, 5, 20, 25]
- [25, 20, 5, 5, 4, 3, 3, 1]
- [3, 1, 25, 5, 20, 5, 4, 3]
Q12 | , 5])?
- [3, 4, 5, 20, 5, 25, 1, 3, 34, 5]
- [1, 3, 3, 4, 5, 5, 20, 25, 34, 5]
- [25, 20, 5, 5, 4, 3, 3, 1, 34, 5]
- [1, 3, 4, 5, 20, 5, 25, 3, 34, 5]
Q13 | >>>"Welcome to Python".split()
- [“welcome”, “to”, “python”]
- (“welcome”, “to”, “python”)
- {“welcome”, “to”, “python”}
- “welcome”, “to”, “python”
Q14 | >>>list("a#b#c#d".split('#'))
- [‘a’, ‘b’, ‘c’, ‘d’]
- [‘a b c d’] c) [‘a#b#c#d’]
- d) [‘abcd’]
Q15 | >>>print(indexOfMax)
- 1
- 2
- 3
- 4
Q16 | print(myList[i], end = " ")
- 2 3 4 5 6 1
- 6 1 2 3 4 5
- 2 3 4 5 6 6
- 1 1 2 3 4 5
Q17 | >>>print(list2)
- [1, 3]
- [4, 3]
- [1, 4]
- [1, 3, 4]
Q18 | print(v)
- [1, 44]
- [1, 2, 3, 44]
- [44, 2, 3]
- [1, 2, 3]
Q19 | print(v)
- [1] [2] [3]
- [1] [1, 2] [1, 2, 3]
- [1, 2, 3]
- 1 2 3
Q20 | print(2)
- none
- 1
- 2
- error
Q21 | print(names2[2][0])
- none
- a
- b
- c
Q22 | numbers = [1, 2, 3, 4]numbers.append([5,6,7,8])print(len(numbers))
- 4
- 5
- 8
- 12
Q23 | To which of the following the “in” operator can be used to check if an item is in it?
- lists
- dictionary
- set
- all of the mentioned
Q24 | print(len(list1 + list2))
- 2
- 4
- 5
- 8
Q25 | print(len(mylist))
- 1
- 4
- 5
- 8