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

Basic statements and expressions. Trace (show a \"memory snapshot\") the followi

ID: 3886177 • Letter: B

Question

Basic statements and expressions. Trace (show a "memory snapshot") the following statements by hand, showing your work: int f = 4, g = 2, h: double r = 2.5, q: h = f + r/g: g++: q = h % g * 2: r = f - (g - 7)* q - h: Translate the following into equivalent C statements: a. Declare a variable named tickets and assign to it a whole number between and 10. b. Double the current value of tickets and assign the new value back to tickets. c. Declare a variable named cost and assign the cost of a recent ticket you purchased for some event. The cost variable should be able to store fractions of dollars as well as whole dollars. Assume that the following statement has been executed: int boxes = 12: The statement which would correctly display the value of boxes is (circle the letter of the correct answer) a. printf("%d", boxes): b. printf("%d", &boxes;): c. Scanf("%d", &boxes;): d. printf("%f", boxes);

Explanation / Answer

1.

#include <stdio.h>

int main(void) {
int f=4,g=2,h;
double r=2.5,q;
h=f+r/g;
g++;
q=h%g*2;
r=f-(g-7)*q-h;
printf("h value %d",h);
printf(" f value %d",f);
printf(" g value %d",g);
printf(" r value %d",r);
printf(" q value %d",q);
return 0;
}

Output:

2.

#include <stdio.h>

int main(void) {

int tickets;

int doubletickets;

float cost;

printf("Enter the number between 1-10");

scanf("%d",&tickets);

doubletickets=tickets*tickets;

tickets=doubletickets;

cost=tickets;

printf(" The ticket cost is %f",cost);

return 0;

}

Output:

3.

Answer: A

#include <stdio.h>

int main(void) {

int boxes=12;

printf("%d",boxes);

return 0;

}

Output:

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