Python Certification Exam Preparation Set 26

In Python Dictionary, keys are case-sensitive:


Options are :

  • True (Correct)
  • False

Answer :True

What does the method items() returns in Python Dictionary?


Options are :

  • The method items() returns the lists
  • The method items() returns the tuples (Correct)
  • The method items() returns the keys in a list
  • The method items() returns the values in a list

Answer :The method items() returns the tuples

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

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

Python Certification Exam Preparation Set 29

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

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


Options are :

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

Answer :+5

Python Certification Exam Preparation Set 4

Which of the following is incorrect?


Options are :

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

Answer :x = 03964

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


Options are :

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

Answer :False

What does 3 ^ 4 evaluate to?


Options are :

  • 81
  • 12
  • 0.75
  • 7 (Correct)

Answer :7

Python Certification Exam Preparation Set 26

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

Which of the following is incorrect?


Options are :

  • float('inf')
  • float('nan')
  • float('56'+'78')
  • float('12+34?) (Correct)

Answer :float('12+34?)

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


Options are :

  • 1 (Correct)
  • 0
  • True
  • False

Answer :1

Python Certification Exam Preparation Set 41

What will be the output of the following Python statement?


Options are :

  • a
  • bc
  • bca
  • abc (Correct)

Answer :abc

What will be the output of the following Python statement?


Options are :

  • a
  • ab
  • cd (Correct)
  • dc

Answer :cd

The output of executing string.ascii_letters can also be achieved by:


Options are :

  • string.ascii_lowercase_string.digits
  • string.ascii_lowercase+string.ascii_upercase (Correct)
  • string.letters
  • string.lowercase_string.upercase

Answer :string.ascii_lowercase+string.ascii_upercase

Python Certification Exam Preparation Set 43

What will be the output of the following Python code?


Options are :

  • olleh
  • hello
  • h
  • o (Correct)

Answer :o

What arithmetic operators cannot be used with strings?


Options are :

  • +
  • *
  • - (Correct)
  • All of the mentioned

Answer :-

What will be the output of the following Python code?


Options are :

  • a new line and hello
  • \nhello (Correct)
  • the letter r and then hello
  • error

Answer :\nhello

Python Certification Exam Preparation Set 46

What will be the output of the following Python statement?


Options are :

  • Error
  • Output equivalent to print 'new\nline'
  • newline (Correct)
  • new line

Answer :newline

What will be the output of the following Python code?


Options are :

  • dlrowolleh (Correct)
  • hello
  • world
  • helloworld

Answer :dlrowolleh

What will be the output of the following Python code?


Options are :

  • 0xA0xB0xC
  • Error
  • 0x22
  • 33 (Correct)

Answer :33

Python Certification Exam Preparation Set 6

What will be the output of the following Python code?


Options are :

  • None None
  • None 22
  • 22 None
  • Error is generated (Correct)

Answer :Error is generated

What will be the output of the following Python code?


Options are :

  • wo (Correct)
  • world
  • sn
  • rl

Answer :wo

What will be the output of the following Python code?


Options are :

  • snow
  • snow world
  • Error (Correct)
  • snos world

Answer :Error

Python Certification Exam Preparation Set 33

What will be the output of the following Python code?


Options are :

  • error
  • u
  • t
  • y (Correct)

Answer :y

Given a string example="hello" what is the output of example.count('l')?   


Options are :

  • 2 (Correct)
  • 1
  • None
  • 0

Answer :2

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


Options are :

  • s3 = s1 . s2
  • s3 = s1.add(s2)
  • s3 = s1.__add__(s2) (Correct)
  • s3 = s1 * s2

Answer :s3 = s1.__add__(s2)

Python Certification Exam Preparation Set 33

What will be the output of the following Python code?


Options are :

  • -1
  • 4 (Correct)
  • 3
  • 1

Answer :4

What will be the output of the following Python code?


Options are :

  • Error
  • -1
  • 1 (Correct)
  • 0

Answer :1

Which of the following commands will create a list? 


Options are :

  • list1 = list()
  • list1 = []
  • list1 = list([1, 2, 3])
  • all of the mentioned (Correct)

Answer :all of the mentioned

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

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions