Python Certification Exam Preparation Set 15

34. Choose the correct output of the following code:-


Options are :

  • [2.0, 4.0, 8.0] (Correct)
  • [2, 4, 8]
  • [1,1,2,4,5,7,8]
  • [1,2,4,5,7,8]

Answer :[2.0, 4.0, 8.0]

Python Certification Exam Preparation Set 62

35. Choose the correct output of the following code:-


Options are :

  • 10
  • 11
  • 12
  • Error (Correct)

Answer :Error

36. Choose the correct output of the following code:-


Options are :

  • Status: True
  • Status: False
  • Error (Correct)

Answer :Error

37. Choose the correct statement regarding the dictionary.


Options are :

  • Dictionary key-value pairs can be accessed using dictionary keys (Correct)
  • Dictionary key-value pairs can be accessed using dictionary values
  • Dictionary can hold or store more than one key-value pair with same keys after the code is executed
  • Dictionary can hold or store more than one key-value pair with the same values after the code is executed (Correct)
  • Dictionaries are mutable (Correct)

Answer :Dictionary key-value pairs can be accessed using dictionary keys Dictionary can hold or store more than one key-value pair with the same values after the code is executed Dictionaries are mutable

Python Certification Exam Preparation Set 31

39. In python, the identifiers are case sensitive or not.


Options are :

  • Yes (Correct)
  • No

Answer :Yes

40. Choose the correct output of the following code:-


Options are :

  • ValueError
  • TypeError (Correct)
  • SyntaxError
  • 120

Answer :TypeError

What will be the output of the following Python code?


Options are :

  • The program runs properly and prints 45 (Correct)
  • The program has an error because the value of members of a class can't be changed from outside the class
  • The program runs properly and prints 1
  • The program has an error because the value of members outside a class can only be changed as self.a=45

Answer :The program runs properly and prints 45

Python Certification Exam Preparation Set 56

Which function overloads the + operator?


Options are :

  • none
  • __add__() (Correct)
  • __plus__()
  • __sum__()

Answer :__add__()

What will be the output of the following Python code?


Options are :

  • The program runs fine and 1 is printed (Correct)
  • The program has an error because b is private and display(self) is returning a private member
  • The program has an error as you can't name a class member using __b
  • The program has an error because there isn't any function to return self.a

Answer :The program runs fine and 1 is printed

What is Instantiation in terms of OOP terminology?


Options are :

  • Copying an instance of class
  • Deleting an instance of class
  • Creating an instance of class (Correct)
  • Modifying an instance of class

Answer :Creating an instance of class

Python Certification Exam Preparation Set 39

Which of these is a private data field?


Options are :

  • __d__
  • __b (Correct)
  • __c__
  • __a

Answer :__b

What is delattr(obj,name) used for?


Options are :

  • To check if an attribute is deleted or not
  • To delete an attribute (Correct)
  • To set an attribute
  • To print deleted attribute

Answer :To delete an attribute

What will be the output of the following Python code?


Options are :

  • Nothing is printed
  • __repr__ called (Correct)
  • __str__ called
  • Error

Answer :__repr__ called

Python Certification Exam Preparation Set 3

What will be the output of the following Python code?


Options are :

  • Exception is thrown
  • __main__
  • Base class for all students (Correct)
  • Nothing is displayed

Answer :Base class for all students

Methods of a class that provide access to private members of the class are called as ______ and ______


Options are :

  • __init__/__del__
  • user-defined functions/in-built functions
  • __repr__/__str__
  • getters/setters (Correct)

Answer :getters/setters

What will be the output of the following Python code?


Options are :

  • NameError
  • ImportError
  • ValueError (Correct)
  • TypeError

Answer :ValueError

Python Certification Exam Preparation Set 32

How many except statements can a try-except block have?


Options are :

  • zero
  • more than one
  • more than zero (Correct)
  • one

Answer :more than zero

_____ represents an entity in the real world with its identity and behaviour.


Options are :

  • An object (Correct)
  • A class
  • An operator
  • A method

Answer :An object

What will be the output of the following Python code?

a) No output
b)

c)



Options are :

  • a
  • b (Correct)
  • c

Answer :b

Python Certification Exam Preparation Set 3

The error displayed in the following Python code is?


Options are :

  • 'list' object is iterator
  • 'list' object is not iterator
  • 'tuple' object is not iterator (Correct)
  • 'tuple' object is iterator

Answer :'tuple' object is not iterator

Which of the following is not a type of inheritance?


Options are :

  • Multi-level
  • Multiple
  • Single-level
  • Double-level (Correct)

Answer :Double-level

What happens if the file is not found in the following Python code?


Options are :

  • Assertion error
  • Name error
  • No error (Correct)
  • Input output error

Answer :No error

Python Certification Exam Preparation Set 21

What will be the output of the following Python code?


Options are :

  • [1, 2, 3, 4, 5, 6, 7, 8]
  • [1, 2, 3, 4, 5]
  • [0, 1, 2, 3, 4, 5, 6, 7]
  • [0, 1, 2, 3, 4] (Correct)

Answer :[0, 1, 2, 3, 4]

Which of the following statements is true?


Options are :

  • A non-private method in a superclass can be overridden (Correct)
  • A subclass method can be overridden by the superclass
  • A private method in a superclass can be overridden
  • Overriding isn't possible in Python

Answer :A non-private method in a superclass can be overridden

Which of the following statements is wrong about inheritance?


Options are :

  • Protected members of a class can be inherited
  • The inheriting class is called a subclass
  • Private members of a class can be inherited and accessed (Correct)
  • Inheritance is one of the features of OOP

Answer :Private members of a class can be inherited and accessed

Python Certification Exam Preparation Set 7

Is the following Python code valid?


Options are :

  • Yes, this method of calling is called unbounded method call (Correct)
  • It isn't as the object declaration isn't right
  • Yes, this method of calling is called bounded method call
  • It isn't as there isn't any __init__ method for initializing class members

Answer :Yes, this method of calling is called unbounded method call

What will be the output of the following Python code?


Options are :

  • none of the mentioned
  • someError has occurred
  • invalid code (Correct)
  • someError has not occurred

Answer :invalid code

What will be the output of the following Python code?


Options are :

  • class <'loop'>
  • class <'generator'> (Correct)
  • class <'range'>
  • class <'iteration'>

Answer :class <'generator'>

Python Certification Exam Preparation Set 20

What will be the output of the following Python code?


Options are :

  • 13 (Correct)
  • 52
  • 60
  • 12

Answer :13

What will be the output of the following Python code?


Options are :

  • Wrong syntax for isinstance() method
  • Invalid method for classes
  • True (Correct)
  • False

Answer :True

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions