Question 22
#include \"stdio.h\"
void foo(void)
{
static int staticVar;
staticVar++;
printf(\"foo: %d\\n\",staticVar);
}
void bar(void)
{
static int staticVar;
staticVar++;
printf(\"bar: %d\\n\",staticVar);
}
int main()
{
foo(), bar(), foo();
return 0;
}
Question 24
main() { inc(); inc(); inc(); } inc() { static int x; printf("%d", ++x); }
Question 25
Question 26
Consider the following pseudocode:
x : integer := 1 y : integer := 2 procedure add x := x + y procedure second (P: procedure) x : integer := 2 P() procedure first y : integer := 3 second(add) first() write_integer (x)
What does it print if the language uses dynamic scoping with deepbinding?
Question 28
What is the output of the following program?
#include int tmp=20; main( ) { printf("%d ",tmp); func( ); printf("%d ",tmp); } func( ) { static int tmp=10; printf("%d ",tmp); }
Question 29
If only one memory location is to be reserved for a class variable, no matter how many objects are instantiated, then the variable should be declared as
There are 31 questions to complete.