+1 vote
in JavaScript by
If the following piece of JavaScript code is executed, will it work if not, what kind of possible error can occur?

function fun(o)  

{  

for(;o.next; oo =o.next);  

return o;  

}  

a) Yes, it will work fine

b) No, this will not iterate at all

c) No, it will throw an exception as only numeric's can be used in a for loop

d) No, it will produce a runtime error with the message "Cannot use Linked List"

1 Answer

0 votes
by

Answer: A

Reason: In the above-given code, the For loop statement is used for traversing the linked list data structure, which returns the last element of the list. So it is definitely going to work without throwing any exception.

...