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

Analyzel Trace The Code The following are sample multiple choice questions you m

ID: 3808291 • Letter: A

Question

Analyzel Trace The Code The following are sample multiple choice questions you may use to study for the test. To check your work, write the code and run it! 1. What is the printout of the following switch statement? cha 'b' switch (upper(ch)) case 'A' disp(ch). case 'B disp(ch); case 'C' disp(ch); case 'D disp(ch); end a. abcd b. abc c. bcd e, none of the above 2. What is the output of the following fragment? for (i 0: 15) if (mod(i,4) 1) fprintf( %d ",i); end end a. 1 3 5 7 9 11 13 15 b. 1 3 5 7 9 11 13 c. 15913 d. 1 4 8 12 e. 159 13 16 3. A continue statement can be used only in a loop. A. true B. false 4. A break statement can be used only in a loop. A, true B. false

Explanation / Answer

Ans1) e is the correct option because switch(upper(ch) is used which will be give B as the output of the above code.

Ans2) C is the correct option,i.e 1,5,9,13 because only these 1 mod 4,5 mod 4,9 mod 4,13 mod 4 having value 1.

Ans 3) True.

A continue statement can only be used in loop.

Ans 4) False.

A break statement can be used with switch statement also.

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