1.
How many times is the function recursive_dec_to_bin() called when the following code is executed?
#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 = 111,i;
    recursive_dec_to_bin(n);
    for(i=len-1; i>=0; i--)
    printf("%d",arr[i]);
    return 0;
}

3.
Which of the following is NOT a rule of tower of hanoi puzzle?

6.
What does the following code do?
#include<stdio.h>
int search_num(int *arr, int num, int len)
{
     int i;
     for(i = 0; i < len; i++)
     if(arr[i] == num)
      return i;
     return -1;
}
int main()
{
      int arr[5] ={1,2,3,4,5},num=3,len = 5;
      int indx = search_num(arr,num,len);
      printf("Index of %d is %d",num,indx);
      return 0;
}

8.
Given items as {value,weight} pairs {{60, 20},{50, 25},{20, 5}}. The capacity of knapsack=40. Find the maximum value output assuming items to be divisible and nondivisible respectively.

9.
Which of the following is not true about atbash cipher?