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;
}Select an option to see the answer and solution.
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.
Select an option to see the answer and solution.
Which of the following is NOT a rule of tower of hanoi puzzle?
A. No disk should be placed over a smaller disk
B. Disk can only be moved if it is the uppermost disk of the stack
C. No disk should be placed over a larger disk
D. Only one disk can be moved at a time
Select an option to see the answer and solution.
Given that a graph contains no odd cycle. Is it enough to tell that it is bipartite?
Select an option to see the answer and solution.
From the following given tree, what is the code word for the character 'a'?
Select an option to see the answer and solution.
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;
}A. Search and returns the index of all the occurrences of the number that is searched
B. Search and returns the index of the first occurrence of the number that is searched
C. Search and returns of the last occurrence of the number that is searched
D. Returns the searched element from the given array
Select an option to see the answer and solution.
The number of colors used by a proper edge coloring graph is called?
A. k edge coloring graph
B. x edge coloring graph
C. m edge coloring graph
D. n edge coloring graph
Select an option to see the answer and solution.
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.
A. 100, 80
B. 110, 70
C. 130, 110
D. 110, 80
Select an option to see the answer and solution.
Which of the following is not true about atbash cipher?
A. it is a mono alphabetic substitution cipher
B. it can only be used to encrypt hebrew alphabet
C. it is a special case of affine cipher
D. it is weaker than playfair cipher
Select an option to see the answer and solution.
In what time can an augmented path be found?
A. O(|E| log |V|)
B. O(|E|)
C. O(|E|2 )
D. O(|E|2 log |V|)
Select an option to see the answer and solution.
Compute the product matrix using Strassen's matrix multiplication algorithm.
Given a11=1; a12=3;a21=5;a22=7
b11=8;b12=4;b21=6;b22=2
A. c11=20;c12=12;c21=100;c22=15
B. c11=22;c12=8;c21=90;c22=32
C. c11=15;c12=7;c21=80;c22=34
D. c11=26;c12=10;c21=82;c22=34
Select an option to see the answer and solution.
What is the GCD of a and b?
A. a + b
B. gcd (a-b, b) if a>b
C. gcd (a+b, a-b)
D. a - b
Select an option to see the answer and solution.
What is the total running time of the binary GCD algorithm?
A. O(N)
B. O(N2 )
C. O(log N)
D. O(N log N)
Select an option to see the answer and solution.
What will be the output of the following code in java?
import java.util.ArrayList;
public class LRU {
public static void main(String[] args) {
int page_frame = 3;
int page_ref_string[] = {1, 2, 4, 1, 0, 3, 2, 0, 5, 4};
ArrayList<Integer> s=new ArrayList<>(page_frame);
int count=0;
int page_faults=0;
for(int i:page_ref_string)
{
if(!s.contains(i))
{
if(s.size()==page_frame)
{
s.remove(0);
s.add(page_frame-1,i);
}
else
s.add(count,i);
page_faults++;
++count;
}
else
{
s.remove((Object)i);
s.add(s.size(),i);
}
}
System.out.println(page_faults);
}
}Select an option to see the answer and solution.
Running key cipher is a variation of?
A. vigenere cipher
B. autokey cipher
C. hill cipher
D. route cipher
Select an option to see the answer and solution.
Which of the following is made possible by the use of Polybius square?
A. To represent the plain text by smaller set of symbols
B. To represent the plain text by larger set of symbols
C. To represent the plain text by the letters of some other language
D. To represent the plain text by the same set of symbols
Select an option to see the answer and solution.
What is the minimal Hamming distance between any two correct codewords?
Select an option to see the answer and solution.
To which class does the Euler's circuit problem belong?
A. P class
B. NP class
C. Partition class
D. Complete class
Select an option to see the answer and solution.
Consider the following iterative solution to find the sum of first n natural numbers:
#include<stdio.h>
int get_sum(int n)
{
int sm = 0, i;
for(i = 1; i <= n; i++)
________;
return sm;
}
int main()
{
int n = 10;
int ans = get_sum(n);
printf("%d",ans);
return 0;
}
Which of the following lines completes the above code?
A. sm = i
B. sm += i
C. i = sm
D. i += sm
Select an option to see the answer and solution.
What is the minimum number of cuts that a graph with 'n' vertices can have?
A. n+1
B. n(n-1)
C. n(n+1)/2
D. n(n-1)/2
Select an option to see the answer and solution.