C++ coding. Indentation is not necessarily correct. Answer the questions below t
ID: 3671524 • Letter: C
Question
C++ coding. Indentation is not necessarily correct. Answer the questions below the selection statement
if( x > 65 && <= 100)
A
if( x > 80)
B
else
C
else if ( x < 65)
D
else if ( x > ?)
E
What do you know is true about x at each position (name everything you know to be true)?
A
B
C
D
E – needs a little more work. What do you think would be the most logical choice here to replace the ? After you pick a value, explain your choice and answer the question for E
Are all numerical values considered? If there are exceptions, name them.
Explanation / Answer
if( x > 65 && <= 100)
A
if( x > 80)
B
else
C
else if ( x < 65)
D
else if ( x > ?)
E
A-> the value of x should be greater than 65 and less than or equal to 100.for example ->66 Then A will be executed,
B->The value of x must be greater than 80 so that B can be executed.Example: 81
C->If x is less than 80/not greater than 80 then C will be executed. Example : 79
D->this is the else if continuation of statement one.If the value is not between 65 and 100.then it checks if x is less than 65.If it less than 65 then D will be executed.
E:The question mark here is 100.
This is the continuiation of statement 1 and statement D.First it checks if the x is between 65 and 100, if not then it checks if x is less than 65 if this is false.Then finally it checks if x is greater than 100 .X>100. If this is true then this will execute E otherwise it will come out of the if else structure.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.