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?
A. temp->next != 0
B. temp == 0
C. temp != 0
D. temp->next == 0
Select an option to see the answer and solution.
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;
}A. -1100100
B. 1100100
C. 2's complement of 1100100
D. Garbage value
Select an option to see the answer and solution.
The pendant vertex of the graph can also be an articulation point of the graph.
Select an option to see the answer and solution.
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?
A. if(n == 1)
B. else if(n == 2)
C. return fibo(n - 1) + fibo(n - 2)
D. both if(n == 1) and else if(n == 2)
Select an option to see the answer and solution.
For how many queens was the extended version of Eight Queen Puzzle applicable for n*n squares?
Select an option to see the answer and solution.
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?
A. n-
B. n /= 2
C. n /= 10
D. n++
Select an option to see the answer and solution.
In which of the following cipher the plain text and the ciphered text does not have the same set of letters?
A. route cipher
B. columnar transposition cipher
C. myszkowski cipher
D. additive cipher
Select an option to see the answer and solution.
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?
A. EAPEXML
B. EEXLAPM
C. EXAEMLP
D. EXAMPLE
Select an option to see the answer and solution.
Polybius square cipher is most closely related to?
A. mono-alphabetic cipher
B. poly-alphabetic cipher
C. transposition cipher
D. additive cipher
Select an option to see the answer and solution.
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 faultsA. any random page
B. recently used page
C. least recently used page
D. the first page of the frame
Select an option to see the answer and solution.
What is the minimum vertex cover for the following graph given below?
A. {A, B}
B. {A, E}
C. {B, C}
D. {D, B}
Select an option to see the answer and solution.
The quick hull algorithm runs faster if the input uses non- extreme points.
Select an option to see the answer and solution.
Playfair cipher is an example of . . . . . . . .
A. mono-alphabetic cipher
B. poly-alphabetic cipher
C. transposition cipher
D. additive cipher
Select an option to see the answer and solution.
What is the basic unit of time measurement in Morse code transmission?
A. Dot duration
B. Dash Duration
C. Numeric Duration
D. Space Duration
Select an option to see the answer and solution.
What is meant by number theory?
A. study of integers
B. study of complex numbers
C. numerology
D. theory of origination of mathematics
Select an option to see the answer and solution.
Given below is the pseudocode of the flooding algorithm. Node and message are denoted by n and m respectively. Which of the following best suits the blank?
if m.id was seen before, discard
else, add m.id to list of seen messages and ______A. discard the message
B. forward the message in the direction from where it came.
C. forward the message to all neighbors of n
D. forward the message to the left neighbor of n
Select an option to see the answer and solution.
Cross product is also known as?
A. scalar product
B. vector product
C. dot product
D. multiplication
Select an option to see the answer and solution.
The number of columns in the table used for encryption in rail fence cipher depends upon the given key value.
Select an option to see the answer and solution.
How many possible solutions occur for a 10-queen problem?
Select an option to see the answer and solution.
Hill cipher is harder to crack than playfair cipher.
Select an option to see the answer and solution.