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.

Say s=”hello” what will be the return value of type(s)?

A. int
B. bool
C. str
D. string
Answer» D. string
2.

What will be displayed by print(ord(‘b’) – ord(‘a’))?

A. 0
B. 1
C. -1
D. 2
Answer» C. -1
3.

>>>print("A", end = ' ')

A. dcba
B. a, b, c, d
C. d c b a
D. d, c, b, a will be displayed on four lines
Answer» D. d, c, b, a will be displayed on four lines
4.

+2+3?

A. hello123
B. hello
C. error
D. hello6
Answer» D. hello6
5.

The format function, when applied on a string returns

A. error
B. int
C. bool
D. str
Answer» E.
6.

Which of the following statement prints hello\example\test.txt?

A. print(“hello\\example\\test.txt”)
B. print(“hello\\example\\test.txt”)
C. print(“hello\\”example\\”test.txt”)
D. print(“hello”\\example”\\test.txt”)
Answer» C. print(“hello\\”example\\”test.txt”)
7.

>>>print(chr(ord('b')+1))

A. a
B. b
C. c
D. a
Answer» D. a
8.

Suppose s is “\t\tWorld\n”, what is s.strip()?

A. \\t\\tworld\\n
B. \\t\\tworld\\n
C. \\t\\tworld\\n
D. world
Answer» E.
9.

>>>chr(ord('A'))

A. a
B. b
C. a
D. error
Answer» B. b
10.

To concatenate two strings to a third what statements are applicable?

A. s3 = s1 . s2
B. s3 = s1.add(s2)
C. s3 = s1.    add    (s2)
D. s3 = s1 * s2
Answer» D. s3 = s1 * s2
11.

>>>example[::-1].startswith("d")

A. dlrowolleh
B. true
C. -1
D. none
Answer» C. -1
12.

>>>example.rfind("e")

A. -1
B. 4
C. 3
D. 1
Answer» C. 3
13.

>>>example.find("e")

A. error
B. -1
C. 1
Answer» D.
14.

Given a string example=”hello” what is the output of example.count(‘l’)?

A. 2
B. 1
C. none
Answer» B. 1
15.

>>>max("what are you")

A. error
B. u
C. t
D. y
Answer» E.
16.

>>>print example

A. snow
B. snow world
C. error
D. snos world
Answer» D. snos world
17.

>>>print(temp.id)

A. 224
B. error
C. 12
D. none
Answer» D. none
18.

>>>print "%d %d" % (obj.o1, obj.o2)

A. none none
B. none 22
C. 22 none
D. error is generated
Answer» E.
19.

>>>print("%s" % example[4:7])

A. wo
B. world
C. sn
D. rl
Answer» B. world
20.

>>>str1[::-1]

A. dlrowolleh
B. hello
C. world
D. helloworld
Answer» B. hello
21.

>>>print (r"\nhello")

A. a new line and hello
B. \\nhello
C. the letter r and then hello
D. error
Answer» C. the letter r and then hello
22.

xA + 0xB + 0xC)

A. 0xa0xb0xc
B. error
C. 0x22
D. 33
Answer» E.
23.

What arithmetic operators cannot be used with strings?

A. +
B. *
C. –
D. all of the mentioned
Answer» D. all of the mentioned
24.

>>>print('new' 'line')

A. error
B. output equivalent to print ‘new\\nline’
C. newline
D. new line
Answer» D. new line
25.

>>>"abcd"[2:]

A. a
B. ab
C. cd
D. dc
Answer» D. dc
26.

>>> str1[-1:]

A. olleh
B. hello
C. h
D. o
Answer» E.
27.

>>>"a"+"bc"

A. a
B. bc
C. bca
D. abc
Answer» E.
28.

] in a: print(a[0])

A. 0 1 2 3
B. 0 1 2 2
C. 3 3 3 3
D. error
Answer» B. 0 1 2 2
29.

0)): print(i)

A. 0.0 1.0
B. 0 1
C. error
D. none of the mentioned
Answer» C. error
30.

0): print(i)

A. 0.0 1.0
B. 0 1
C. error
D. none of the mentioned
Answer» D. none of the mentioned
31.

30)

A. true
B. false
C. error
D. no output
Answer» C. error
32.

R operator. Hence the output of the code shown above is: 20 10.

A. 1011011
B. 11010100
C. 11101011
D. 10110011
Answer» C. 11101011
33.

): print(i)

A. 0
B. no output
C. error
D. none of the mentioned
Answer» C. error
34.

-2)+bin(12^4)

A. 0b10000
B. 0b10001000
C. 0b1000b1000
D. 0b10000b1000
Answer» E.
35.

Which of the following expressions can be used to multiply a given number ‘a’ by 4?

A. a<<2
B. a<<4
C. a>>2
D. a>>4
Answer» B. a<<4
36.

^12

A. 2
B. 4
C. 8
D. 12
Answer» D. 12
37.

Bitwise                    gives 1 if either of the bits is 1 and 0 when both of the bits are 1.

A. or
B. and
C. xor
D. not
Answer» D. not
38.

00000 is also equal to 10000000. Hence the statement is false.

A. 001101010
B. 110010101
C. 001101011
D. 110010100
Answer» B. 110010101
39.

It is not possible for the two’s complement value to be equal to the original value in any case.

A. true
B. false
Answer» C.
40.

x75

A. 115
B. 116
C. 117
D. 118
Answer» D. 118
41.

x8)

A. ‘0bx1000’
B. 8
C. 1000
D. ‘0b1000’
Answer» E.
42.

Which of the following represents the bitwise XOR operator?

A. &
B. ^
C. !
Answer» C. !
43.

Which of the following expressions results in an error?

A. int(1011)
B. int(‘1011’,23)
C. int(1011,2)
D. int(‘1011’)
Answer» D. int(‘1011’)
44.

1)?

A. 1011
B. 11
C. 13
D. 1101
Answer» B. 11
45.

The expression 2**2**3 is evaluates as: (2**2)**3.

A. true
B. false
Answer» C.
46.

+2**5//10

A. 3
B. 7
C. 77
Answer» C. 77
47.

//6%3, 24//4//2

A. (1,3)
B. (0,3)
C. (1,0)
D. (3,1)
Answer» B. (0,3)
48.

2. Hence the result of this expression is 27.2.

A. 4.7 – 1.5
B. 7.9 * 6.3
C. 1.7 % 2
D. 3.4 + 4.6
Answer» D. 3.4 + 4.6
49.

+int(2.39)%2)

A. 5.0
B. 5
C. 4
D. 4
Answer» D. 4
50.

**(3**2) (2**3)**2 2**3**2

A. 64, 512, 64
B. 64, 64, 64
C. 512, 512, 512
D. 512, 64, 512
Answer» E.