Explore topic-wise MCQs in Testing Subject.

This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.

1.

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

A. [0, 1, 2, 3].
B. [0, 1, 2, 3, 4].
C. [0.0, 0.5, 1.0, 1.5].
D. [0.0, 0.5, 1.0, 1.5, 2.0].
Answer» D. [0.0, 0.5, 1.0, 1.5, 2.0].
2.

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

A. [2, 6, 4].
B. [1, 3, 2, 1, 3].
C. [1, 3, 2, 1, 3, 2] .
D. [1, 3, 2, 3, 2, 1].
Answer» D. [1, 3, 2, 3, 2, 1].
3.

What is the output when following code is executed ? >>>names = ['Amir', 'Bear', 'Charlton', 'Daman'] >>>print(names[-1][-1])

A. A
B. Daman
C. Error
D. n
Answer» E.
4.

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

A. [2, 33, 222, 14].
B. Error
C. 25
D. [25, 14, 222, 33, 2].
Answer» B. Error
5.

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

A. Error
B. None
C. 25
D. 2
Answer» D. 2
6.

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

A. print(list1[0])
B. print(list1[:2])
C. print(list1[:-2])
D. all of the mentioned
Answer» E.
7.

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

A. list1.shuffle()
B. shuffle(list1)
C. random.shuffle(list1)
D. random.shuffleList(list1)
Answer» D. random.shuffleList(list1)
8.

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

A. 1
B. 9
C. 15
D. Error
Answer» D. Error
9.

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

A. 3
B. 5
C. 25
D. 1
Answer» E.
10.

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

A. 2445
B. 133
C. 12454
D. 123
Answer» D. 123
11.

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

A. 5
B. 4
C. None
D. Error
Answer» B. 4
12.

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

A. [‘h’, ‘e’, ‘l’, ‘l’, ‘o’].
B. [‘hello’].
C. [‘llo’].
D. [‘olleh’].
Answer» B. [‘hello’].
13.

Which of the following commands will create a list?

A. list1 = list()
B. list1 = [].
C. list1 = list([1, 2, 3])
D. all of the mentioned
Answer» E.
14.

What is the output of the following? print('+99'.zfill(5))

A. 00+99
B. 00099
C. +0099
D. +++99
Answer» D. +++99
15.

What is the output of the following? print('ab'.zfill(5))

A. 000ab
B. 00ab0
C. 0ab00
D. ab000
Answer» B. 00ab0
16.

What is the output of the following? print('abcd'.translate({'a': '1', 'b': '2', 'c': '3', 'd': '4'}))

A. abcd
B. 1234
C. error
D. none of the mentioned
Answer» B. 1234
17.

What is the output of the following? print('abcd'.translate({97: 98, 98: 99, 99: 100}))

A. bcde
B. abcd
C. error
D. none of the mentioned
Answer» E.
18.

What is the output of the following? print('abcd'.translate('a'.maketrans('abc', 'bcd')))

A. bcde
B. abcd
C. error
D. bcdd
Answer» E.
19.

What is the output of the following? print('ab cd-ef'.title())

A. Ab cd-ef
B. Ab Cd-ef
C. Ab Cd-Ef
D. None of the mentioned
Answer» D. None of the mentioned
20.

What is the output of the following? print('ab cd ef'.title())

A. Ab cd ef
B. Ab cd eF
C. Ab Cd Ef
D. None of the mentioned
Answer» D. None of the mentioned
21.

What is the output of the following? print('Ab!2'.swapcase())

A. AB!@
B. ab12
C. aB!2
D. aB1@
Answer» D. aB1@
22.

What is the output of the following? print('ab\ncd\nef'.splitlines())

A. [‘ab’, ‘cd’, ‘ef’].
B. [‘ab’, ‘cd’, ‘ef’].
C. [‘ab’, ‘cd’, ‘ef’].
D. [‘ab’, ‘cd’, ‘ef’].
Answer» B. [‘ab’, ‘cd’, ‘ef’].
23.

What is the output of the following? print('abcdefcdghcd'.split('cd', 2))

A. [‘ab’, ‘ef’, ‘ghcd’].
B. [‘ab’, ‘efcdghcd’].
C. [‘abcdef’, ‘ghcd’].
D. none of the mentioned
Answer» B. [‘ab’, ‘efcdghcd’].
24.

What is the output of the following? print('abcdefcdghcd'.split('cd', -1))

A. [‘ab’, ‘ef’, ‘gh’].
B. [‘ab’, ‘ef’, ‘gh’, ”].
C. (‘ab’, ‘ef’, ‘gh’)
D. (‘ab’, ‘ef’, ‘gh’, ”)
Answer» C. (‘ab’, ‘ef’, ‘gh’)
25.

What is the output of the following? print('abcdefcdghcd'.split('cd', 0))

A. [‘abcdefcdghcd’].
B. ‘abcdefcdghcd’
C. error
D. none of the mentioned
Answer» B. ‘abcdefcdghcd’
26.

What is the output of the following? print('abcdefcdghcd'.split('cd'))

A. [‘ab’, ‘ef’, ‘gh’].
B. [‘ab’, ‘ef’, ‘gh’, ”].
C. (‘ab’, ‘ef’, ‘gh’)
D. (‘ab’, ‘ef’, ‘gh’, ”)
Answer» C. (‘ab’, ‘ef’, ‘gh’)
27.

What is the output of the following? print('xyyxyyxyxyxxy'.replace('xy', '12', 100))

A. xyyxyyxyxyxxy
B. 12y12y1212x12
C. none of the mentioned
D. error
Answer» C. none of the mentioned
28.

What is the output of the following? print('xyyxyyxyxyxxy'.replace('xy', '12', 0))

A. xyyxyyxyxyxxy
B. 12y12y1212x12
C. 12yxyyxyxyxxy
D. xyyxyyxyxyx12
Answer» B. 12y12y1212x12
29.

What is the output of the following? print('abcefd'.replace('cd', '12'))

A. ab1ef2
B. abcefd
C. ab1efd
D. ab12ed2
Answer» C. ab1efd
30.

What is the output of the following? print('abef'.replace('cd', '12'))

A. abef
B. 12
C. error
D. none of the mentioned
Answer» B. 12
31.

What is the output of the following? print('abcdef12'.replace('cd', '12'))

A. ab12ef12
B. abcdef12
C. ab12efcd
D. none of the mentioned
Answer» B. abcdef12
32.

What is the output of the following? print('abef'.partition('cd'))

A. (‘abef’)
B. (‘abef’, ‘cd’, ”)
C. (‘abef’, ”, ”)
D. error
Answer» D. error
33.

What is the output of the following? print('cd'.partition('cd'))

A. (‘cd’)
B. (”)
C. (‘cd’, ”, ”)
D. (”, ‘cd’, ”)
Answer» E.
34.

What is the output of the following? print('abcd'.partition('cd'))

A. (‘ab’, ‘cd’, ”)
B. (‘ab’, ‘cd’)
C. error
D. none of the mentioned
Answer» B. (‘ab’, ‘cd’)
35.

What is the output of the following? print('abcdefcdgh'.partition('cd'))

A. (‘ab’, ‘cd’, ‘ef’, ‘cd’, ‘gh’)
B. (‘ab’, ‘cd’, ‘efcdgh’)
C. (‘abcdef’, ‘cd’, ‘gh’)
D. error
Answer» C. (‘abcdef’, ‘cd’, ‘gh’)
36.

What is the output of the following? print('abcdef'.partition('cd'))

A. (‘ab’, ‘ef’)
B. (‘abef’)
C. (‘ab’, ‘cd’, ‘ef’)
D. 2
Answer» D. 2
37.

What is the output of the following? print('a'.maketrans('ABC', '123'))

A. {97: 49, 98: 50, 99: 51}
B. {65: 49, 66: 50, 67: 51}
C. {97: 49}
D. 1
Answer» B. {65: 49, 66: 50, 67: 51}
38.

What is the output of the following? print('cba'.maketrans('abc', '123'))

A. {97: 49, 98: 50, 99: 51}
B. {65: 49, 66: 50, 67: 51}
C. 321
D. 123
Answer» B. {65: 49, 66: 50, 67: 51}
39.

What is the output of the following? print('xyxxyyzxxy'.lstrip('xyy'))

A. zxxy
B. xyxxyyzxxy
C. xyxzxxy
D. none of the mentioned
Answer» B. xyxxyyzxxy
40.

What is the output of the following? print('xyyzxxyxyy'.lstrip('xyy'))

A. error
B. zxxyxyy
C. z
D. zxxy
Answer» C. z
41.

What is the output of the following? print(''' \tfoo'''.lstrip())

A. foo
B. foo
C. foo
D. none of the mentioned
Answer» C. foo
42.

What is the output of the following? print('1Rn@'.lower())

A. n
B. 1rn@
C. rn
D. r
Answer» C. rn
43.

What is the output of the following? print('Hello!2@#World'.istitle())

A. True
B. False
C. None
D. error
Answer» B. False
44.

What is the output of the following? print('Hello World'.istitle())

A. True
B. False
C. None
D. Error
Answer» B. False
45.

What is the output of the following? print('HelloWorld'.istitle())

A. True
B. False
C. None
D. Error
Answer» C. None
46.

What is the output of the following? print('\t'.isspace())

A. True
B. False
C. None
D. Error
Answer» B. False
47.

What is the output of the following? print(''''''.isspace())

A. True
B. False
C. None
D. Error
Answer» C. None
48.

What is the output of the following? print('1@ a'.isprintable())

A. True
B. False
C. None
D. Error
Answer» B. False
49.

What is the output of the following? print('1.1'.isnumeric())

A. True
B. False
C. None
D. Error
Answer» C. None
50.

What is the output of the following? print('11'.isnumeric())

A. True
B. False
C. None
D. Error
Answer» B. False