🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित में से कौन सा कथन अंतिम रूप से निष्पादित होगा?

Which of the following statement will execute in last ?

def s(n1): #Statement 1
         print(n1) #Statement 2
n2=4 #Statement 3
s(n2) #Statement 4
A)
B)
C)
D)

Explanation:

Let's analyze the given code step by step:

def s(n1):   # Statement 1
    print(n1)  # Statement 2
n2 = 4  # Statement 3
s(n2)  # Statement 4

Execution Order:

  1. Statement 1: The function s(n1) is defined. This statement does not execute anything immediately; it only defines the function.
  2. Statement 3: n2 = 4 assigns the value 4 to n2. This is a regular assignment statement.
  3. Statement 4: s(n2) calls the function s() with n2 (which is 4). This triggers the execution of the function, so the next statement to execute is inside the function.
  4. Statement 2: Inside the function, print(n1) is executed, printing the value of n1, which is 4.

Conclusion:

The last statement to be executed is Statement 2, because it's inside the function s() and runs when the function is called in Statement 4.

Answer:

(B) Statement 2

Latest Updates