41.
Consider the following iterative implementation used to find the length of a linked list:
struct Node
{
      int val;
      struct Node *next;
}*head;
int get_len()
{
      struct Node *temp = head->next;
      int len = 0;
      while(_____)
      {
          len++;
          temp = temp->next;
      }
      return len;
}
Which of the following conditions should be checked to complete the above code?

42.
What is the output of the following code?
#include<stdio.h>
int arr[31], len = 0;
void recursive_dec_to_bin(int n)
{
      if(n == 0 && len == 0)
      {
          arr[len++] = 0;
          return;
      }
      if(n == 0)
         return;
      arr[len++] = n % 2;
      recursive_dec_to_bin(n/2);
}
int main()
{
     int n = -100,i;
     recursive_dec_to_bin(n);
     for(i=len-1; i>=0; i--)
     printf("%d",arr[i]);
     return 0;
}

44.
Consider the following recursive implementation to find the nth fibonnaci number:
int fibo(int n)
{
     if(n == 1)
        return 0;
     else if(n == 2)
        return 1;
     return fibo(n - 1) + fibo(n - 2);
}
int main()
{
     int n = 5;
     int ans = fibo(n);
     printf("%d",ans);
     return 0;
}
Which of the following is the base case?

46.
Consider the following iterative code used to convert a decimal number to its equivalent binary:
#include<stdio.h>
void dec_to_bin(int n)
{
      int arr[31],len = 0,i;
      if(n == 0)
      {
          arr[0] = 0;
          len = 1;
      }
      while(n != 0)
      {
          arr[len++] = n % 2;
          _______;
      }
      for(i=len-1; i>=0; i--)
        printf("%d",arr[i]);
}
int main()
{
     int n = 10;
     dec_to_bin(n);
     return 0;
}
Which of the following lines should be inserted to complete the above code?

50.
Consider the following pseudocode for the random page replacement algorithm. Which of the following best suits the blank?
Start traversing the pages                                                       
if pages < capacity   
{
    insert the pages until the size of the set reaches capacity or all the pages are processed   
    maintain the pages in a queue         
    increment page fault 
}
else if
{
    current page is present in the set
    do nothing 
}
else 
{
    replace the current page with __________
    store current page in the queue 
    increment page fault
} 
return page faults