Question: Programing C (5 pts) Write an expression that evaluates to 1 if a is the smallest among integers a, b, and c and to 0
(5 pts) Write an expression that evaluates to 1 if a is the smallest among integers a, b, and c and to 0 otherwise. If you used any parentheses, you must tell whether each pair of parentheses is redundant. 1. 2" (5 pts) write an expression that evaluates toifx is between 10 and 100 and 1 otherwise. 3. (5 pts) Give the output of the following program fragment. Explain how alpha is computed to the value you give int alpha 10, beta-5, gamma-3; alpha-beta++gamma: printf("%d %d %d ", alpha, beta, gamma ); 4. (8 pts) Give the values of x and y after the following statements are executed. Provide a fully detailed explanation about how you arrive at such values, including all the binary forms int x 18 xx >2 int y 12; 5. (8 pts) Give the value of variable named result after the two statements below are executed Provide a fully detailed explanation about how you arrive at this value, including all intermediate terms to be summed. int x-5, y-7; int result)/2y 6 (10 pts) Give the output from the following program fragment. Provide a fully detailed explanation about how you reach such an output, including all the binary forms. int x-17. y 4 int -x66y printf ("z- %d\ tysid", z, w); 7, (8 pts) write an if statement that outputs one of the letter grade letters A, B, C, D, E given the numeric grade. Assume the numeric grade is stored in an integer variable named grade. Use the following scale for conversion: 90: A, 80-8918, 70-79: C, 60-69: D, x> 18) printf("%d is between 18 and 24 "); ) else printf(d is outside the range 18-241n") 9. (8 pts) Give the value of x after executing the following statements. explanation for your value. Provide a fully detailed int a-4,b- 2, c-4 10. (10 pts) First write the following fragment in proper indentation. Then, for each of the cases a) and bl, explain in full detail about the execution of the following selection statements, and finally give the output from the fragment. if (w 10) printf("o0001n"Y else printf("1111 n") printf ("22221n") when b)5, 15; 11. (10 pts) Convert the following if statement into a switch statement. f (answery') printf("Let's do itn") printf("Be ready at 5:00pmin") countYest+ ) else if (answer'n') printE("May be next time ") countNo++ else iE (answer printE ("Still undecided?1n") l else ( printE("This is not a valid optionsn") 12. (10 pts) Give the output of the following fragment. Provide a fully detailed explanation int delta 26 switch (delta/5) 12. (10 pts) Give the output of the following fragment. Provide a fully detailed explanation. int delta-26: switch (delta/5) case 1: printf ("delta is small") case S: printf("delta is midsize") case 10: printf ("delta is large") default: printfc"delta can be anything) 13. (5 pts) Give the output of the following program fragments. int value 7 while (value
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
