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.

Which of the following functions does not necessarily accept only iterables as arguments?

A. enumerate()
B. all()
C. chr()
D. max()
Answer» D. max()
2.

, 3]))

A. error
B. [(1, 2), (2, 3)]
C. [(0, 2), (1, 3)]
D. [(2, 3)]
Answer» D. [(2, 3)]
3.

The function complex(‘2-3j’) is valid but the function complex(‘2 – 3j’) is invalid.

A. true
B. false
Answer» B. false
4.

The function divmod(a,b), where both ‘a’ and ‘b’ are integers is evaluated as:

A. (a%b, a//b)
B. (a//b, a%b)
C. (a//b, a*b)
D. (a/b, a%b)
Answer» C. (a//b, a*b)
5.

What is the output of the function complex()?

A. 0j
B. 0+0j
C. error
Answer» B. 0+0j
6.

+2j)

A. error
B. 1
C. 2j
D. 1+2j
Answer» E.
7.

,-4), 2,7)

A. 2
B. false
C. -3
D. -4
Answer» C. -3
8.

,0,4.2)

A. true
B. false
C. error
Answer» D.
9.

576)

A. 4.5
B. 5
C. 4
D. 4.6
Answer» C. 4
10.

,4,6) sum([1,2,3])

A. error, 6
B. 12, error
C. 12, 6
D. error, error
Answer» B. 12, error
11.

>8, 4>2, 1>2])

A. error
B. true
C.
D. 4>2
Answer» C.
12.

5676,2)?

A. 4.5
B. 4.6
C. 4.57
D. 4.56
Answer» D. 4.56
13.

,4,0,6])

A. error
B. true
C. false
Answer» D.
14.

Which of the following functions is a built- in function in python?

A. seed()
B. sqrt()
C. factorial()
D. print()
Answer» E.
15.

'.zfill(5))

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

: 100}))

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

'.swapcase())

A.
B. ab12
C. ab!2 d)
Answer» D.
18.

erdE a'.isprintable())

A. true
B. false
C. none
D. error
Answer» B. false
19.

'.replace('cd', '12'))

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

1'.isnumeric())

A. true
B. false
C. none
D. error
Answer» C. none
21.

'.isnumeric())

A. true
B. false
C. none
D. error
Answer» B. false
22.

,'.islower())

A. true
B. false
C. none
D. error
Answer» B. false
23.

'.isalnum())

A. true
B. false
C. none
D. error
Answer» B. false
24.

xa'.isdigit())

A. true
B. false
C. none
D. error
Answer» C. none
25.

:.2%}'.format(1/3))

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

:.2}'.format(1/3))

A. 0.333333
B. 0.33
C. 0.333333:.2
D. error
Answer» C. 0.333333:.2
27.

2223334'))

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

2223334))

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

, 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
30.

[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’)
31.

} 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
32.

!r} and {0!s}".format('fo o', 'bin'))

A. hello foo and foo
B. hello ‘foo’ and foo
C. hello foo and ‘bin’
D. error
Answer» C. hello foo and ‘bin’
33.

} and {name2}".format( 'foo', 'bin'))

A. hello foo and bin
B. hello {name1} and {name2}
C. error
D. hello and
Answer» D. hello and
34.

} 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
35.

} 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
36.

} 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}
37.

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

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

, '12'))

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

, 11))

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

, '1'))

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

, 1))

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

), '*', sep= '')

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

What function do you use to read a string?

A. input(“enter a string”)
B. eval(input(“enter a string”))
C. enter(“enter a string”)
D. eval(enter(“enter a string”))
Answer» B. eval(input(“enter a string”))
44.

print(id(s1) == id(s2))

A. true false
B. true true
C. false true
D. false false
Answer» D. false false
45.

Suppose i is 5 and j is 4, i + j is same as

A. i.    add(j)
B. i.    add    (j)
C. i.    add(j)
D. i.    add(j)
Answer» C. i.    add(j)
46.

To check whether string s1 contains another string s2, use

A. s1.    contains    (s2)
B. s2 in s1
C. s1.contains(s2)
D. si.in(s2)
Answer» B. s2 in s1
47.

If a class defines the     str    (self) method, for an object obj for the class, you can use which command to invoke the     str      method.

A. obj.    str    ()
B. str(obj)
C. print obj
D. all of the mentioned
Answer» E.
48.

To return the length of string s what command do we execute?

A. s.    len    ()
B. len(s)
C. size(s)
D. s.size()
Answer» B. len(s)
49.

To retrieve the character at index 3 from string s=”Hello” what command do we execute (multiple answers allowed)?

A. s[]
B. s.getitem(3)
C. s.    getitem    (3)
D. s.getitem(3)
Answer» D. s.getitem(3)
50.

What is “Hello”.replace(“l”, “e”)?

A. heeeo
B. heelo
C. heleo
D. none
Answer» B. heelo