Suppose list1 = [0.5 * x for x in range(0, 4)], list1 is:
1. [0, 1, 2, 3]
2. [0, 1, 2, 3, 4]
3.[0.0, 0.5, 1.0, 1.5]
4.[0.0, 0.5, 1.0, 1.5, 2.0]
Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)?
1. 3
2. 5
3.25
4. 1
Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)?
1. 5
2.4
3.None
4. Error
To insert 5 to the third position in list1, we use which command?
1. list1.insert(3, 5)
2. list1.insert(2, 5)
3.list1.add(3, 5)
4. list1.append(3, 5)
What will be the output of the following Python code snippet? print('ab cd ef'.splitlines())
1. [‘ab’, ‘cd’, ‘ef’]
2. [‘ab ’, ‘cd ’, ‘ef ’]
3.[‘ab ’, ‘cd ’, ‘ef’]
4. [‘ab’, ‘cd’, ‘ef ’]
What will be the output of the following Python code snippet? print('abcdef12'.replace('cd', '12'))
1.ab12ef12
2.abcdef12
3. ab12efcd
4.none of the mentioned
What will be the output of the following Python code snippet? print('abef'.replace('cd', '12'))
1.abef
2.12
3.error
4.none of the mentioned
What will be the output of the following Python code? >>>names = ['Amir', 'Bear', 'Charlton', 'Daman'] >>>print(names[-1][-1])
1.A
2.Daman
3.Error
4. n
What will be the output of the following Python code? print('cba'.maketrans('abc', '123'))
1.{97: 49, 98: 50, 99: 51}
2.{65: 49, 66: 50, 67: 51}
3.321
4.123
Which of the following commands will create a list?
1. list1 = list()
2. list1 = list()
3. list1 = list([1, 2, 3])
4.all of the mentioned
Suppose list1 is [1, 3, 2], What is list1 * 2?
1.[2, 6, 4]
2. [1, 3, 2, 1, 3]
3.[1, 3, 2, 1, 3, 2]
4. [1, 3, 2, 3, 2, 1]
Suppose list1 is [1, 5, 9], what is sum(list1)?
1.1
2.9
3.15
4. Error
Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]?
1.Error
2.None
3.25
4.2
Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]?
1. [2, 33, 222, 14]
2. Error
3.25
4. [25, 14, 222, 33, 2]
Suppose list1 is [2445,133,12454,123], what is max(list1)?
1. 2445
2. 133
3.12454
4.123
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after list1.reverse()?
1. [3, 4, 5, 20, 5, 25, 1, 3]
2.[1, 3, 3, 4, 5, 5, 20, 25]
3.[25, 20, 5, 5, 4, 3, 3, 1]
4. [3, 1, 25, 5, 20, 5, 4, 3]
Suppose list1 is [3, 4, 5, 20, 5, 25, 1, 3], what is list1.count(5)?
1.0
2.4
3.1
4.2
Suppose list1 is [3, 4, 5, 20, 5], what is list1.index(5)?
1.0
2.1
3.4
4.2
Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation?
1. print(list1[0])
2. print(list1[:2])
3. print(list1[:-2])
4.all of the mentioned
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.extend([34, 5])?
1.[3, 4, 5, 20, 5, 25, 1, 3, 34, 5]
2.[1, 3, 3, 4, 5, 5, 20, 25, 34, 5]
3. [25, 20, 5, 5, 4, 3, 3, 1, 34, 5]
4.[1, 3, 4, 5, 20, 5, 25, 3, 34, 5]
Suppose listExample is [3, 4, 5, 20, 5, 25, 1, 3], what is list1 after listExample.pop(1)?
1.[3, 4, 5, 20, 5, 25, 1, 3]
2.[1, 3, 3, 4, 5, 5, 20, 25]
3.[3, 5, 20, 5, 25, 1, 3]
4.[1, 3, 4, 5, 20, 5, 25]
To add a new element to a list we use which command?
1. list1.add(5)
2.list1.append(5)
3.list1.addLast(5)
4. list1.addEnd(5)
To remove string “hello†from list1, we use which command?
1. list1.remove(“helloâ€)
2. list1.remove(“helloâ€)
3.list1.removeAll(“helloâ€)
4. list1.removeOne(“helloâ€)
To shuffle the list(say list1) what function do we use?
1. list1.shuffle()
2. shuffle(list1)
3. random.shuffle(list1)
4. random.shuffleList(list1)
What is the output when we execute list(“helloâ€)?
1.[‘h’, ‘e’, ‘l’, ‘l’, ‘o’]
2. [‘hello’]
3. [‘llo’]
4. [‘olleh’]
What will be the output of the following Python code snippet? print('ab cd ef'.title())
1.Ab cd ef
2.Ab cd eF
3.Ab Cd Ef
4.none of the mentioned
What will be the output of the following Python code snippet? print('ab cd-ef'.title())
1.Ab cd-ef
2. Ab Cd-ef
3.Ab Cd-Ef
4.none of the mentioned
What will be the output of the following Python code snippet? print('Ab!2'.swapcase())
1. AB!@
2. ab12
3.aB!2
4.aB1@
What will be the output of the following Python code snippet? print('abcd'.translate('a'.maketrans('abc', 'bcd')))
1.bcde
2.abcd
3.error
4.bcdd
What will be the output of the following Python code snippet? print('abcdefcdghcd'.split('cd'))
1. [‘ab’, ‘ef’, ‘gh’]
2.[‘ab’, ‘ef’, ‘gh’, â€]
3.(‘ab’, ‘ef’, ‘gh’)
4.(‘ab’, ‘ef’, ‘gh’, â€)
What will be the output of the following Python code snippet? print('abcdefcdghcd'.split('cd', -1))
1. [‘ab’, ‘ef’, ‘gh’]
2.[‘ab’, ‘ef’, ‘gh’, â€]
3.(‘ab’, ‘ef’, ‘gh’)
4.(‘ab’, ‘ef’, ‘gh’, â€)
What will be the output of the following Python code snippet? print('abcdefcdghcd'.split('cd', 0))
1. [‘abcdefcdghcd’]
2.‘abcdefcdghcd’
3. error
4.none of the mentioned
What will be the output of the following Python code snippet? print('abcdefcdghcd'.split('cd', 2))
1. [‘ab’, ‘ef’, ‘ghcd’]
2. [‘ab’, ‘efcdghcd’]
3. [‘abcdef’, ‘ghcd’]
4.none of the mentioned
What will be the output of the following Python code snippet? print('abcefd'.replace('cd', '12'))
1.ab1ef2
2.abcefd
3.ab1efd
4. ab12ed2
What will be the output of the following Python code snippet? print('abef'.partition('cd'))
1.(‘abef’)
2.(‘abef’, ‘cd’, â€)
3. (‘abef’, â€, â€)
4.error
What will be the output of the following Python code snippet? print('cd'.partition('cd'))
1.(‘cd’)
2.(â€)
3.(‘cd’, â€, â€)
4.(â€, ‘cd’, â€)
What will be the output of the following Python code snippet? print('Hello World'.istitle())
1. True
2.False
3.None
4.Error
What will be the output of the following Python code snippet? print('xyyxyyxyxyxxy'.replace('xy', '12', 0))
1. xyyxyyxyxyxxy
2.12y12y1212x12
3.12yxyyxyxyxxy
4.xyyxyyxyxyx12
What will be the output of the following Python code snippet? print('xyyxyyxyxyxxy'.replace('xy', '12', 100))
1.xyyxyyxyxyxxy
2.12y12y1212x12
3. none of the mentioned
4.error
What will be the output of the following Python code? >>>list1 = [11, 2, 23] >>>list2 = [11, 2, 2] >>>list1 < list2
1. True
2.False
3.Error
4.None
What will be the output of the following Python code? print(''' foo'''.lstrip())
1. foo
2.foo
3. foo
4.none of the mentioned
What will be the output of the following Python code? print(''' foo'''.lstrip())
1. foo
2.foo
3. foo
4.none of the mentioned
What will be the output of the following Python code? print('1Rn@'.lower())
1. n
2.1rn@
3.rn
4.r
What will be the output of the following Python code? print('a'.maketrans('ABC', '123'))
1.{97: 49, 98: 50, 99: 51}
2.{65: 49, 66: 50, 67: 51}
3.{97: 49}
4.1
What will be the output of the following Python code? print('abcd'.partition('cd'))
1. (‘ab’, ‘cd’, â€)
2.(‘ab’, ‘cd’)
3.error
4.none of the mentioned
What will be the output of the following Python code? print('abcdef'.partition('cd'))
1. (‘ab’, ‘ef’)
2.(‘abef’)
3.(‘ab’, ‘cd’, ‘ef’)
4.2
What will be the output of the following Python code? print('abcdefcdgh'.partition('cd'))
1.(‘ab’, ‘cd’, ‘ef’, ‘cd’, ‘gh’)
2.(‘ab’, ‘cd’, ‘efcdgh’)
3. (‘abcdef’, ‘cd’, ‘gh’)
4.error
What will be the output of the following Python code? print('Hello!2@#World'.istitle())
1. True
2. False
3. None
4.error
What will be the output of the following Python code? print('xyxxyyzxxy'.lstrip('xyy'))
1.zxxy
2.xyxxyyzxxy
3.xyxzxxy
4.none of the mentioned
What will be the output of the following Python code? print('xyyzxxyxyy'.lstrip('xyy'))
1.error
2. zxxyxyy
3.z
4.zxxy