Question-158: Which of the following statement is correct for below code snippet?

def totalSalary(salary,hike, bonus=10000):           #line 1

    total=salary + (salary *hike)/100 + bonus #line 2

    return total #line 3

    print("!!!!Done with total Salary calculation") #line 4

 

  1. Line 2 never be executed, when this function is called.
  2. Get all Questions and Answer from here
  3. You need to have paid subscription to access all questions
  4. Thanks for considering Python Certification Material

 

Answer: C

Exp:

Not reachable lines

  • Lines after return statement would never be reached.

Lines after return statement will never be reached.

#Defining a function with two parameters

def totalSalary(salary,hike, bonus=10000):

    total=salary + (salary *hike)/100 + bonus

    return total

    #Below line never be reached.

    print("!!!!Done with total Salary calculation")

 

i=0

while(i<10):

   

You can access to full explanation to question and answer from this page.

Why Dont you prepare for Python Certifications and Interview Questions with 250+ Questions and Answer : Check Here

Real Exam Number of Questions: 70 Questions
Real Exam Pass Score: 70%
Time Allotted: 90 minutes to complete exam