What is the output of the following code?
#include<stdio.h>
int get_len(char *s)
{
int len = 0;
while(s[len] != '\0')
len++;
return len;
}
int main()
{
char *s = "lengthofstring";
int len = get_len(s);
printf("%d",len);
return 0;
}A. 14
B. 0
C. Compile time error
D. Runtime error
Select an option to see the answer and solution.
Which of the following cipher does not require the use of tabula recta?
A. running key cipher
B. vigenere cipher
C. gronsfeld cipher
D. trithemius cipher
Select an option to see the answer and solution.
What is the output of the following code?
int fact(int n)
{
if(n == 0)
return 1;
return n * fact(n - 1);
}
int main()
{
int n = 0;
int ans = fact(n);
printf("%d",ans);
return 0;
}Select an option to see the answer and solution.
What will be the time complexity of update query operation in an array of size n when we use square root optimization?
A. O(√n)
B. O(n)
C. O(1)
D. O(n2 )
Select an option to see the answer and solution.
Given below is the pseudocode of the vertex cover problem. Which of the following best suits the blank?
Vertex_Cover(G = (V, E))
{
A = { }
while (E!=0)
{
pick any edge (u, v) from E
add u and v to A
________________
}
return A
}A. remove every edge incident on either u or v
B. add every edge incident on u
C. delete the vertex
D. delete adjacent edge
Select an option to see the answer and solution.
Who invented the concept of inclusion-exclusion principle?
A. Abraham de Moivre
B. Daniel Silva
C. J.J. Sylvester
D. Sieve
Select an option to see the answer and solution.
In a stack algorithm, the set of pages in a k-frame memory is always a subset of pages in a . . . . . . . . frame memory.
Select an option to see the answer and solution.
What will be the chromatic index for a complete graph having n vertices (consider n to be an even number)?
A. n
B. n + 1
C. n - 1
D. 2n + 1
Select an option to see the answer and solution.
Which of the following correctly defines poly graphic substitution cipher?
A. a substitution based cipher which uses multiple substitutions at different positions
B. a substitution based cipher which uses fixed substitution over entire plain text
C. a substitution based cipher in which substitution is performed over a block of letters
D. a transposition based cipher which uses fixed substitution over entire plain text
Select an option to see the answer and solution.
What is the advantage of iterative code for finding power of number over recursive code?
A. Iterative code requires less time
B. Iterative code requires less space
C. Iterative code is more compiler friendly
D. It has no advantage
Select an option to see the answer and solution.
The Euler's circuit problem can be solved in?
A. O(N)
B. O( N log N)
C. O(log N)
D. O(N2 )
Select an option to see the answer and solution.
Which of the following cipher was used by freemasons?
A. Vigenere cipher
B. Autokey cipher
C. Pigpen cipher
D. Hill cipher
Select an option to see the answer and solution.
What is the output of the following code?
#include<stdio.h>
#include<stdlib.h>
struct Node
{
int val;
struct Node *next;
}*head;
int get_len()
{
struct Node *temp = head->next;
int len = 0;
while(temp != 0)
{
len++;
temp = temp->next;
}
return len;
}
int main()
{
int arr[10] = {1,2,3,4,5}, n = 5, i;
struct Node *temp, *newNode;
head = (struct Node*)malloc(sizeof(struct Node));
head->next = 0;
int len = get_len();
printf("%d",len);
return 0;
}A. 0
B. Garbage value
C. Compile time error
D. Runtime error
Select an option to see the answer and solution.
The letters of a word are separated by a space of how many units?
A. 1 Unit
B. 2 Units
C. 3 Units
D. 4 Units
Select an option to see the answer and solution.
What will be the plain text corresponding to cipher text "SCSEMG" if rail fence cipher is used with key value 2?
A. MSGSEC
B. SECMSG
C. GSMSEC
D. SECGSM
Select an option to see the answer and solution.
Which one of the following is an application of the backtracking algorithm?
A. Finding the shortest path
B. Finding the efficient quantity to shop
C. Ludo
D. Crossword
Select an option to see the answer and solution.
What is the objective of tower of hanoi puzzle?
A. To move all disks to some other rod by following rules
B. To divide the disks equally among the three rods by following rules
C. To move all disks to some other rod in random order
D. To divide the disks equally among three rods in random order
Select an option to see the answer and solution.
A complete bipartite graph is a one in which each vertex in set X has an edge with set Y. Let n be the total number of vertices. For maximum number of edges, the total number of vertices hat should be present on set X is?
A. n
B. n/2
C. n/4
D. data insufficient
Select an option to see the answer and solution.
Which among the following represents best-case time complexity for activity selection problem?
A. O(n)
B. O(1)
C. O(n2 )
D. O(n2 * (log n)
Select an option to see the answer and solution.
Which of the following equals the a x b ( a and b are two vectors)?
A. - (a x b)
B. a.b
C. b x a
D. - (b x a)
Select an option to see the answer and solution.