ExamVeda
Login
Home
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?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
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;
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
43
The pendant vertex of the graph can also be an articulation point of the graph.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
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?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
45
For how many queens was the extended version of Eight Queen Puzzle applicable for n*n squares?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
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?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
47
In which of the following cipher the plain text and the ciphered text does not have the same set of letters?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
48
What will be the ciphered text if rail fence cipher is used for encrypting the plain text "EXAMPLE" with the key value given to be 2?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
49
Polybius square cipher is most closely related to?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
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
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board