Consider the following ANSI C program:
#include <stdio.h>
#include <stdlib.h>
struct Node{
int value;
struct Node *next; };
int main(){
struct Node *boxE, *head, *boxN; int index = 0;
boxE = head = (struct Node *) malloc(sizeof(struct Node));
head->value = index;
for (index = 1; index <= 3; index++){
boxN = (struct Node *) malloc(sizeof(struct Node));
boxE->next = boxN;
boxN->value = index;
boxE = boxN; }
for (index = 0; index <= 3; index++) {
printf("Value at index %d is %d\n", index, head->value);
head = head->next;
printf("Value at index %d is %d\n", index+1, head->value); } } Which one of the statements below is correct about the program?
Step 1: Understand the linked-list construction.
The program allocates the first node and assigns it to both \texttt{boxE} and \texttt{head}. It then creates three more nodes inside the first \texttt{for} loop (for \texttt{index = 1} to \texttt{3}) and links them using the \texttt{next} pointer.
Thus, a total of four nodes are created, not five.
Step 2: Identify the issue with the \texttt{next pointer.}
After the loop finishes, the \texttt{next} pointer of the last node is never initialized. That is, there is no statement like:
\[
\texttt{boxE->next = NULL;}
\]
As a result, the last node's \texttt{next} pointer contains an indeterminate (garbage) value.
Step 3: Analyze the second loop.
In the second \texttt{for} loop, the statement:
\[
\texttt{head = head->next;}
\]
is executed repeatedly. Eventually, when \texttt{head} points to the last node, \texttt{head->next} refers to an uninitialized pointer. Dereferencing it in:
\[
\texttt{head->value}
\]
can lead to undefined behavior or a run-time error (such as a segmentation fault).
Step 4: Eliminate incorrect options.
(A) Incorrect: Only four nodes are created.
(B) Incorrect: There is no infinite loop; both loops have fixed bounds.
(C) Incorrect: In C, reaching the end of \texttt{main} without a \texttt{return} is allowed (implicitly returns 0).
Step 5: Conclusion.
The program dereferences an uninitialized pointer, which may cause a run-time error.
Final Answer: (D)
The statements of pseudocode for searching the first element with key k in the linked list L are given below. Arrange them in the correct order.
(A) while (x != NIL and x.key != k)
(B) x = L.head
(C) x = x.next
(D) return x
In the diagram, the lines QR and ST are parallel to each other. The shortest distance between these two lines is half the shortest distance between the point P and the line QR. What is the ratio of the area of the triangle PST to the area of the trapezium SQRT?
Note: The figure shown is representative

A square paper, shown in figure (I), is folded along the dotted lines as shown in figures (II) and (III). Then a few cuts are made as shown in figure (IV). Which one of the following patterns will be obtained when the paper is unfolded?
Consider the relationships among P, Q, R, S, and T:
• P is the brother of Q.
• S is the daughter of Q.
• T is the sister of S.
• R is the mother of Q.
The following statements are made based on the relationships given above.
(1) R is the grandmother of S.
(2) P is the uncle of S and T.
(3) R has only one son.
(4) Q has only one daughter.
Which one of the following options is correct?