Cap Gemini 3
Cap Gemini 3
}
a)64
b)16
c)36
d)32
Q3. What is the maximum degree of any vertex in a simple graph with n+1 vertices?
a)n + 1
b)2n - 1
c)n
d)n-1
a)3
b)7
c)4
d)0
Q5.
#include <stdio.h>
void main (){
int ch=1;
switch(ch){
case 1:
printf("1");
case 2:
printf("2");
break;
default:
printf("3");
}}
a)1
b)2
c)123
d)12
Q6. What will be the output if n=2
int fun( int n )
if(n EQUALS 4)
return n
else
return 3 * fun (n+ 1)
a)12
b)16
c)36
d)48
Q7. Which of the following data structure cannot store even if total number of elements is
less than maximum?
a)Circular queue
b)None of the mentioned options
c)Priority queue
d) Simple queue
a)64
b)128
c)48
d)256
Q9. What will be the output
Integer a, b, C
Set a = 8, b = = 10, c =6
If (a > c AND (b + c) >a)
Print a
end if
if (c>b or (a + c)> b)
Print b
end if
if ( (b+c) MOD a EQUALS 0)
Print c
End if
a)2
b)3
c)1
d)0
a)8 12 16 9 43
b)8 9 12 16 43
c)8 12 9 43 16
d)8 12 9 16 43
Q11. What will be the height of BST if following elements are inserted from left to right?
31 24 26 37 42 32
a)5
b)6
c)4
d)3
Q12.
How many times is the comparison i≥n performed in the following program?
a)52
b)51
c)53
d)42
Q13.
Consider the following pseudocode fragment, where y is an integer that has been initialized.
int i=1
int j=1
while (i<5):
j=j*i
i=i+1
if (i==y):
break
end if
end while
1. (i==5) or (i==y)
Which of the above statements is/are TRUE at the end of the while loop? Choose from the
following options.
A. 1 only
B. 2 only
C. 1 and 2 only
D. 1, 2 and 3
a)5
b)4
c)6
d)3
The value returned when we call fun with the input 270 is
a)5
b)4
c)10
d)6
Q16. If the base address of a two-dimensional array A [70] [10] is 700, then what is the
address of an element A [2] [7] in the array?
a)808
b)708
c)712
d)812
Q17. What will be the output?
Integer a, b, c, d
Set b = 10, c= 10
a=b-c
b = b +c+ 12
b = b/5
d= b+a
end for
c = a +b + c
Print a b c
a)0 10 20
b)6 4 16
c)6 4 15
d)9 10 21
b)7 14 24
c)8 14 24
d)8 14 26
Q19. What is the output of following function for start pointing to rst node of following
linked list? 1->2->7->4->5->6
a) 175571
b) 135135
c) 175175
d) 1756
Q20 What will be the array representation of min heap after inserting 10 to it.
12 43 16 56 98 23
a)10 12 43 56 98 23 16
b) 10 43 12 56 98 23 16
c) 10 43 12 56 23 98 16
d) 10 43 56 98 12 23 16
A+B/(C+D-F)*Y-X
a) ABCD+F-/Y*-X+
b) ABCD+F-*Y/-X+
c) ABCD+F-/Y*+X-
d) ABCD-F+/Y*+X-
#include<stdio.h>
int main()
{
printf("360");
main();
return 0;
}
a) Compilation Error
b)360 is printed once
c)Nothing will get printed
d)360 will be printed infinity times
a)16
b)48
c)36
d)24
c)Number of vertices*number of
vertices
input m=9,n=7
m=m+1
n=n-1
m=m+n
if(m>n)
print m
else
print n
a)16
b)15
c)6
d)5
d)All of these
Q28. Which of the following will return a result most quickly for searching a given key?
a) Unsorted Array
b) Sorted Array
Integer temp
while (b)
temp =a MOD b
a=b
b = temp
end while
return a
End function func ()
a)2
b)4
c)3
d)1
Integer a
String str1
Set str1 = “rainbow”
a = stringLength(str1)
Print (a ^ 1)
a)4
b)5
c)7
d)6
ANSWERS
1-b
2-a
3-c
4-c
5-d
6-c
7-d
8-b
9-b
10-d
11-d
12-a
13-c
14-b
15-d
16-a
17-a
18-a
19-a
20-b
21-c
22-d
23-b
24-b
25-b
26-a
27-b,c
28-d
29-b
30-d