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

CSCA48 Test #6
• 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 struct, write it down carefully
typedef struct Linked_List_Node{
char data;
struct Linked_List_Node *next;
}Node;

Question 1
Write a function called delete_last that that deletes the last occurrence of a given value in a linked list. If the value does not occur in the list, the list should remain unchanged.
• You may choose your own parameters and return type
• You may assume you have access to any standard header file

Question 2
What is printed by the following code:
1|
2|
3|
4|
5|
6|
7|
8|
9|
10|
11|
12|
13|
14|
Stack s;
initialize_stack(&s);
Queue q;
initialize_queue(&q);
char input[7] = “ABCDEF”;
for(int i=0; i< 7; i+=2){ push(&s, input[i]); enqueue(&q, input[i+1]); } while(!is_queue_empty(&q) && !is_stack_empty(&s)){ printf("%c", pop(&s)); printf("%c", dequeue(&q)); } printf("\n");