What is the expected behavior of the following code?

What is the expected behavior of the following code?

It will:
A. print 0
B. cause a runtime exception
C. prints 3
D. print an empty line

Download Printable PDF. VALID exam to help you PASS.

3 thoughts on “What is the expected behavior of the following code?

  1. The correct answer is B:
    TypeError: unsupported operand type(s) for +: ‘int’ and ‘NoneType’

  2. The correct answer is B. The program, when executed, will cause a runtime exception error.
    1) for the print statement
    2) because you cannot add and integer with a None type

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.