Test Index

Functions in Python Get it on Google PlayDownload on the App Store CBSE Board Videos

© examsnet.com
Question : 18 of 23
Marks: +1, -0
Questions No. 17 and 18 are Assertion and Reason type questions. Each question consists of two statements, namely, Assertion (A) and Reason (R). Select the most suitable option considering the Assertion and Reason.
Assertion (A): Global variables are accessible in the whole program.
Reason (R): Local variables are accessible only within a function or block in which it is declared.
[CBSE 2024 Compartment]
Solution:  
Concept:
In an Assertion-Reason question, first check each statement on its own, then ask whether the Reason really explains why the Assertion is true.
Explanation:
Assertion: A global variable is created outside all functions, so it can be read anywhere in the program, inside or outside functions. True.
Reason: A local variable is created inside a function (or block) and exists only there. True.
The Reason describes the scope of local variables; it does not explain why global variables are accessible everywhere. Both are true, but R is not the correct explanation of A.
Answer:
Option B (Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of Assertion (A).)
© examsnet.com
Advertisements
Go to Question: