

MCQOPTIONS
Saved Bookmarks
1. |
Which of the following will stop the loop at the last node of a linked list in the following C code snippet? |
A. | <pre class="prettyprint lang-c">while (p->next != NULL)<br> {<br> p = p->next;<br> }<br></pre> |
B. | <pre class="prettyprint lang-c">while (1)<br> {<br> p = p->next;<br> if (p == NULL)<br> break;<br> }<br></pre> |
C. | <pre class="prettyprint lang-c">while (p != NULL)<br> {<br> p = p->next;<br> }<br></pre> |
D. | All of above |
E. | None of these |
Answer» B. <pre class="prettyprint lang-c">while (1)<br> {<br> p = p->next;<br> if (p == NULL)<br> break;<br> }<br></pre> | |