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

CSCA48 Test #4
• You will have 30 minutes to answer 2 questions
• 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
• If any question is under-specified, you will not be penalized for making a reasonable assumption

The questions on this test pertain to the following structs and course information, please copy these down carefully
typedef struct Course_Record{
char code[7];
int num_students;
float average;
}Course;
typedef struct Department_Record{
Course courses[4];
int num_courses;
}Department;
Code
# students
Class average
CSCA08
800
70.0
CSCA20
300
75.0
CSCA48
500
65.0

Question 1
Write a function to add a new course to a department.
• You may choose your own function name, parameters and return type • You are not responsible for handling bad input to your functions
Write a main function that creates the department from the previous question.
• You may assume that you have access to stdio.h, stdlib.h, and stdbool.h • You may add any helper functions that you deem reasonable

Question 2
Draw the memory model representing your code after all the data has been added to the course, but before main has terminated
• Be sure to show the addresses (locker numbers) and types of all data