Python Certification Exam Preparation Set 46

What will be the output of the following Python code?


Options are :

  • he (Correct)
  • lo
  • olleh
  • hello

Answer :he

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 8

What is the return type of function id?


Options are :

  • int (Correct)
  • float
  • bool
  • dict

Answer :int

In python we do not specify types, it is directly interpreted by the compiler, so consider the following operation to be performed.


Options are :

  • x = 13 // 2
  • x = int(13 / 2)
  • x = 13 % 2
  • All of the mentioned (Correct)

Answer :All of the mentioned

What error occurs when you execute the following Python code snippet?


Options are :

  • SyntaxError
  • NameError (Correct)
  • ValueError
  • TypeError

Answer :NameError

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 19

What will be the output of the following Python code snippet?


Options are :

  • indentation Error (Correct)
  • cannot perform mathematical operation on strings
  • hello2
  • hello2hello2

Answer :indentation Error

What data type is the object below?


Options are :

  • list (Correct)
  • dictionary
  • array
  • tuple

Answer :list

What is the output of print 0.1 + 0.2 == 0.3?


Options are :

  • True
  • False (Correct)
  • Machine dependent
  • Error

Answer :False

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 20

Which of the following is not a complex number?


Options are :

  • k = 2 + 3j
  • k = complex(2, 3)
  • k = 2 + 3l (Correct)
  • k = 2 + 3J

Answer :k = 2 + 3l

What is the type of inf?


Options are :

  • Boolean
  • Integer
  • Float (Correct)
  • Complex

Answer :Float

What does ~4 evaluate to?


Options are :

  • -5 (Correct)
  • -4
  • -3
  • +3

Answer :-5

Python Certification Exam Preparation Set 31

What does ~~~~~~5 evaluate to?


Options are :

  • +5 (Correct)
  • -11
  • +11
  • -5

Answer :+5

Which of the following is incorrect?


Options are :

  • x = 0b101
  • x = 0x4f5
  • x = 19023
  • x = 03964 (Correct)

Answer :x = 03964

What is the result of cmp(3, 1)?


Options are :

  • 1 (Correct)
  • 0
  • True
  • False

Answer :1

Python Certification Exam Preparation Set 17

What is the result of round(0.5) round(-0.5)?


Options are :

  • 1.0
  • 2.0
  • 0.0
  • Value depends on Python version (Correct)

Answer :Value depends on Python version

What does 3 ^ 4 evaluate to?


Options are :

  • 81
  • 12
  • 0.75
  • 7 (Correct)

Answer :7

What will be the value of the following Python expression?


Options are :

  • 4
  • 7 (Correct)
  • 2
  • 0

Answer :7

Python Certification Exam Preparation Set 30

What is the output of the code shown below?

import math

[str(round(math.pi)) for i in range (1, 6)]


Options are :

  • ['3', '3', '3', '3', '3', '3']
  • ['3.1', '3.14', '3.142', '3.1416', '3.14159', '3.141582']
  • ['3', '3', '3', '3', '3'] (Correct)
  • ['3.1', '3.14', '3.142', '3.1416', '3.14159']

Answer :['3', '3', '3', '3', '3']

Python Certification Exam Preparation Set 3

What is the output of the code shown below?

t=32.00

[round((x-32)*5/9) for x in t]


Options are :

  • [0]
  • 0
  • [0.00]
  • Error (Correct)

Answer :Error

What is the output of the following?

print([i.lower() for i in "HELLO"])


Options are :

  • ['h', 'e', 'l', 'l', 'o']. (Correct)
  • 'hello'
  • ['hello'].
  • hello

Answer :['h', 'e', 'l', 'l', 'o'].

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


Options are :

  • 3
  • 5
  • 25
  • 1 (Correct)

Answer :1

Python Certification Exam Preparation Set 15

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


Options are :

  • [2, 6, 4].
  • [1, 3, 2, 1, 3]
  • [1, 3, 2, 1, 3, 2] . (Correct)
  • [1, 3, 2, 3, 2, 1]

Answer :[1, 3, 2, 1, 3, 2] .

What is the output when the following code is executed ?

"Welcome to Python".split()


Options are :

  • ["Welcome", "to", "Python"]. (Correct)
  • ("Welcome", "to", "Python")
  • {"Welcome", "to", "Python"}
  • "Welcome", "to", "Python"

Answer :["Welcome", "to", "Python"].

What will be the output?

names1 = ['Amir', 'Bala', 'Charlie']

names2 = [name.lower() for name in names1]

print(names2[2][0])


Options are :

  • None
  • a
  • b
  • c (Correct)

Answer :c

Python Practice Test MCQ Certified Go from 0 to Expert hero Set 30

What will be the output?

values = [[3, 4, 5, 1], [33, 6, 1, 2]]

v = values[0][0]

for lst in values:

for element in lst:

if v > element:

v = element


print(v)


Options are :

  • 1 (Correct)
  • 3
  • 5
  • 6

Answer :1

What is the output of the following code?

import copy

a=[10,23,56,[78]]

b=copy.deepcopy(a)

a[3][0]=95

a[1]=34

print(b)


Options are :

  • [10,34,56,[95]].
  • [10,23,56,[78]]. (Correct)
  • [10,23,56,[95]].
  • [10,34,56,[78]].

Answer :[10,23,56,[78]].

What is the output of the following piece of code?

a=list((45,)*4)

print((45)*4)

print(a)


Options are :

  • 180[(45),(45),(45),(45)].
  • (45,45,45,45).[45,45,45,45].
  • 180[45,45,45,45]. (Correct)
  • Syntax error

Answer :180[45,45,45,45].

Python Certification Exam Preparation Set 22

What is the output of the code shown below?


A = [[1, 2, 3],

[4, 5, 6],

[7, 8, 9]]

[A[i][len(A)-1-i] for i in range(len(A))]


Options are :

  • [1, 5, 9]
  • [4, 5, 6]
  • [3, 5, 7] (Correct)
  • [2, 5, 8]

Answer :[3, 5, 7]

What is the output of the expression?


round(4.5676,2)?


Options are :

  • 4.5
  • 4.6
  • 4.57 (Correct)
  • 4.56

Answer :4.57

What is the output of the functions shown below?

divmod(10.5,5)

divmod(2.4,1.2)


Options are :

  • (2.00, 0.50)(2.00, 0.00)
  • (2, 0.5)(2, 0)
  • (2.0, 0.5)(2.0, 0.0) (Correct)
  • (2, 0.5)(2)

Answer :(2.0, 0.5)(2.0, 0.0)

Python Certification Exam Preparation Set 37

What is the output of the function shown below?

hex(15)



Options are :

  • f
  • 0xF
  • 0Xf
  • 0xf (Correct)

Answer :0xf

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions