The question statement is true that it is not considered good programming practice to declare all your variables globally in the program or code.
It is not considered a good programming practice to declare all the variables globally. Global variables are accessible and changeable by any function of the program. Thus, declaring all the variables globally creates a high chance of the data getting corrupted.
Any change in the values of the global variables, either is done by mistake or is the result of some other action, propagates to the whole program. In turn, that can lead to unexpected program behavior.
Consider a scenario where all data about bank balance is stored in a global variable. Storing this crucial data in a global variable makes a hin-ge to security of the data. As it can easily be accessed and modified by any function in the entire program.
Thus, it is highly recommended to use local variables with the exception of using a global variable only when there is an absolute need.
You can learn more about good programming practice at
https://brainly.com/question/14277907
#SPJ4