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.

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

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

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

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

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

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

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

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

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

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

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

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

What is the output of the following? print('0xa'.isdigit())

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

What is the output of the following? print('a B'.isalpha())

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

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

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

What is the output of the following? print('ab,12'.isalnum())

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

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

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

What is the output of the following? print('{0:.2%}'.format(1/3))

A. 0.33
B. 0.33%
C. 33.33%
D. 33%
Answer» D. 33%
13.

What is the output of the following? print('{0:.2}'.format(1/3))

A. 0.333333
B. 0.33
C. 0.333333:.2
D. Error
Answer» C. 0.333333:.2
14.

What is the output of the following? print('{:#}'.format(1112223334))

A. 1,112,223,334
B. 111,222,333,4
C. 1112223334
D. Error
Answer» D. Error
15.

What is the output of the following? print('{:$}'.format(1112223334))

A. 1,112,223,334
B. 111,222,333,4
C. 1112223334
D. Error
Answer» E.
16.

What is the output of the following? print('{:,}'.format('1112223334'))

A. 1,112,223,334
B. 111,222,333,4
C. 1112223334
D. Error
Answer» E.
17.

What is the output of the following? print('{:,}'.format(1112223334))

A. 1,112,223,334
B. 111,222,333,4
C. 1112223334
D. Error
Answer» B. 111,222,333,4
18.

What is the output of the following? print('The sum of {0:b} and {1:x} is {2:o}'.format(2, 10, 12))

A. The sum of 2 and 10 is 12
B. The sum of 10 and a is 14
C. The sum of 10 and a is c
D. Error
Answer» C. The sum of 10 and a is c
19.

What is the output of the following? print('The sum of {0} and {1} is {2}'.format(2, 10, 12))

A. The sum of 2 and 10 is 12
B. Error
C. The sum of 0 and 1 is 2
D. None of the mentioned
Answer» B. Error
20.

What is the output of the following? print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))

A. Hello foo and bin
B. Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
C. Error
D. None of the mentioned
Answer» B. Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
21.

What is the output of the following? print("Hello {0} and {1}".format(('foo', 'bin')))

A. Hello foo and bin
B. Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
C. Error
D. None of the mentioned
Answer» D. None of the mentioned
22.

What is the output of the following? print("Hello {0!r} and {0!s}".format('foo', 'bin'))

A. Hello foo and foo
B. Hello ‘foo’ and foo
C. Hello foo and ‘bin’
D. Error
Answer» C. Hello foo and ‘bin’
23.

What is the output of the following? print("Hello {name1} and {name2}".format(name1='foo', name2='bin'))

A. Hello foo and bin
B. Hello {name1} and {name2}
C. Error
D. Hello and
Answer» B. Hello {name1} and {name2}
24.

What is the output of the following? print("Hello {name1} and {name2}".format('foo', 'bin'))

A. Hello foo and bin
B. Hello {name1} and {name2}
C. Error
D. Hello and
Answer» D. Hello and
25.

What is the output of the following? print("Hello {} and {}".format('foo', 'bin'))

A. Hello foo and bin
B. Hello {} and {}
C. Error
D. Hello and
Answer» B. Hello {} and {}
26.

What is the output of the following? print("Hello {1} and {0}".format('bin', 'foo'))

A. Hello foo and bin
B. Hello bin and foo
C. Error
D. None of the mentioned
Answer» B. Hello bin and foo
27.

What is the output of the following? print("Hello {0} and {1}".format('foo', 'bin'))

A. Hello foo and bin
B. Hello {0} and {1} foo bin
C. Error
D. Hello 0 and 1
Answer» B. Hello {0} and {1} foo bin
28.

What is the output of the following? print("ccdcddcd".find("c"))

A. 4
B. 0
C. Error
D. True
Answer» C. Error
29.

What is the output of the following? print("abcdef".find("cd"))

A. True
B. 2
C. 3
D. None of the mentioned
Answer» C. 3
30.

What is the output of the following? print("abcdef".find("cd") == "cd" in "abcdef")

A. True
B. False
C. Error
D. None of the mentioned
Answer» C. Error
31.

What is the output of the following? print("ab\tcd\tef".expandtabs('+'))

A. ab+cd+ef
B. ab++++++++cd++++++++ef
C. ab cd ef
D. none of the mentioned
Answer» E.
32.

What is the output of the following? print("ab\tcd\tef".expandtabs(4))

A. ab cd ef
B. abcdef
C. abcdef
D. ab cd ef
Answer» E.
33.

What is the output of the following? print("ab\tcd\tef".expandtabs())

A. ab cd ef
B. abcdef
C. abcdef
D. ab cd ef
Answer» B. abcdef
34.

What is the output of the following? print("xyyzxyzxzxyy".endswith("xyy", 0, 2))

A. 0
B. 1
C. True
D. False
Answer» E.
35.

What is the output of the following? print("xyyzxyzxzxyy".endswith("xyy"))

A. 1
B. True
C. 3
D. 2
Answer» C. 3
36.

What is the default value of encoding in encode()?

A. ascii
B. qwerty
C. utf-8
D. utf-16
Answer» D. utf-16
37.

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

A. abc
B. ‘abc’
C. b’abc
D. h’abc’
Answer» D. h’abc’
38.

What is the output of the following? print("xyyzxyzxzxyy".count('xyy', -10, -1))

A. 2
B. 0
C. 1
D. error
Answer» C. 1
39.

What is the output of the following? print("xyyzxyzxzxyy".count('xyy', 2, 11))

A. 2
B. 0
C. 1
D. error
Answer» C. 1
40.

What is the output of the following? print("xyyzxyzxzxyy".count('xyy', 0, 100))

A. 2
B. 0
C. 1
D. error
Answer» B. 0
41.

What is the output of the following? print("xyyzxyzxzxyy".count('yy', 2))

A. 2
B. 0
C. 1
D. none of the mentioned
Answer» D. none of the mentioned
42.

What is the output of the following? print("xyyzxyzxzxyy".count('yy', 1))

A. 2
B. 0
C. 1
D. none of the mentioned
Answer» B. 0
43.

What is the output of the following? print("xyyzxyzxzxyy".count('yy'))

A. 2
B. 0
C. error
D. none of the mentioned
Answer» B. 0
44.

What is the output of the following? print("abcdef".center(10, '12'))

A. 12abcdef12
B. abcdef1212
C. 1212abcdef
D. error
Answer» E.
45.

What is the output of the following? print("abcdef".center(7, '1'))

A. 1abcdef
B. abcdef1
C. abcdef
D. error
Answer» B. abcdef1
46.

What is the output of the following? print("abcdef".center(7, 1))

A. 1abcdef
B. abcdef1
C. abcdef
D. error
Answer» E.
47.

What is the output of the following? print('*', "abcde".center(6), '*', sep='')

A. * abcde *
B. * abcde *
C. *abcde *
D. * abcde*
Answer» D. * abcde*
48.

What is the output of the following? print('*', "abcdef".center(7), '*', sep='')

A. * abcdef *
B. * abcdef *
C. *abcdef *
D. * abcdef*
Answer» E.
49.

What is the output of the following? print('*', "abcdef".center(7), '*')

A. * abcdef *
B. * abcdef *
C. *abcdef *
D. * abcdef*
Answer» C. *abcdef *
50.

What is the output of the following? print("abcdef".center(0))

A. cd
B. abcdef
C. error
D. none of the mentioned
Answer» D. none of the mentioned