I am trying to understand the answer to this question.
We want to store a collection of 100 StudentMark objects in a list. A student mark object contains only a student id number, which takes a single word (4 bytes) and a mark, which takes another word.
We choose a Doubly Linked Circular List as our implementation of a list ADT. All pointers also take one word of memory. StudentMark objects are not stored directly in the linked list nodes but are allocated elsewhere in memory and only a pointer to each StudentMark object is stored in each linked list node.
How many words of memory are required to store all the linked list nodes and all the StudentMark objects?
Do not include the header node that points to the first node in the linked list in your count.
Doubly Linked Circular List:
I assumed the answer was 400
Reasoning:
But apparently the answer is 500
The keyphrase in the description is this one:
StudentMark objects are not stored directly in the linked list nodes but are allocated elsewhere in memory and only a pointer to each StudentMark object is stored in each linked list node.
The word used by that pointer (marked in bold in the above quote) was missing in your calculation.
A more detailed picture of the linked list structure would be like this one:
┌──────────────────────────────────────────────┐
┌────────│─────────────────────────────────────┐ │
│ ▼ ▼ │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
└─── prev │◄──── prev │◄──── prev │◄──── prev │ │
│ next ─────►│ next ─────►│ next ─────►│ next ────┘
│ data │ │ data │ │ data │ │ data │
└───│─────┘ └───│─────┘ └───│─────┘ └───│─────┘
│ │ │ │
▼ ▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ ID │ │ ID │ │ ID │ │ ID │
| mark | | mark | | mark | | mark |
└─────────┘ └─────────┘ └─────────┘ └─────────┘
In each "column" in this diagram there are 5 words, so if the linked list has 100 entries, the total number of words is 500.