Q. What happens if a local variable exists with the same name as the global variable you want to access?

  • (A) error
  • (B) the local variable is shadowed
  • (C) undefined behavior
  • (D) the global variable is shadowed
πŸ’¬ Discuss
βœ… Correct Answer: (D) the global variable is shadowed
Explanation: if a local variable exists with the same name as the local variable that you want to access, then the global variable is shadowed. that is, preference is given to the local variable.

Explanation by: Mr. Dubey
if a local variable exists with the same name as the local variable that you want to access, then the global variable is shadowed. that is, preference is given to the local variable.

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
958
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
84%
Success Rate