51. What is the output of the following code?
#include<stdio.h>
int recursive_get_len(char *s, int len)
{
if(s[len] == 0)
return 0;
return 1 + recursive_get_len(s, len+1);
}
int main()
{
char *s = "abcdef";
int len = recursive_get_len(s,0);
printf("%d",len);
return 0;
}
#include<stdio.h>
int recursive_get_len(char *s, int len)
{
if(s[len] == 0)
return 0;
return 1 + recursive_get_len(s, len+1);
}
int main()
{
char *s = "abcdef";
int len = recursive_get_len(s,0);
printf("%d",len);
return 0;
}
52. To find an eulerian cycle by fleury's algorithm, from which vertex you should start if the graph has no odd vertices?
53. Vertex covering can be a good approach to which type of the problems?
54. Which of the following logical programming languages is not based on backtracking?
55. Consider the following recursive implementation to find the factorial of a number. Which of the lines is the base case?
int fact(int n)
{
if(n == 0)
return 1;
return n * fact(n - 1);
}
int main()
{
int n = 5;
int ans = fact(n);
printf("%d",ans);
return 0;
}
int fact(int n)
{
if(n == 0)
return 1;
return n * fact(n - 1);
}
int main()
{
int n = 5;
int ans = fact(n);
printf("%d",ans);
return 0;
}
56. What is the output of the following code?
#include<stdio.h>
int get_max_element(int *arr,int n)
{
int i, max_element = arr[0];
for(i = 1; i < n; i++)
if(arr[i] > max_element)
max_element = arr[i];
return max_element;
}
int get_min_element(int *arr, int n)
{
int i, min_element;
for(i = 1; i < n; i++)
if(arr[i] < min_element)
min_element = arr[i];
return min_element;
}
int main()
{
int n = 7, arr[7] = {1,1,1,0,-1,-1,-1};
int max_element = get_max_element(arr,n);
int min_element = get_min_element(arr,n);
printf("%d %d",max_element,min_element);
return 0;
}
#include<stdio.h>
int get_max_element(int *arr,int n)
{
int i, max_element = arr[0];
for(i = 1; i < n; i++)
if(arr[i] > max_element)
max_element = arr[i];
return max_element;
}
int get_min_element(int *arr, int n)
{
int i, min_element;
for(i = 1; i < n; i++)
if(arr[i] < min_element)
min_element = arr[i];
return min_element;
}
int main()
{
int n = 7, arr[7] = {1,1,1,0,-1,-1,-1};
int max_element = get_max_element(arr,n);
int min_element = get_min_element(arr,n);
printf("%d %d",max_element,min_element);
return 0;
}
57. Which of the following is the binary representation of 100?
58. Where is the n-queens problem implemented?
59. Fleury's algorithm can be used to print which type of paths or circuits?
60. Which among the following is a disadvantage of the not recently used algorithm?
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 10
- Miscellaneous on Data Structures - Section 11
- Miscellaneous on Data Structures - Section 12