Python Certification Exam Preparation Set 11

What is the type of inf?


Options are :

  • Integer
  • Boolean
  • Complex
  • Float (Correct)

Answer :Float

What data type is the object below ?


L = [1, 23, 'hello', 1].


Options are :

  • array
  • tuple
  • list (Correct)
  • dictionary

Answer :list

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

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

Answer :float('12+34?)

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)

Answer :'3\'

Python Certification Exam Preparation Set 21

Which one of these is floor division?


Options are :

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

Answer ://

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


Options are :

  • Addition
  • Multiplication
  • Parentheses (Correct)
  • Multiplication

Answer :Parentheses

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']

Answer :['My', 'name', 'is', 'ARK']

Python Certification Exam Preparation Set 20

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


Options are :

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

Answer :Arbitrary

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)

Answer :Membership operators

Python Certification Exam Preparation Set 34

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


Options are :

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

Answer :TypeError

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


Options are :

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

Answer :"\"

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


Options are :

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

Answer :4,1

Python Certification Exam Preparation Set 2

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

Answer :divmod()

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


Options are :

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

Answer :UTF-8

Operator '//' is for:


Options are :

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

Answer :Floor division

Python Certification Exam Preparation Set 26

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]

Answer :[False, True]

Python supports how many different Numeric Types?


Options are :

  • 3 (Correct)
  • 2
  • 4
  • 6

Answer :3

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__

Answer :sys.float_info

Python Certification Exam Preparation Set 36

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


Options are :

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

Answer :1\newline2\newline3

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

Answer :TRUE

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

In Python3, Result of Integer division is always rounded towards


Options are :

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

Answer :Negative Infinity

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)

Answer :TRUE

Python allows Multiple Assignment.


Options are :

  • FALSE
  • TRUE (Correct)

Answer :TRUE

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

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

Answer :excluding 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

Answer :0011 0001

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

Answer :pass statement

Python Certification Exam Preparation Set 61

{c**=a } equals


Options are :

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

Answer :c=c**a

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions