## Python Certification Exam Preparation Set 26

##### In Python Dictionary, keys are case-sensitive:

Options are :

• True (Correct)
• False

##### 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

##### 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

Options are :

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

Options are :

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

##### Which of the following is incorrect?

Options are :

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

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

Options are :

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

Options are :

• 81
• 12
• 0.75
• 7 (Correct)

##### 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)

Options are :

• 1 (Correct)
• 0
• True
• False

##### What will be the output of the following Python statement?`>>>"a"+"bc"`

Options are :

• a
• bc
• bca
• abc (Correct)

Options are :

• a
• ab
• cd (Correct)
• dc

##### 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

Options are :

• olleh
• hello
• h
• o (Correct)

##### What arithmetic operators cannot be used with strings?

Options are :

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

##### What will be the output of the following Python code?`>>>print (r"\nhello")`

Options are :

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

##### What will be the output of the following Python statement?`>>>print('new' 'line')`

Options are :

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

##### What will be the output of the following Python code?`>>>str1="helloworld"``>>>str1[::-1]`

Options are :

• dlrowolleh (Correct)
• hello
• world
• helloworld

Options are :

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

##### What will be the output of the following Python code?`class father:`` def __init__(self, param):`` self.o1 = param`` ``class child(father):`` def __init__(self, param):`` self.o2 = param`` ``>>>obj = child(22)``>>>print "%d %d" % (obj.o1, obj.o2)`

Options are :

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

Options are :

• wo (Correct)
• world
• sn
• rl

##### What will be the output of the following Python code?`>>>example = "snow world"``>>>example[3] = 's'``>>>print example`

Options are :

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

Options are :

• error
• u
• t
• y (Correct)

Options are :

• 2 (Correct)
• 1
• None
• 0

Options are :

• s3 = s1 . s2
• s3 = s1 * s2

Options are :

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

Options are :

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

##### Which of the following commands will create a list?

Options are :

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