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

C/C++ Program Part A) C Preprocessor Directive B) External Static Variable C) Fu

ID: 3744256 • Letter: C

Question

C/C++ Program Part A) C Preprocessor Directive B) External Static Variable C) Function Prototype D) Function Definition E) (Formal) Parameter F) Internal Static Variable G) Local Variable H) Global Variable Lifetime 1) During foo0 call 2) Entire Program 3) During func20 call Scope/Visibilit WW) Within func20 Only XX) Just This Source Module YY) Within foo) Only ZZ) Entire Program C/C++ Program Part Lifetime Scope/Visibili #include ide fine SIZE 17 int func2 char array static long johns; double ch = 4.20; void (entire line) foo ( char ch) (ch) int actor; static int answer; /Other code here / static int func2( char fubar) (func2 ...]) (fubar)_ int result- 19; static char johns'A; /* Other code here / How many times is the variable result in func20 initialized to 19 if func20 is called 6 times? What is the initial value of the variable answer in foo0? How many times is the variable answer in foo0 given this value if foo0 is called 6 times? What is the initial value of the variable actor in foo0? How many times is the variable johns in func20 initialized if func20 is called 6 times? Code in foo0 that refers to the symbol/name johns refers to which symbol/name (state the type)? Code in func20 that refers to the symboVname iohns refers to which symboVname (state the type)? time(s) time(s) time(s)

Explanation / Answer

                C/C++ Program Part       Lifetime       Scope/Visibility

#include<stdio.h>       A) C preprocessor directive              
# define SIZE 17       H) Global variable
int func2(char array[]);   C) Function Prototype
static long johns;       B) External static variable   2) Entire Program   ZZ) Entire Program
double ch=4.20;           H) Global variable       2) Entire Program   ZZ) Entire Program
void foo(char ch)         D) Function definition
{
       (ch)       E) Formal parameter       1)During foo()call   YY) within Foo only          
   int actor;       G) Local variable       1)During foo()call   YY) within Foo only
   static int answer;   F) Internal static variable   2) Entire Program   YY) within Foo only

}
static int
func2(char fubar[])       D) Function definition       2) Entire Program  
{

       (fubar)       E) Formal parameter       1)During func2()call   WW)within Func2() only
   int result=19;       G) Local variable       1)During func2()call   WW)within Func2() only

   static char johns='A';   F) Internal static variable   2) Entire Program   WW)within Func2() only
}

1) How many times Result in func2() initialized to 19 if func2() is called 6 times ?   6 times

2) What is initial value of the variable answer in foo()?    0

3) How many times answer in foo() given this value if f00() is called 6 times ?   6 times

4)what is initial value of actor in foo()? garbage value

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote