What value will the memory location alt contain after the following set of state
ID: 3858643 • Letter: W
Question
What value will the memory location alt contain after the following set of statements is executed? int alt = 650: if(alt > 0) if(alt > =1000) alt=0: else alt = 10*alt else alt = 3 + alt: 653 1300 0 6500 Which type of conditional statement should be used to print a warning message based on an event detected by an automotive computer? There are 25 events and each has a specific set of actions that must be taken. if if/else switch change Give the value of time after the following set of statements is executed. int time = 700: if(time > 0) { if(time > 500) time=2*time: else time= 10*time } } else time = 3 + time: 0 700 1400 7000Explanation / Answer
Question 9
1300
Explaination :
alt = 650
if(alt> 0) is true so true block of if is executed, if(alt > = 1000) which is false so false block of if is executed ,if(alt-500 <= 300) which is true so true block is executed , alt = 2* alt = 2*650 = 1300
Question 10
switch
As there are 25 cases , so switch should be used .
Question 11
1400
Explaination:
time = 700
time > 0 , so true block of if is executed, time >= 1000 is false so false block is executed, time > 500 is true so true block is executed ie time = 2*time = 1400
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.