Test Your Knowledge 6

Let's take a short Quiz!

We'll cover the following...
...

This Quiz will take approximately 10 minutes.

1

Assume that you have a linked list with 55 nodes. Your task is to traverse the linked list recursively.

function printListRecursively(head) {
  // Base case
  ________________________________
  
  // Recursive case
  console.log(head.data);
  printListRecursively(head.next);
}

What would the base case of the above code be?

A)
if (head == null) {
    return;
  }
B)
if (head.next == null) {
  return;
}
C)
if (console.log(head)) {
  return;
}
D)
if (head == null) {
  return 1;
}
Question 1 of 30 attempted

...