Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

D. Refer to the following C program (line numbers given at left), and answer question parts (1) through ( 6 ), below (1) int x=5;

image text in transcribedimage text in transcribed

D. Refer to the following C program (line numbers given at left), and answer question parts (1) through ( 6 ), below (1) int x=5; (2) int. y=3; (3) int z=0; (4) (5) void main ( void) (6) 1 (7) if (x>=1y) (8) if (1z) (9) switch (z)1 (10) case 2 : (11) x=y+2; (12) break; (13) case 1: (14) x=y+1; (15) break; (16) case 0 : (17) x=y+0; (18) break; (19) default: (20) break; (21) ) (22) (23) else (24) x=y+z; (25) =2; (26) ) (1) Which case of the switch statement on line 9 will be executed? i. case0 ii. case 1 iii. case 2 iv. default. (2) What will be the final value of x ? i. 3 ii. 4 iii. 5 iv. 6 v. None of the above (3) What will be the final value of y ? i. 2 ii. 3 iii. 4 iv. 5 (4) What will be the final value of z ? i. 0 ii. 1 iii. 2 iv. 3 v. None of the above (5) If line 8 were changed to if (z++) which case of the switch statement on line 9 would be executed? i. case 0 ii. case 1 iii. case 2 iv. None (6) Suppose the indenting in lines (23)-(26) was modified to be: (23) else (24) x=yz; (25) z 1=2; (26) would the execution of the program be modified ? i. Yes ii. No iii. Can not be determined from program lines (1) - (26)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions