arrow
arrow
arrow
The variable declared inside the function is called a variable
Question

The variable declared inside the function is called a variable

A.

external

B.

global

C.

local

D.

none of the above

Correct option is C

The correct answer is (c) Local

  • A local variable is a variable that is declared within a function or block and is accessible only within that function or block.

  • Once the function execution is over, the local variable is destroyed and its memory is released.

  • It cannot be accessed from outside the function in which it is defined.

Information Booster:
• Local variables have function scope—valid only inside the function where declared.
• They are created when the function is called and destroyed when the function ends.
• If a variable with the same name is declared globally, the local variable will override it within the function.
• In Python, C, Java, etc., local variables are widely used for encapsulation and to avoid conflicts.
• Using local variables helps in memory optimization and cleaner code design.
Global variables are declared outside all functions and are accessible throughout the program.
External variables usually refer to variables defined in external files (used in C/C++ with extern keyword).

test-prime-package

Access ‘BPSC AE’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
354k+ students have already unlocked exclusive benefits with Test Prime!
test-prime-package

Access ‘BPSC AE’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
354k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow