Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1.Where is a global variable defined? A. Outside a function B. Inside a function

ID: 3558470 • Letter: 1

Question

1.Where is a global variable defined?

      A. Outside a function

      B. Inside a function

      C. Anywhere

      D. In a function header line

2.Where can a local variable be defined?

      A. Outside a function

      B. Inside a function

      C. In a function header line

      D. Both B and C

        

3.Given this code:

int z;

int main( )

{

   int y = 3, x = 2;

   z = x + y;

   return 0;

}

What is the scope of variable z?

      A. local

      B. static

      C. global

      D. none of the above

4.The list of input datatypes and variable names found in the

     function header line is referred to as the function

Explanation / Answer

1.Where is a global variable defined?
      A. Outside a function
2.Where can a local variable be defined?
     B. Inside a function
3.Given this code:
int z;
int main( )
{
   int y = 3, x = 2;
   z = x + y;
   return 0;
}
What is the scope of variable z?
      A. local   
4.The list of input datatypes and variable names found in the function header line is referred to as the function