Python Certification Exam Preparation Set 30

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


Options are :

  • The code will raise an error because it does not have except block between try and finally block.
  • Hello
  • End of code
  • Hello End of Code (Correct)

Answer :Hello End of Code

24. Choose the correct output of the following:-


Options are :

  • Calculation inside a function: 36 Calculation outside a function: 36 (Correct)
  • Calculation inside a function: 36 Calculation outside a function: 96
  • Calculation inside a function: 96 Calculation outside a function: 96
  • Error

Answer :Calculation inside a function: 36 Calculation outside a function: 36

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


Options are :

  • 14
  • Error
  • 0
  • 12 (Correct)

Answer :12

Python Certification Exam Preparation Set 22

26. Which among the following operator have the highest precedence?


Options are :

  • <<
  • ** (Correct)
  • |
  • %

Answer :**

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


Options are :

  • Child age is: 30 Parent age is: 55
  • Child age is: 30 Parent age is: 30 (Correct)
  • The code will raise an error because get_parent_age() method can not be called using super.
  • The code will raise an error because get_parent_age() method can not be called using the child class object.

Answer :Child age is: 30 Parent age is: 30

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


Options are :

  • (Correct)

Answer :

Python Certification Exam Preparation Set 21

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


Options are :

  • 6214 (Correct)
  • Error
  • 76
  • 6214

Answer :6214

30. Choose the correct ways to call the constructor explicitly.


Options are :

  • language().__init__() (Correct)
  • language.__init__(language()) (Correct)
  • Constructor can not be called explicitly.

Answer :language().__init__() language.__init__(language())

31. Choose the correct output of the below code:-


Options are :

  • (,) (,) (,, )
  • (None,) (,) (, )
  • (,) (,) (, ,)
  • (,) (,) (, ) (Correct)

Answer :(,) (,) (, )

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

32. Choose the correct statements:-


Options are :

  • The Below code is an example of Single inheritance. class A: pass class B(A): pass (Correct)
  • The Below code is an example of Multiple inheritance. class A: pass class B: pass class C(A,B): pass (Correct)
  • The Below code is an example of Multilevel inheritance. class A: pass class B(A): pass class C(B): pass (Correct)
  • The Below code is an example of Hierarchical inheritance. class A: pass class B(A): pass class C(A): pass (Correct)
  • The Below code is an example of Hybrid Inheritance. class A: pass class B(A): pass class C(A): pass class D(B,C): pass (Correct)

Answer :The Below code is an example of Single inheritance. class A: pass class B(A): pass The Below code is an example of Multiple inheritance. class A: pass class B: pass class C(A,B): pass The Below code is an example of Multilevel inheritance. class A: pass class B(A): pass class C(B): pass The Below code is an example of Hierarchical inheritance. class A: pass class B(A): pass class C(A): pass The Below code is an example of Hybrid Inheritance. class A: pass class B(A): pass class C(A): pass class D(B,C): pass

33. What is the output of the following program, when the below code is executed in python version 3.6?


Options are :

  • audi_r8 :: 320 audi_a4 :: 120 audi_q5 :: 147
  • audi_r8 :: 320 audi_q5 :: 147 audi_a4 :: 120
  • audi_a4 :: 120 audi_q5 :: 147 audi_r8 :: 320
  • All of the above (Correct)

Answer :All of the above

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


Options are :

  • {320, 100, 120, 200} (Correct)
  • {120,320, 100, 200} (Correct)
  • {100, 120, 200, 320} (Correct)
  • {100, 120, 200, 320} (Correct)

Answer :{320, 100, 120, 200} {120,320, 100, 200} {100, 120, 200, 320} {100, 120, 200, 320}

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

35. Fill in the blank so that the below code will print 2 3 .


Options are :

  • super().__init__() (Correct)
  • Parent.__init__(self) (Correct)
  • Parent().__init__(self)
  • Parent().__init__()

Answer :super().__init__() Parent.__init__(self)

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


Options are :

  • O/p: 5.46
  • O/p: 5
  • O/p: 6 (Correct)
  • O/p: 5.5

Answer :O/p: 6

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


Options are :

  • 24
  • Value Error (Correct)
  • Type Error
  • 120

Answer :Value Error

Python Certification Exam Preparation Set 43

38. What is the correct output of the following code:-


Options are :

  • print function prints the address of the object
  • 7
  • Error (Correct)

Answer :Error

39. How many except statements can we put bellow the try block?

Note:- Do not consider the default except block for the calculation.


Options are :

  • only one except block.
  • two except block.
  • As many except block as we want. (Correct)
  • no except block.

Answer :As many except block as we want.

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


Options are :

  • {'name': 'Mia', 'roll_name': 4578, 'Class': 0}
  • {'name': 'Mia', 'roll_name': 4578} (Correct)
  • {'name': 'x', 'roll_name': 'y', 'Class': 'z'}
  • Error

Answer :{'name': 'Mia', 'roll_name': 4578}

Python Certification Exam Preparation Set 60

What will be the output of executing below code?


Options are :

  • 12three
  • 3three
  • 123
  • onetwothree
  • An error is raised (Correct)

Answer :An error is raised

Python Certification Exam Preparation Set 12

Consider below code:

Which of the following statement is true about given code?


Options are :

  • 'Percentage score is 40' is displayed in the output
  • 'Percentage score is 40.0' is displayed in the output
  • Error at Line 1
  • Error at Line 2 (Correct)

Answer :Error at Line 2

Consider below code:

Which of the following statement is true about given code?


Options are :

  • Error is displayed on executing above code
  • Hello*5 is displayed in the output
  • HelloHelloHelloHelloHello is displayed in the output (Correct)
  • Hello5 is displayed in the output

Answer :HelloHelloHelloHelloHello is displayed in the output

Consider below code:

Which of the following statement is true above given code?


Options are :

  • [1, 2][1, 2][1, 2][1, 2][1, 2] is displayed in the output
  • [1, 2, 1, 2, 1, 2, 1, 2, 1, 2] is displayed in the output (Correct)
  • [5, 10] is displayed in the output
  • Error is displayed on executing above code

Answer :[1, 2, 1, 2, 1, 2, 1, 2, 1, 2] is displayed in the output

Python Certification Exam Preparation Set 64

Given:


On execution above code, following prompt is displayed to the user:

Enter any number between 1 and 10:


What will be the output if use enters 3?


Options are :

  • HiHiHi
  • Hi3
  • 3Hi
  • An error is raised by Line 3 (Correct)

Answer :An error is raised by Line 3

What will be the output of executing a python file containing below code?


Options are :

  • 2
  • 2.0 (Correct)
  • 0
  • 0.0

Answer :2.0

What will be the output of executing below code?


Options are :

  • [1, 2, 3, 4] (Correct)
  • [4, 6]
  • [[1, 2], [3, 4]]
  • Line 3 causes error during execution

Answer :[1, 2, 3, 4]

Python Certification Exam Preparation Set 64

Given:

What is the result?


Options are :

  • (3, 6, 9)
  • [3, 6, 9]
  • (1, 2, 3, 1, 2, 3, 1, 2, 3) (Correct)
  • [1, 2, 3, 1, 2, 3, 1, 2, 3]
  • ((1, 2, 3), (1, 2, 3), (1, 2, 3))
  • [(1, 2, 3), (1, 2, 3), (1, 2, 3)]

Answer :(1, 2, 3, 1, 2, 3, 1, 2, 3)

Given the code fragment:

What is the result?


Options are :

  • [["1", "one"], ["2", "two"]]
  • [["1", "ONE"], ["2", "two"]] (Correct)
  • [["1", "one"], ["3", "THREE"]]
  • [["1", "ONE"], ["3", "THREE"]]

Answer :[["1", "ONE"], ["2", "two"]]

Given the code fragment:

What is the result?


Options are :

  • (1, 2, 3, 4)
  • (5, 6, 7)
  • (1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3)
  • An error is raised during execution (Correct)

Answer :An error is raised during execution

Python Certification Exam Preparation Set 6

Given the code fragment:

What is the result?


Options are :

  • 1 2 3
  • 4 2 3 (Correct)
  • An error is raised by Line 1
  • An error is raised by Line 2

Answer :4 2 3

Given the code fragment:

What is the result?


Options are :

  • [5, 5, 5]
  • 45
  • 15 (Correct)
  • An error is raised by Line 1

Answer :15

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions