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

Question{18}: Using the following, which is a correct reason for reaching the \"

ID: 3865477 • Letter: Q

Question

Question{18}: Using the following, which is a correct reason for

reaching the "otherwise"? In other words, what scenario was not

handled?

Grade = input('Please enter a final numeric grade: ');

switch true

case (length(Grade) == 0)

disp('Error: No valid Grade was provided!');

case (isnumeric( Grade ) == 0)

disp('Error: No valid Grade was provided!');

case (( Grade > 100) | (Grade < 0))

disp('Error: No valid Grade was provided!');

case ( Grade >= 90 )

Letter = 'A';

case ( Grade >= 80 )

Letter = 'B';

case ( Grade >= 70 )

Letter = 'C';

case ( Grade >= 60 )

Letter = 'D';

case ( Grade >= 0 )

Letter = 'F';

otherwise

Letter = 'N/A'

end;

disp(Letter);

A. The user entered a character.

B. The user entered a decimal value.

C. The user entered a vector of numeric grades (of different grade letters).

D. The user entered a value greater than 100.

E. The user entered a value less than 0.

Answer{18}='';

Reason{18}='';

Question{19}: Using the following, what possibility is false in the

"otherwise"?

Letter = input('Please enter a final Letter grade: ','s');

switch Letter

case 'A'

MaxGrade = 100;

MinGrade = 90;

case 'B'

MaxGrade = 89;

MinGrade = 80;

case 'C'

MaxGrade = 79;

MinGrade = 70;

case 'D'

MaxGrade = 69;

MinGrade = 60;

case 'F'

MaxGrade = 59;

MinGrade = 0;

otherwise

MaxGrade = NaN;

MinGrade = NaN;

end;

A. The user entered a non-character datatype.

B. The user entered too many letters.

C. The user entered lower case letters

D. The user entered in no letter.

E. None of the above.

Answer{19}='';

Reason{19}='';

Question{20}: Given the following, what is wrong with the code?

Balance = 100;

IAmBroke = false;

while (IAmBroke == false)

if (Balance > 0)

disp('Keep paying the bills!');

else

disp('Time to call for help!');

end;

end;

A. The Balance never changes.

B. The IAmBroke never changes.

C. It works correctly to me.

D. It only runs once.

E. The Balance can become less than zero.

Answer{20}='';

Reason{20}='';

Explanation / Answer

Ans 18. It will reach to Otherwise in all options. As break statement in each case is not written. Since break statement is not there it will not break the program even if (let say) case ( Grade >= 0 ) is selected by option E.

Sample switch case . :

If break is not needed to be mention in question (if it is implicit) then Option C - The user entered a vector of numeric grades (of different grade letters) is correct, as input required is one decimal number whereas user has entered an vector of numeric grades, which will not satisfy any case, thus falling in otherwise scenario.

Please ask different question separately as per chegg guideline.