A variable which is declared inside a method is called a________variable

  1. Serial

  2. Local

  3. Private

  4. Static


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of variable scope in programming.

Option A) Serial - This option is incorrect because "serial" is not a term used to describe a variable declared inside a method.

Option B) Local - This option is correct because a variable declared inside a method is called a local variable. Local variables are only accessible within the method in which they are declared.

Option C) Private - This option is incorrect because "private" is a term used to describe the visibility of class members, not variables declared inside a method.

Option D) Static - This option is incorrect because "static" is a term used to describe variables that belong to the class itself, rather than instances of the class.

The correct answer is B) Local. This option is correct because a variable declared inside a method is indeed called a local variable.

Find more quizzes: