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

Lifetime 1) During foo) call 2) Entire Program 3) During func20 call C/C++ Progr

ID: 3744280 • Letter: L

Question

Lifetime 1) During foo) call 2) Entire Program 3) During func20 call C/C++ Program Par 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 cope/Visibili WW) Within func20 Only XX) Just This Source Module YY) Within foo0 Only ZZ) Entire Program C/C++ Program Par Lifetime #include #define SIZE 17 int func2 char array static long johns; double ch = 4.20; void (entire 1ine) Eoo char ch) (ch) int actor; static int answeri Other code here static int func2 char fu (func2i...1) (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 symbol/name johns refers to which symbol/name (state the type)? time(s) time(s) time(s)

Explanation / Answer

There are total 7 Questions asked in the question.Please find the answers with the explanations.

ans1 : We have declared a non static varialbe inside static method inside static method func2() , so answer will be 6 time. Everytime if will get initialize.

ans2:Static variable by default initialize with value 0. So answer will be 0.

ans 3: Static variables initializes only once in a program. So answer will be 1 time.

ans 4: non static variable takes some garbage value initially so answer will be some garbage value.

ans 5:Static variables initializes only once in a program. So answer will be 1 time.

ans 6:johns is declared with a state of static variable .That can be insitialize only once in a program with a long value type.

ans 7:johns is declared with a state of static variable inside func2 function.That can be insitialize only once in a program with a char value type.

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