Consider the following program with only the variable declarations shown. For ea
ID: 3737503 • Letter: C
Question
Consider the following program with only the variable declarations shown. For each statement below, specify whether it is true or false and explain why.
int x;
void alpha(int a){
int b;
}
void beta() {
static int k;
}
void gamma(int x) {
}
int main(){
int x, y, z;
{
int y, z;
}
}
1. Function alpha can access the external variable x
2. Function main has access to the static variable k declared inside function beta
3. In the inner block of the main function, the block variable y hides the local main variable y
4. Function beta is the only function that can access global variable x
5. In function main, local variable x is not accessible inside the inner block
Explanation / Answer
here are the answers:
1. Function alpha can access the external variable x
true (since x is global)
2. Function main has access to the static variable k declared inside function beta
False (variable are local to function)
3. In the inner block of the main function, the block variable y hides the local main variable y
True
4. Function beta is the only function that can access global variable x
False
since x is global so all function have access to x
5. In function main, local variable x is not accessible inside the inner block
false.
==============================================================
Kindly Check and Verify Thanks..!!!