  ## Python Certification Exam Preparation Set 11

##### What is the type of inf?

Options are :

• Integer
• Boolean
• Complex
• Float (Correct)

##### What data type is the object below ?L = [1, 23, 'hello', 1].

Options are :

• array
• tuple
• list (Correct)
• dictionary

##### cmp(x, y) returns 1 if x > y, 0 if x == y and -1 if x < y.

Options are :

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

##### Which of the following is not a complex number?

Options are :

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

Answer :k = 2 + 3l

##### Which of the following results in a SyntaxError ?

Options are :

• "'That's okay"'
• "He said, 'Yes!'"
• '"Once upon a time�", she said.'
• '3\' (Correct)

##### Which one of these is floor division?

Options are :

• // (Correct)
• None of the mentioned
• %
• /

##### Which one of the following has the highest precedence in the expression?

Options are :

• Multiplication
• Parentheses (Correct)
• Multiplication

##### What will be the output of {ark="My name is ARK";ark.split()}

Options are :

• Syntax Error; No arguments passed to the split method
• ['My', 'name', 'is', 'ARK'] (Correct)
• ['My name is ARK']

##### How many number of elif statements can be follow an if statement?

Options are :

• 1
• 2
• 2^8
• Arbitrary (Correct)

##### If the else statement is used with a for loop, the else statement is executed

Options are :

• There are no else statements with for loops
• when the loop has exhausted iterating the list (Correct)
• after every interations
• when for loop is not run even once

Answer :when the loop has exhausted iterating the list

##### Python Opearator 'in' and 'not in' are

Options are :

• Identity Operators
• Find Operators
• Logical Operatos
• Membership operators (Correct)

##### If {a=None} then output of {~a} will be

Options are :

• None
• Inf
• TypeError (Correct)
• None of these

##### What will be the output of {print("\\")}

Options are :

• Empty String
• "\\"
• "\" (Correct)
• SyntaxError: EOL while scanning string literal

##### If {a=2} then {a<<1}and {a>>1} results in

Options are :

• 4,4
• 1,1
• 1,4
• 4,1 (Correct)

##### In Python3, to find division and mod simultaneously which funcion you would use ?

Options are :

• Willl have to write own function
• divmod() (Correct)
• moddiv()
• dividemod()

##### Since Python 3, the default encoding for python source soce is

Options are :

• UTF-8 (Correct)
• UTF-32
• UTF-64
• UTF-16

##### Operator '//' is for:

Options are :

• float division
• Division
• None of these
• Floor division (Correct)

##### What is the output of following code {list1= ['1','2'];list2= ['4','5'];list=list1+list2;['3' in list,'3' not in list]

Options are :

• [False, False]
• [True, False]
• [False, True] (Correct)
• [True, True]

Options are :

• 3 (Correct)
• 2
• 4
• 6

##### Information about the precision and internal representation of floating point numbers for the machine on which your program is running is available in

Options are :

• os.float_info
• None of these
• sys.float_info (Correct)
• float.__doc__

##### Output of {[print(a) for a in [1,2,3]} is

Options are :

• 1\newline2\newline3 (Correct)
• 1\newline1\newline1
• 123
• Syntax Error

##### What will be the contents of String ark after this line of code: {ark = "My name is %s and my weight is %d" % ('ARK', 65)}

Options are :

• "My name is %s and my weight is %d ARK 65"
• SyntaxError
• "My name is %s and my weight is %d"
• "My name is ARK and my weight is 65" (Correct)

Answer :"My name is ARK and my weight is 65"

##### Python supports to have an else statement associated with a loop statement.

Options are :

• TRUE (Correct)
• FALSE

##### In Python3, Result of Integer division is always rounded towards

Options are :

• Positive Infinity
• Negative Infinity (Correct)
• Zero
• Nearest Integer Value

##### If the suite of an if clause consists only of a single line, it may go on the same line as the header statement.

Options are :

• FALSE
• TRUE (Correct)

##### Python allows Multiple Assignment.

Options are :

• FALSE
• TRUE (Correct)

##### bit_length() method on an integer Return the number of bits necessary to represent an integer in binary,

Options are :

• including the sign but excluding zeros
• excluding the sign and leading zeros (Correct)
• excluding the sign but leading zeros
• including the sign and leading zeros

##### Let's say value of "a" is 60 and value of "b" is 13; There crossponding binary values are "00111100" and "00001101" respectively. What will be the binary value of "a^b" ?

Options are :

• 0000 1100
• 1100 0011
• 0011 0001 (Correct)
• 0011 1101

##### Which statement in loops, is used when a statement is required syntactically but you do not want any command or code to execute.

Options are :

• break statement
• continue statement
• pass statement (Correct)
• None of these

##### {c**=a } equals

Options are :

• c=c*(c*a)
• c*c=a
• c=a**a
• c=c**a (Correct)