Which of the following statements about global variables is true?

A. A global variable is accessible only to the main function.
B. A global variable is declared in the highest-level block in which it is used.
C. If a function contains a local variable with the same name as a global variable, the global variable's name takes precedence within the function.
D. A global variable can have the same name as a variable that is declared locally within the function.
E. All of these are true.


Answer: D. A global variable can have the same name as a variable that is declared locally within the function.

Computer Science & Information Technology

You might also like to view...

To determine the difference between two Instants, use class Duration’s static method ________, which returns a Duration object containing the time difference.

a. difference b. interval c. between d. span

Computer Science & Information Technology

A loop modifier is an expression added to the end of another Ruby statement that causes the execution of that statement as a loop.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

In each pass of the selection sort, the smallest element is selected from the unsorted sublist and exchanged with the element at the end of the unsorted list.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Which documentation technique depicts data relationship in databases?

What will be an ideal response?

Computer Science & Information Technology