Python MCQs with Explanation

Why does the name of local variables start with an underscore discouraged?

  1. To identify the variable
  2. It confuses the interpreter
  3. It indicates a private variable of a class
  4. None of these



Answer: 
Option c: It indicates a private variable of a class

Since there is no concept of private variables in Python language, the major underscore is used to denote variables that cannot be accessed from outside the class directly.

Post a Comment

0 Comments