Python Certification Exam Preparation Set 6

What is the output of the following code :


Options are :

  • (A) 4.5
  • (B) 4.0
  • (C) 4 (Correct)
  • (D) Error

Answer :(C) 4

Which function overloads the >> operator?


Options are :

  • (A) more()
  • (B) gt()
  • (C) ge()
  • (D) None of the above (Correct)

Answer :(D) None of the above

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

Which operator is overloaded by the or() function?


Options are :

  • (A) ||
  • (B) | (Correct)
  • (C) //
  • (D) /

Answer :(B) |

What is the output of the following program :


Options are :

  • (A) 0 2 1 3 2 4
  • (B) 0 1 2 3 4 5
  • (C) Error (Correct)
  • (D) 1 0 2 4 3 5

Answer :(C) Error

What is the output of the following program :


Options are :

  • (A) dlroW olleH (Correct)
  • (B) Hello Worl
  • (C) d
  • (D) Error

Answer :(A) dlroW olleH

Python Certification Exam Preparation Set 52

Given a function that does not return any value, what value is shown when executed at the shell?


Options are :

  • (A) int
  • (B) bool
  • (C) void
  • (D) None (Correct)

Answer :(D) None

Which module in Python supports regular expressions?


Options are :

  • (A) re (Correct)
  • (B) regex
  • (C) pyregex
  • (D) None of the above

Answer :(A) re

What is the output of the following program :


Options are :

  • (A) True
  • (B) False (Correct)
  • (C) Machine dependent
  • (D) Error

Answer :(B) False

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

Which of the following is not a complex number?


Options are :

  • (A) k = 2 + 3j
  • (B) k = complex(2, 3)
  • (C) k = 2 + 3l (Correct)
  • (D) k = 2 + 3J

Answer :(C) k = 2 + 3l

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


Options are :

  • (A) +5 (Correct)
  • (B) -11
  • (C) +11
  • (D) -5

Answer :(A) +5

What is the output of the following program :


Options are :

  • (A) 0.33
  • (B) 0.33%
  • (C) 33.33% (Correct)
  • (D) 33%

Answer :(C) 33.33%

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

What is the output of the following program :


Options are :

  • (A) 0.333333
  • (B) 0.33 (Correct)
  • (C) 0.333333:-2
  • (D) Error

Answer :(B) 0.33

What is the output of the following code? Consider Python 2.7.


Options are :

  • (A) ( 'abcd', 786 , 2.23, 'john', 70.2 )
  • (B) abcd
  • (C) (786, 2.23)
  • (D) None of the above (Correct)

Answer :(D) None of the above

What is the output of the following program :


Options are :

  • (A) 8
  • (B) 16
  • (C) Indentation Error (Correct)
  • (D) Runtime Error

Answer :(C) Indentation Error

Python Certification Exam Preparation Set 30

What is the output of the expression : 3*1**3


Options are :

  • (A) 27
  • (B) 9
  • (C) 3 (Correct)
  • (D) 1

Answer :(C) 3

Which python module specializes in handling directories ?


Options are :

  • dir
  • file
  • sys
  • os (Correct)

Answer :os

Python Certification Exam Preparation Set 25

To open a file for both [reading and writing],[writing and reading] and [appending and reading], which file modes should be used ?


Options are :

  • rb,wb,ab
  • r,w,a
  • rb+,wb+,ab+
  • r+,w+,a+ (Correct)

Answer :r+,w+,a+

Python Class supports Inheritance?


Options are :

  • NO
  • YES (Correct)

Answer :YES

Which of following are features provided by python to handle all types of unexpected errors ?


Options are :

  • Both (Correct)
  • Assertions
  • Error Handling
  • None of these

Answer :Both

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

To open a file for reading, writing, appending only in binary format, which file modes should be used ?


Options are :

  • r+,w+,a+
  • rb,wb,ab (Correct)
  • rb+,wb+,ab+
  • r,w,a

Answer :rb,wb,ab

To use python source file as a module, you need to execute which statement in your current python source file ?


Options are :

  • import (Correct)
  • include
  • locate
  • Using

Answer :import

If you have some suspicious code that may raise an exception, you can defend your program by placing the suspicious code in


Options are :

  • try…expect…finally
  • try…catch…else
  • try…catch…finally
  • try…expect…else (Correct)

Answer :try…expect…else

Python Certification Exam Preparation Set 36

The python code for a module named "ark" would normally resides in


Options are :

  • module_ark.py
  • ark.py (Correct)
  • folder named "ark"
  • ark.ipy

Answer :ark.py

The Class Constructor in Python is sepcial function:


Options are :

  • None of these
  • __init__ (Correct)
  • __main__
  • __cons__
  • __ClassName__

Answer :__init__

Hidden class objects can be accessed by prefixing the class objec name by


Options are :

  • show_
  • className_ (Correct)
  • single underscore (_)
  • _ClassName

Answer :className_

Python Certification Exam Preparation Set 45

Using which statement, In Python, you can import specific attributes from a module into current namespace?


Options are :

  • from…import (Correct)
  • inside…import
  • in…import
  • None of these

Answer :from…import

If globals() is called from within a function, it will return all the names that can be accessed


Options are :

  • locally from that function
  • globally from that function (Correct)
  • globally from any where
  • locally from anywhere

Answer :globally from that function

When an index is not found in a sequence which error is raised ?


Options are :

  • IndexError (Correct)
  • SeqError
  • SyntaxError
  • KeyError

Answer :IndexError

Python Certification Exam Preparation Set 34

If locals() is called from within a function, it will return all the names that can be accessed


Options are :

  • locally from that function (Correct)
  • locally from anywhere
  • globally from that function
  • globally from any where

Answer :locally from that function

Object-Orientation was introduced in which Python version?


Options are :

  • None of these (Correct)
  • 2.6
  • 3
  • 1.4

Answer :None of these

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions