Question-101: If you run below code snippet and for each invocation, you are inserting ‘Hadoop’ as input, what would happen

counter=0

while True:

    word = input("enter any English word you can think of ")

    if word.startswith("h"):

        counter=counter+1

        print("!!!!!!!This is your " , counter, " chance!!!!!!!!!!")

        if counter==3:

            print("!!!!!!!This WAS YOUR LAST CHANCE, YOU NEED TO EXIT!!!!!!!!!!")

            break

        continue;

   

    print("You are still in...")

 

 

  1. Program would exit after 3 times you enter word Hadoop.
  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: D

Exp:  Program would increment counter by 1 only if you enter a word starting with ‘h’ small case.

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