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;
}
#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;
}
2. Consider a reference string:
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 of frame size 3. Using FIFO algorithm, determine the number of page faults.
7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 of frame size 3. Using FIFO algorithm, determine the number of page faults.
3. Which of the following is NOT a rule of tower of hanoi puzzle?
4. Given that a graph contains no odd cycle. Is it enough to tell that it is bipartite?
5. From the following given tree, what is the code word for the character 'a'?

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;
}
#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;
}
7. The number of colors used by a proper edge coloring graph is called?
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?
10. In what time can an augmented path be found?
Read More Section(Miscellaneous on Data Structures)
Each Section contains maximum 100 MCQs question on Miscellaneous on Data Structures. To get more questions visit other sections.
- Miscellaneous on Data Structures - Section 1
- Miscellaneous on Data Structures - Section 2
- Miscellaneous on Data Structures - Section 3
- Miscellaneous on Data Structures - Section 4
- Miscellaneous on Data Structures - Section 5
- Miscellaneous on Data Structures - Section 6
- Miscellaneous on Data Structures - Section 7
- Miscellaneous on Data Structures - Section 8
- Miscellaneous on Data Structures - Section 9
- Miscellaneous on Data Structures - Section 11
- Miscellaneous on Data Structures - Section 12