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

What is wrong with the following if() statement, if anything? if(a = 5): printf(

ID: 3858641 • Letter: W

Question

What is wrong with the following if() statement, if anything? if(a = 5): printf("The value of a is five|n"): Nothing is wrong: the statement is fine as it is. There is a semicolon at the end of the first line. In is not a defined escape character. There should be a single "sign, not double. If/else statements are ideal for use with ranges of values, such as printing correct grades based on input. True False What value will the memory location alt contain after the following set of statements is executed? int alt = 850: if(alt > 0) if(alt > =1000) alt = 0: else if(alt=10*alt: else alt = 3 + alt: 853 17000 8500 0 In C, what encloses a block of statements within an if() statement? square brackets, [] parentheses, () angle brackets, braces, {}

Explanation / Answer

Question 5)
if(a == 5);
since if statement is terminated, result of if condition
wont affect the print statement.

Answer There is semicolon at the end of the first line


Question 6)
yes, grades can be outputtted on comparison of
score with range of values for a grade

Answer: True


Question 7)
alt=850;
since alt > 0 and alt-500 is 350 which is greater than 300
hence, alt will be 10*alt, alt = 850*10 = 8500

Answer: 8500


Question 8)
if()
{
   //....
}
Braces are used in if statement

Answer: braces, {}

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