Skip to content
Programs · Program 7-11

Q.Program 7-11: Program to understand the low of execution using functions.

Sikkim CbseNCERTSubjective· 2mImportance★★★★★est
33% · 13/40 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Program 7-11 ("low" is a misprint for flow of execution) shows that def blocks are only remembered, not run — execution starts at the first top-level statement, dives into a function at each call, and resumes right after the call on return.

The idea. Python executes a program top to bottom, but a function's body is skipped at definition time. Control enters the body only at a call, and when the function ends, control returns to the point just after the call — even through nested calls (func2 calling func1). Print statements at each landmark make the route visible.

# Program 7-11: understanding the flow of execution using functions

def func1():
    print("Inside func1")

def func2():
    print("Inside func2 - calling func1")
    func1()
    print("Back inside func2")

print("Program execution starts")
func2()
print("Program execution ends")

Step-by-step trace

StepWhat executesPrinted
1def func1 / def func2 are read and stored — bodies NOT run(nothing)
2first top-level printProgram execution starts
3call func2() → its first lineInside func2 - calling func1
4func2 calls func1() → its bodyInside func1
5func1 returns → next line of func2Back inside func2
6func2 returns → next top-level lineProgram execution ends

Expected output

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.