C101 Laboratory Session #8 solved

$35.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

Lab Goals: 1) Learning how to hand trace through a program. 2) Learning how to use the IDE debugger with Microsoft visual C++. For the following lab you will need to copy the file “lab8.cpp” from my website. This lab has two parts; the first part is to hand trace through the attached program and answer the questions about it. The second part is to use the built in debugger to verify most of your answers and see how helpful the debugger can be in solving logic problems with your program. For more detailed information on the debugger see the given handout on it. #include using namespace std; void Just_Peachy(int A, int B, int & N); void main() { char Ch = ‘A’; int X, Y; X = 4.56; Y = int(Ch); for (int i = 5; i >= 3; i–) { Just_Peachy(i, X, Y); if (char(Y) == ‘E’) Ch = ‘W’; } } /****************************************************/ void Just_Peachy(int A, int B, int & N) { int T, Mod; Mod = A % B; if (Mod == 0) T = 2; else T = 1; N = N + T; } 1) How many reference parameters are there in the Just_Peachy function? ____________ 2) How many value parameters are there in the Just_Peachy function? _______________ 3) How many total local parameters are there in the Just_Peachy function? ___________ 4) What is the initial value of the variable “Y”? ______________________ 5) Before the first call to the function, what is the value of the variable “T”? __________ 6) How many times does the “for” loop execute? ________________ 7) After the first time through the “for” loop what are the values of the following: X ___________ Y ______________ Ch _______________ 8) At the first time in the function and just before you leave it, what is value of “Mod”? _____ 9) For what value of “i”, if any, does the “if” statement come true in the main function? ______ 10) For what value of “i”, if any, will “Mod == 0” in the function? _____________ 11) When the “for” loop is done what are the values of: X _______ Y _______ Ch ________ T ________ N ________ A _______ B ______ 12) What is the ASCII value of ‘E’? ____________