CS计算机代考程序代写 CSCA48 Test #1

CSCA48 Test #1
• Please ensure that your hands, head, and desktop are visible in your webcam
• Turn your camera, microphone, and speakers on, leave your volume at a low level
• Once the test has begun, you may not touch or approach your computer unless told to do so, you must remain in view of the camera at all times
• If you have a question, raise your hand and you will be moved to a breakout room where you can talk to an invigilator
• All answers must be legible and clearly labeled, no marks will be given for unclear or unreadable answers

Question 1
What is printed by the code below?
int x = 3;
int y = 7;
int z = x * y;
while(z >= x){
printf(“%d,%d,%d”, x, y, z);
x = x + 1;
z = z – x;
for(y = z + 1; y > x; y = y-3){
printf(“+”);
}
printf(“\n”);
}

Question 2
Write a function called print_places that takes two parameters, a float N and an integer X and prints all roundings of N between 0 and X digits. For example:
print_places(1.2345678, 5)
Would print: 1.000000 1.200000 1.230000 1.234000 1.234500 1.234560
Reminder: %f is the formatting character for printing floats You are not responsible for rounding errors