Home / MCQ Bank / Computer
Computer Introduction To Data Structures Difficulty: Medium

The following C function takes a simply-linked list as an input argument. It modifies the list by moving the last element to the front of the list and returns the modified list. Some part of the code is left blank. Choose the correct alternative to replace the blank line. typedef struct node { int value; struct node *next; }Node; Node *move_to_front(Node *head) { Node *p, *q; if ((head == NULL: || (head->next == NULL)) return head; q = NULL; p = head; while (p-> next !=NULL) { q = p; p = p->next; } _______________________________ return head; }

Select the correct option to test your answer:

More Computer Questions

In Java, which collection is typically implemented as a dynamic array that can grow or shrink in size? An IBM System/38 represents the computer class of: What will be the output? class One{ final int a = 15; } class Two extends One{ final int a = 20; } public class Test extends Two{ final int a = 30; public static void main(String args[]){ Test t = new One(); System.out.print(t.a); } } In Python, which loop is suitable for cases where you need to execute a block of code multiple times until a condition is met? Why do we use comments?