Skip to content
Question

Q.Consider the statements given below and then choose the correct output from the given options: def Change(N): N=N+10 print(N,end='′)N=15Change(N)print(N)(A)25') N=15 Change(N) print(N) (A) 2515 (B) 1525(C)2525 (C) 2525 (D) 2525$$

CBSECBSE Class XII Board 2025MCQ· 1mImportance★★★★★
🔒 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 →

The function modifies its own copy of the variable, but the original variable outside remains unchanged — so the output is 25$$15. This question tests your understanding of how Python handles function arguments. When you pass a variable to a function, what exactly gets passed? The answer depends on whether the data type is mutable or immutable. Here, the variable N holds an integer — and integers are immutable in Python. Let’s walk through the code step by step. The function Change(N) receives the value of N (which is 15 at the time of the call). Inside the function, the statement N = N + 10 creates a new local variable also named N, now holding 25. This does not affect the original N defined outside the function. The function then prints 25 followed by $$ (because end='$$' suppresses the usual newline and adds $$ instead).

After the function finishes, control returns to the main program. The next line print(N) prints the original N, which is still 15. Since the previous print ended with $$ and no newline, the output appears as 25$$15 on the same line.

Note

This behaviour is often called “pass by value” for immutable types like integers, strings, and tuples. The function gets a copy of the reference, but since the object cannot be changed, any reassignment inside the function only affects the local copy.

Now look at the options: …

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.