CBSE Class 12 Computer Science Question 33 of 103

Working with Functions — Question 9

Back to all questions
9
Question

Question 9

Which of the following is not correct in context of scope of variables ?

  1. Global keyword is used to change value of a global variable in a local scope.
  2. Local keyword is used to change value of a local variable in a global scope.
  3. Global variables can be accessed without using the global keyword in a local scope.
  4. Local variables cannot be used outside its scope.
Answer

Local keyword is used to change value of a local variable in a global scope.

Reason — If you need to modify a local variable in global scope, you do so by passing it as an argument to a function and/or returning a modified value from the function.