You are on page 1of 121

capgemini tech

Test Summary
No. of Sections: 1
No. of Questions: 135
Total Duration: 100 min

Section 1 - technical

Section Summary
No. of Questions: 135
Duration: 100 min

Additional Instructions:
None

Q1. 1. Consider the following graph:

Which of the following sequences are depth rst traversals of the above graph?
1. abeghf
2. abfehg
3. abfhge
4. afghbe
choose the correct answer the options given below

only 1,2 and 4

only 2,3 and 4

only 1,3, and 4

only 1 and 4

Q2.
 What will be the output of the following pseudocode a=2?
                       1.fun(int a)
                       2.        if(a < 1 )
                       3.                    return
                       4.        else
                       5.                    Print a
                       6.                    fun(a-1)
                       7.                    Print a
                       8.                    Return

A.    1 2

B.    2 1

C.   2 1 1 2
/
D.   3 2 1 1 2 3

Q3.
4) Records are randomly distributed by a hash function in a space that can hold N number of records. The probability that the mth
record is the rst record to result in a collision is

 A. (N-1)(N-2)...(N-(m - 1)/(m - 2)]/NM-1

B. O[(N - 1)(N- 2)...(N- (m - 2)(m - 1)]/NM

C. [(N - 1)(N-2)...(N - (m - 1))(m - 2)]/NM

D. (N-1)(N-2)...(N-(m - 2))(m - 1)]/NM-1

Q4.
Consider a complete undirected graph with vertex set {0, 1, 2, 3, 4). Entry Win the matrix W below is the weight of the edge {i, j}.
What is the minimum possible weight of a spanning tree T in this graph such that vertex O is a leaf node in the tree T?
in this graph such that vertex O is a leaf node in the tree T?
        0 1 8 1 4
        1 0 12 4 9
W = 8 12 0 7 3
        1 4 7 0 2
        4 9 3 2 0 

A. 8

B.7

C.9

D.10

Q5.
Consider an unsorted array A[1…n] with n distinct values the following algorithm can be used to search a given x in that array.
1.choose a k uniformly at random from 1…n;
2.if A[k]=x then stop else Goto 1;
Assume that x is present in the array A,what will be the expected number of comparisons required by the algorithm before it
terminates?

A.n

B.2n

C.n-1

D.n/2

Q6.
Consider the following fragment. Which of the following statements will be executed in this case?

1. Integer x =10, y=3 and z=7 ;


2. if (x /y # )
3.           if y> S1
4.           else S2
5.           else S3

/
A.Statement s3 will be executed

B. Statement s1 will be executed

C.Statement s2 will be executed

D.None of the mentioned options

Q7.
Consider the following pseudocode. How many multiplications are performed here?
1.     M=2
2.     for i=1 to N do
3.        for j= i to N do
4.             for k=j+1 to N do
5.                  M=M*3
6.              End for
7.        End for
8.     End for

A.    One sixth of the product of the 3 consecutive integers

B.    One third of the product of the 3 consecutive integers

C.     Half of the product of the 3 consecutive integers

D.    None of the mentioned options

Q8.
Find out the number of interchange needed to convert the given array into max-heap.
89,19,50,17,12,15,2,5,7,11,6,,9,100

A.5

B.3

C.2

D.4

Q9.
Four matrices Ay, Ay, Az and A, of dimensions a xb, bxc, cx d and dx e respectively can be multiplied in several ways with the
different number of total scalar multiplications.
If a = 10, b = 100, c = 20, d = 5 and e = 80, then at least how many scalar multiplications are required here? 

A. 44000 

B. None of the mentioned options

C. 19000

 D. 80000

Q10.
/
How many leaf nodes are present in a binary tree having a depth H?

A. 2 + 1

B. 2H

C. 2H+1 + 1

D. 2H-1 - 1 

Q11.
Identify the point that is NOT true with respect to a stack.

A.All the mentioned options are correct

B.It is not possible to insert or remove elements anywhere else except the top
of the stack

C.stack supports LIFO order of deletion of elements

D.Stack is a dynamic set where elements are removed in the reverse order of
their insertions

Q12.
Identify the point that is NOT true with respect to a stack.

A.All the mentioned options are correct.

B. Stack supports LIFO order of deletion elements

C. Stack is a dynamic set where elements are removed in the reverse order of
the insertions

D.It is not possible to insert or remove elements anywhere else except top on
the stack

Q13.
If a binary tree has 10 nodes then what is the height of the tree?

A.9

B.11

C.12

D.3

Q14.
If a node having two children is deleted from a binary tree, it is replaced by its: 

/
A. None of the mentioned options

B. Preorder predecessor

C. Inorder successor

D. Inorder predecessor

Q15.
If the address of A[1][1]and A[2][1] are 1000 and 1010 respectively and each element occupies 2 bytes then the array has been
stored in__________order.

 A.matrix major

 B.None of the mentioned options

C.Column major

 D.row major

Q16.
Information about which of the following options is not present in the adjacency matrix representation of a graph?

A. Parallel edges

B. Nodes

C. Direction of edges

D. Edges

Q17.
Let A, B, C, D, E be sorted sequences having lengths 20, 24, 30, 35, 50 respectively, they are to be merged into a single sequence by
merging together two sequences at a time. How many comparisons are needed in the worst case by the optimal algorithm?

A. 544

B. 256

C. 423

D. 358 

Q18.
Maximum height of an AVL tree with 7 nodes is:

A.    6

/
B.    5

C.    3

D.    4

Q19.
Maximum possible number of nodes in the binary tree at level 5 is:

A.31

B.16

C.30

D.28

Q20.
Suppose a queue is implemented using a linked list and its front node and rear node are tracked by two reference variable . which
of these reference variables will change during an insertion into a NONEMPTY queue?

A.    Both will change

B.    Only the rear will change

C.     Only the front will change

D. None of them will change

Q21.
The minimum number for multiplications and additions required to evaluate the polynomial
P-4x3+3x2-15x+45 is:

A.    4 & 2

B.    3 & 4

C.    3 & 3

D.    6 & 3

Q22.
The number of values that can be held by an array arr[-1….n,1…n] is:

A.    n

B.    n2

/
C.    n(n+1)

D.    n(n+2)

Q23.
What will be the output of the following pesudocode?
1.Declare variable x,y,and i
2.Set x=0 and y=1
3.for(i=1;i<=4;i=i+1)
4.       print x
5.       x=x+y
6.       y=x/y
7.End for loop

A.0 1 3 8

B.1 0 2 4

C.0 1 2 3

D.0 1 2 4

Q24.
What will be the output of the following pesudocode?
1.int a=1
2.while (++a <=5)
3.print a++

A.2 4 6

B.1 3 5

C.2

D.2 4

Q25.
What will be the output of the following pseudocode ?
1.     Integer a,b,c
2.     Set a=10,b=20
3.     for(c=a;c<=b;c=c+2)
4.            a=a+c
5.             b=b-a+c
6.              if(a   > 10)
7.                         Print a
8.              Else
9.                         Print b
10.           End if
11.  End for

A.    20

B.    20  32

C.     22

/
D.    20 23

Q26.
What will be the output of the following pseudocode for a given array a[5]=3,4,6,1,2 and pos=2?
1.declare I,j,n,pos
2.Repeat for j=pos to n-1
3.       Set a[j]=a[j+1]
4.End for loop
5.n=n-1;
6.Display the new array
7.End

A. 3 2 4 6 1 2

B. 3 4 1 2

C.3 6 1 2

D.3 4 2 1 2

Q27.
What will be the output of the following pseudocode for input 4?
1.     Int sum(int num)
2.     {
3.     If(num is not equal to 0)
4.             return num+num*sum(num-1)
5.     Else
6.              return num
7.     }

A.    26

B.    15

C.    44

D.    64

Q28.
What will be the output of the following pseudocode for n = 2?
int fun( int n);
if( n EQUALS 4 )
return n;
else
return 2 * fun ( n + 1);

 A. 8

B. 2

C. 4

D. 16

Q29.
What will be the output of the following pseudocode for the input x=22 and y=3?
1. Start
/
 2.. Declare x, y, m, n
3. Set m = x and n = y
4. while m not equal to n then
5. if m greater than n
6.m = m - 1
7. otherwise
 8.n = n - 1
 9. End if
10. End while 1
11. Print n

A. 12

B. 3

C. 4

D. None of the mentioned options

Q30.
What will be the output of the following pseudocode for x=11,y=5?
1.fun(int x,int y)
2.if(x==0)
3.       return y
4.else
5.       return fun(x-1,x-y)

A.71

B.17

C. None of the mentioned option

D.23

Q31.
What will be the output of the following pseudocode?
int a = 15, b = 45, C = 9, i;
if ((o> (a + b )) OR a < (5* c)).
for(i = 1 to 3)
C = C* 2
End for loop
else
while (a > 6)
b=b+1
a=a-4
end while loop
Print b, C

A. 41,4

B. 45, 72

C. 48,9

D. 45,9

Q32.
What will be the output of the following pseudocode?
int n = 343, r, s=0, h; /
set m = n ;
while(n is not equal to 0)
              r = n mod 10
S = S* 10 + r;
n = n / 10;
end while loop ;
print s ;
if(n is equal to m)
print m + 1
else
print m 

A.343 343

B.340 342

C.300 342

D.345 344

Q33.
What will be the output of the following pseudocode?
Integer a,b;
Set a = 125, b = 122;
if( (a + b) MOD 2 NOT EQUALS O )
while ( a > 0)
b = a + b;
a=a/5;
End ;
while
              Print b;
else
              a = a - b ;
              a = a / 2;
              Print a ;
end if;

A.234

B.278

C.274

D.276

Q34.
What will be the output of the following pseudocode?

int i = 5, j = 7
if (i + j > 5)
              j = i + 2
if (j<5)
              print i
 else
              print j
 else
              print i + 1

A. 6

B. 7

/
C. 5

D. 12

Q35.
What will be the output of the following pseudocode?
1. char str[10] = "India", ch = 'n';
2. int ind[10], loop, j = 0 ;
3. for( loop = 0; str[loop] != '\0'; loop=loop+1)
4.       if ( str[loop] == ch );
5. int d[j++] = loop ;
6. for( loop = 0; loop <j; loop=loop+1);
7. Print ind[loop];
[Note: j++ = j+1 and 10 = NULL] 

A. 03

B. 1

C.0

D. 4

Q36.
What will be the output of the following pseudocode?
1. Declare Integer c, d,
2. Integer array[6]={23, 45, 67, 12, 13 25}
3. for(c=0; c < 5; C++)
4. for(d=0; d < 5-C-1 ; d++)
5. if(array[d]>array[d+1])
6. r = array[d];
7.array[d] = array[d+1]
8. array[d+1]=r
9.end if
10.end for
11.end for
12.for(C =0; c<5; C++)
13. print array[C]
14. end for

A. 67 45 23 13 12

B.12 13 23 45 67

C. 67 45 23 13

D. 45 67

Q37.
What will be the output of the following pseudocode?
1. int m = 3, n = 2, 0 = 4 ;
2.while (n > 0)
3. M = m*o+n;
4. n = n - 1
;5. end
while loop
6. O = 0 + M ;
7.print m, n, o;

A. 32 12 41
/
B. 3 2 4

C. 57 0 62  

D. 2 1 6

Q38.
What will be the output of the following pseudocode?
1. Integer a , b
2. Set a = 2, b = 50
3. while( b )
4. a = b MOD 2 + a
5.if ( a MOD 3 IS EQUAL TOO)
6.Print (a)
7.else
8.Print (b - 1)
9.Print (0 - 1) b = b / 5
10.a = a + 1
11. end while 

A. 50 3 2

B. 49 3 1  

C. 3 3 3

D. 50 10 2 

Q39.
What will be the output of the following pseudocode?
1.     Input a=6,b=9
2.     Integer n
3.     Set res=1
4.     If(a>10 && b<a)
5.           Print Error message
6.     Else
7.         for(n=a;n<b;n=n+1)
8.         Res=res*n
9.         End for loop
10.  Print res

A.124

B.234

C.336

D.123

Q40.
What will be the output of the following pseudocode?
1.     Int a=15,b=45,c=9,i
2.     If((c>(a+b))OR a<(5*c))
3.           for(i=1 to 3)
4.                     c=c*2
5.          End for loop
6.     Else
7.          While(a>6)
8.                   b=b+1
9.                  a=a-4
10.        End while loop
11.  Print b,c
/
A.    45 72

B.    41 4

C.    48  9

D.    45  9

Q41.
What will be the output of the following pseudocode?
1.     Int a=3,b=2
2.     If(a+b <7)
3.         a=a*0+b
4.     Else
5.          for(i=1 to 4)
6.                         a=a+i
7.     End for loop
8.     Print a,b+1

A. 2  3

B. None of the options

C. 4 3

D. 3 3

Q42.
What will be the output of the following pseudocode?
1.     Integer a=1,b=2
2.     for(int i=0;i<=6;i=i+2)
3.            a=a+b+i
4.            a=a+b
5.            b= a-b
6.             Print b
7.      End for

A.    3 10 27 71

B.    3 10 27 70

C.     3  7 10

D.    3 9 23 70

Q43.
What will be the output of the following pseudocode?
1. Integer I,f,num
2. Set f=1,num=8
3. Repeat for i=1 to num
4.     f=f*i
5. End loop
6. Print f

A.    0

/
B.    40320

C.     8

D.    1

Q44.
What will be the output of the following pseudocode?
1.int p=2,q=6,r=9,i
2.if(6 > p + q)
3.       for(i=1 t0 3)
4.       p=p+q
5.       q=q+1
6.       end for loop
7.r=p-q
8.print p,q,and r

A.23 9 9

B.32 10 22

C.2 6 9

D.15 8 7

Q45.
What will be the output of the following pseudocode?
1.int p=2,q=6,r=9,i
2.if(r>p+q)
3.       for(i=1 to 3)
4.                 p=p+q
5.                 q=q+1
6.       end for loop
7.r=p-q
8.print p,q and r

A.32 10 22

B.23 9 9

C.15 8 7

D.23 9 14

Q46.
What will be the output of the following pseudocode?
1.integer i,j,sum,n
2.Set sum=0,n=7
3.Repeat for i=1 to n
4.       sum=sum+(i * i)
5.End loop
6.print sum

A.104

B.64

/
C.8

D.49

Q47.
what will be the output of the following pseudocode?
Input: Two n-bit integers x and y, where y > 1
if x=0 then
 return (q,r)=(0,0)
else
set(q,r)=divide([x/2],y);
q=2*q,r=2 * r;
if x is odd then
r=r+1
end
if r > y then
r=r-y,q=q+1
end
return(q,r)
end

A. The remainder of 'x divided by y' operation

B. The quotient and remainder of 'x divided by y' operation 

C. None of the mentioned options

D. The quotient of 'x divided by y' operation

Q48.
What will be the output of the following pseudocode?
n=1
Integer a, b, c, ai, b1, c1, a2, b2, c2
Set a1 = 2, b1 = 45 and c1 = 36
Set a2 = 11, b2 = 26 and c2 = 30
C = C1 + c2
b = c/ 60
C = C mod 60
b = b + b1 + b2
a = b / 60
b = b mod 60
a = a + a1 + a2
Print a:b:C

A.14:12:1

B. 13:12:66

C.13:71:66

D.14:12:6

Q49.
What will be the output of the following pseudoocde?
1.     Integer result and set num1=5,num2=7,num3=8
2.     If(num1>num2)
3.            If(num1>num3)
4.                    result=num1
5.            Else
6.                      result=num3
7.     Else if(num2>num3)
8.                  result =num2
9.     Else
/
10.           result=num3
11.  Print result

A.    4

B.    7

C.     None of these mentioned options

D.    5

Q50.
What will be the probability of selecting a random node from a given singly linked list

A.2(N-1)/N

B.2N-1

C.1/N

D.N/2(N-1)

Q51.
What will happen if there is no base criteria mentioned in a recursive program?

  A.it will obtain a progressive approach

 B.it will not be executed

  C.It will execute in nitely

  D.It will execute until all conditions match

Q52.
What will be the output of the following pseudocode for the input n=6745?
     1.Start
     2.Read n
     3.Assign the given integer to a new variable q and set rn =0
     4.r=q mod 10
     5.rn = rn * 10 +r;
     6.q=q/10
     7.Repeat steps 4 to 6 while q > 0
     8.Print rn

A.    7645

B.   5476

C.   4567

D.   3423

/
Q53.
What will be the output of the following pseudocode if we call fun1() and value of n is 5?
     1.fun(int n, int a)
     2.        If(n == 0) return a
     3.        return fun (n -1,n * a)
     4.fun1(int n)
     5.        return fun(n,1)

A.   120

B.    24

C.   16

D.   15

Q54.
What will be the output of the following pseudocode?
                       1. Integer i,j,sum,n
                       2.Set sum=0,n=7
                       3.Repeat for i=1 to n
                       4.        Repeat for j=1 to n-i
                       5.                    sum=sum + j
                      6.        End loop
                       7.End loop
                       8. Print sum

A.    147

B.    35

C.   56

D.   84

Q55.
Which is the following is a direct search technique?

A.Hashing

B.Tree search

C.Binary search

D.Linear search

Q56.
Which of the following applications use a stack?

A. A paranthesis balancing program

B.Keeping track of local variables at runtime

/
C.Syntax analyzer for a compiler

D.All of the mentioned options

Q57.
Which of the following data structure may give over ow error even though the current number fo elements in its less than its size?

A.    Simple queue

B.    Priority queue

C.     None of mentioned options

D.    Circular queue

Q58.
Which of the following data structure may give over ow error, even though the current number of elements in it is less than its
size? 

A. None of the mentioned options

B. Priority queue

C. Simple queue

D. Circular queue

Q59.
Which of the following graph analysis algorithms would be applied for nding shortest path in a weighted graph. Weights and can
also be used for nding transitive closure of a relation R?

A.Dijkistra’s Algorithm

B.Prim’s Algorithm

C.Meshy’s Algorithm

D.Floyd’s Algorithm

Q60.
Which of the following statements is true regarding linked list implementation of a stack?

A.The link list can not be implemented using stack

B. In a push operation if new nodes are inserted at the end,then in pop


operation nodes must be removed from the beginning

C.In a push operation ,if new nodes are inserted at the beginning of a linked
list then in operation ,nodes must be removed from at the end

/
D.None of the mentioned options

Q61.   The running time T(n). where "n" is the input size of a recursive algorithm is given as follows: 
T(n) = c + T(n-1), if n>1 T(n) = d, if n <1 
The order of this algorithm is: 

n3               

    n  

nn       

    n2

Q62.  what will be the necessary condition to get the location of the desired element from a given array using the following algorithm? 
I. IF LOC = -1 do ITEM NOT FOUND
 2. Do_Something(DATA, N, ITEM, LOC) 
3. 1. Initialize counter set LOC= , LOW=., HI= N-1 
4. 2. [Search for Item] Repeat while LOWs HI 
5. 2.1 MID=(LOW+HI)/2,
 6. 2.2 IF ITEM= DATA[MID] do
 7. 2.3 LOC=MID
 8. 2.4 Return LOC
 9. 2.5 IF ITEM < DATA [MID] 
10. 2.5.1 HI = MID-1
 11. 2.6 ELSE 
12. 2.6.1. LOW= MID +I 

 The elements in the array should be unsorted

No pre-condition is required for the algorithm to work properly

The array should contain more than one element

 The elements in the array should be sorted

Q63.  Which of the following is a type of sorting which relatively passes through a list to exchange the rst element with any element
less than it and then repeats with a new rst element? 

Heap sort

Quick sort

/
Bubble sort 

Merge sort

Q64. 1)What will be the output of the following pseudocode?


int a=9,b=7,c=8,d=4,e
e=a+b+c+d/4
if(e>5)
Print “PASS”
else
print”FAIL”

Pass

Fail

Q65. An implementation of a queue 0, using two stacks S1 and S2, is given below: 
1. void Insert(Q,x) 
2. { 
3. push(S1,x);
 4. }
5. void delete(Q,x) 
6. { 
7. If(stack-empty(S2)) then
 8. if(stack-empty(S1)) then
 9. {
10. print("Q is empty"); 
11. return;
 12. } 
13. else while(' stack-empty(S1)) 
14. {
 15. x=pop(S1); 
16. push(S2,x);
 17. }
18. x=pop(S2); 
19. } 
Let "n" insert and "m (5 n)^ delete operations to be performed in an arbitrary order on an empty queue air. Let "x" and -r be the
number of push and pop operations performed respectively in the process. Which of the given options is I= for all on and n?

n + m< x < 2n and 2m< n + m 

2m <x < 2nand2m < y <n+m 

2m < x <2n and 2m < y < 2n

 n+m <x<2nand2m <y <2n 

Q66. consider a list of 12 numbers:


/
44,33,11,55,77,90,40,60,99,22,88,66
If we try to sort the list using quick sort by taking 44 as pivot element,then which of the following  list will be obtained after the
fourth iteration ?

22,33,11,40,44,90,77,60,99,55,88,66

22,33,11,55,77,90,40,60,99,44,88,66

22,33,11,77,44,40,90,60,99,55,88,66

22,33,55,11,77,90,40,60,99,44,88,66

Q67. Consider following given algorithm and identify the task performed by this. 
1. bstree(*tree) 
2. { 
3. while((tree->left 1=null)88 (tree->right !=null))
 4. {
 5. if(tree->left < tree->root)
 6. bstree(tree->left); 
7. else 8. return(!); 
9. tf(tree->right > tree->root) 
10. bstree(tree->right); 
11. else 
12. return(1);
 13. } 
14. return(0); 
15. }

 None of the mentioned options


 

Bubble sort

Tests whether a Binary Tree is a Binary Search Tree 

Prim's algorithm

Q68. Consider H as a hashing function which is used to hash n keys into a table of size m. where n<rm. the expected number of
collisions involving a particular key x is:

less than n 

C less than n/2 

/
n less than 1

 c less than m

Q69. consider the functions and their complexities:


F1(n)=2n
F2(n)=n(3/2)
F3(n)=nlogn
F4(n)=n(logn)
Which among the following options correctly represents the increasing order of asymptotic complexity of the functions F1,F2,F3,F4
respectively?
    

F3<F2<F4<F1

None of the mentioned options


  

F3<F2<F1<F4

  F2<F3<F1<F4

Q70. Consider the main function and fun1() implementations. What will be the output of the following pseudocode?
1. Int a
2. Int main()
3.       While(a)
4.                    fun1()
5.                     main()
6.           Print ower
7. Int fun1()
8.          Print lily

Flower lily

Lily

In nite loop

Flower

Q71. For which of the following conditions sir will be printed? 


X=10,y=20,z=30; 
if ( x > z) 
2. if ( z < y)
 3. Print A 
4. else
 5. Print B
6. end if
 7. else 
8. if (y > z )
 9. Print C
 10. else
 11. Print D
 12. end if
/
 13. end if

 y > z

x>z>y

 z > x

x>y>z

Q72. Given expression is an example of which type of notation? 


(A + B) * C
 

Pre x

In x

Post x

None of the mentioned options

Q73. How many edges are present in a complete binary tree with 16 leaf nodes? 

14                             

   28

  32                         

   30

Q74. How much time will be required to generate all the connected components in an undirected graph G with ‘n’ vertices and ‘e’ edges
when the graph is represented by an adjacency list?

O(e2)

O(n)

O(e+n)

/
O(e)

Q75. If a node having two children is deleted from a binary tree it is replaced by its ?

in-order predecessor

pre order predecessor

in-order successor

None of the mentioned options

Q76. If L is the left node, M is the root node and R is the right node of a binary  tree then an L-M-R traversal can be termed as :

Post order traversal

pre order traversal

None of the mentioned options

In – order traversal

Q77. If the address of A[1][1] are 1000 and 1010 respectively and each elements occupies 2 bytes then an array has been stored in
________order

Matrix major

column major

row major

None of the mentioned options

Q78. Information about which of the following options is not present in the adjacency matrix representation of a graph? 

Parallel edges

/
Nodes

Direction of edges

Edges

Q79. Records are randomly distributed by a hash function in a space that can hold N number of records . The probability that the  mth
 record is the rst  record to result in a collision is:

[(N-1)(N-2)…(N-(m-2))(m-1)]/Nm-1

 [(N-1)(N-2)…(N-(m-1))(m-2)]/Nm

[(N-1)(N-2)…(N-(m-2))(m-1)]/N

[(N-1)(N-2)…(N-(m-1))(m-2)]/Nm-1

Q80. The complexity of the insertion sort algorithm in worst case is:

O(n2)

O(n log n)

O(n)

O(n-1)

Q81. The number of values that can be held by an array arr(-1…n,1….n) is :

n(n+2)

n(n+1)

n2

/
Q82. The order of an internal node in B+ tree index is the maximum number of children it can have ,suppose that a child pointer takes 6
bytes, the search eld value takes 14 bytes, and the block size is 512 bytes.what is the order of an internal node ?

26

27

24

25

Q83. The pre x form of A-B/ (C • D ^ E) is: 

-/•^ACBDE

-A/B•C-DE 

ABCD•^DE

 -.A/BC•^DE 
 

Q84. what is the pre x form of an in x expression p+q-r*t?

-+pq*rt

None of the mentioned options

-+pqr*t

+pq-*rt

Q85. what will be the output of the following code for the input a=5 and b=6? 
 function do Something(input a, input b) 
 {
 if (b==1) 
 return 0; 
 else
 return a + do something(a, b-1); 
 } 

30     

/
25

   18

125

Q86. What will be the output of the following code?


1. Integer a,b
2. Set a=125,b=122
3. If((a+b) MOD  2 NOT EQUALS 0)
4.        While(a>0)
5.               b=a+b
6.                a=a/5
7.         End while
8.         Print b
9. Else
10.        a=a-b
11.       a=a/2
12.       Print a
13. End if

234

278

27

Q87. What will be the output of the following pesudocode?


1. Integer i=0
2. i=i+12
3. print i
4. if(i<60)
5.       goto line number 2
6. Else
7.        Print i+1
8. End if

None of the mentioned options

0 12  24 25

12  24 36 48  60 61

0 12  0 12 13

Q88. what will be the output of the following pseudo co de  ? 


1. Integer x 
2. Set x = 0
 3. if(x IS EQUAL TO 1)
 4.         if(x IS EQUAL TO 3) 
5. Print "Inside if"
 6. else
 7. Print "Inside else if"
 8. end if
 9. else
 10. Print "Inside else"
/
 11. end if

 Inside else 

Inside else if
 

Inside if Inside else

 Inside if

Q89. What will be the output of the following pseudo code? 


1. Integer a, b, v, c
 2. Set a = 5, b = 6,v=90
 3. while(v > 8) 
4. a = a + v 
5. c = (a + b) mod 10
 6. while(c > 9) 
7. b = b - a 
8. c = c – 1
 9. end while
 10. v = v / 2 
11. end while
 12. Print b, c

16 82

150 12

69

no output

Q90. what will be the output of the following pseudo code?


   Integer a ,b
  Set a = 10, b = 7 
 for(int i = 1; i<= 5; i++ ) 
 a =a+i+ b 
 while ( a > 6 ) 
a = a + b 
 b = b - 1 
 a = a – 1
 end while 
 Print a 
 End for 

3 2 1 0 -3

3 -3 -8 -15

/
-6 -13 -19-24-28

3 -3 -8 -12 -15

Q91. What will be the output of the following pseudo code?


 Integer result and set num1=5, num2=7, nun3=6 
 if( num1 > num2)
 if(num1 > num3) 
 result = num1 
 else
 result = num3 
 else if(num2 > num3) 
 result = num2
 else 
 result = num3 
 Print result 

 none of the mentioned options

 5

Q92. What will be the output of the following pseudo code?


int p = 4, q = 7, r = 10 
p = q Mod r 
q=q+p 
r=r+q
Print p, q and r 

7 11 17 

1 4 21 

7 14 24 

4 11 17

Q93. What will be the output of the following pseudo code?


Integer n, rev, rem, org
Set n = 61206, rev = 0
Set org = n 4. Repeat while n NOT EQUALS 0
rem = n Mod 10 
rev = rev * 10 + rem
n = n / 10 
End while 
If (org IS EQUAL TO rev) 
Print rev 
Else 
Print (org - rev) / 6 
/
End If 

61206   

 0

60216 14    

  165

Q94. What will be the output of the following pseudo-code if we call fun()and the value of n is 5? 
 fun(int n, int a) 
 if ( n == 0) return a
  return fun ( n- 1, n * a)
 fun1( int n)
 return fun( n, 1) 

15

120

16

24

Q95. What will be the output of the following pseudo-code n=7? 


Integer t, j, sum, n 
Set sum=0, n=7: 
Repeat for i = 1 to n 
sum= sum + ( i * i) 
End loop
Print sum 

64   

  49

8   

140

Q96. What will be the output of the following pseudo-code? 

1 int p = 2, q = 6, r = 9, i
2
3 if ( r>p+ q)
4
5 for (i = 1 to 3 ) /
5 for (i 1 to 3 )
6
7 p=p+q
8
9 q=q+1
10
11 end for loop
12
13 r=p-q
14
15 print p, q and r

23 9 9

 32 10 22

23 9 14

15 8 7

Q97. What will be the output of the following pseudo-code? 


  Declare variable x, y and i
  Set x =0 and y = 1 
  for(t=1; i<=4; i=i+1) 
  print x 
 x=x+y
  y = x /y
  End for loop 

0138

0124

1024

0123

Q98. What will be the output of the following pseudo-code? 


    Integer a = 1, b = 2 
    for ( int i = 0; i<= 6;i= i + 2
   a =a+b+ i.
   a = a + b 
   b = a – b
   Print b 
   end for 

3 10 27 70

3 10 27 71

3 9 23 70

/
3 7 10

Q99. What will be the output of the following pseudo-code ?


int i =5,j=7
if (i+j > 5)
j=i + 2 
if ( j < 5 )
print i.
else 
print j
Else
print i+1 

12

Q100. What will be the output of the following pseudocode ?


int m = 3, n = 2, o = 4
while ( n > 0)
m=m*0+n ;
n = n - 1 
end while loop 
o=o+m
print m, n, o 

3 24 

    2 3  4    

2 16

 1  0 5

Q101. What will be the output of the following pseudocode for a = 3? 

1 void fun(int a)
2 if(a<l)
3 return;
4 else
5 print a
6 fun(a-2)
7 print a
8 return
9

 210

/
3113

12

2112 

Q102. What will be the output of the following pseudocode for a given array a[5] = 3, 4, 6, 1, 2 
and pos=2? 
[Note: n = the size of the array i.e. 5 and starting array index is 0) 
Declare i, j, n, pos
Repeat for j=pos to n-1 
Set a[j] =a[j+1]
End for loop
n=n-1; 
Display the new array 
End 

324612

3412

3612

34212 

Q103. What will be the output of the following pseudocode for input 134? 
1. 1. int funl (int num) 
2. 2. static int a = 0 
3. 3. if ( num > 0) 
4. 4. ara+1 
5.5. fungnum/10) 
6. 6. else 
7. 7. return a 
Note:[ Static variables have a property of preserving their value even after they are out of their scope]

431

Q104. What will be the output of the following pseudocode for input 7?
1. Read the value of N
2. Set m=1,T=0
3. If m>N
4. Go to line no.9
5.     Else
6.        T=T+m
7. m=m+1
8. go to line no.3
9. Display  the value of T
10. Stop

/
34

72

56

28

Q105. What will be the output of the following pseudocode for input a = 8 and b = 9?
 function(input a, input b) 
 if(a < b) 
 return function(b,a)
 else if(b != 0)
 return(a + function(a, b-1)) 
 else 
 return 0 

 88

 56

None of the mentioned options   

 72  

65

Q106. What will be the output of the following pseudocode for num=5456? 
Start 
Take a variable num, j, temp and an array digit[ ] 
set k=0, len=0, n=num
Repeat while n is not equal to 0 
digit[k]=n mod 10
set n=n/10 
Set k=k+1
End While 
len=k
Set k=0 
Repeat for k to len-1
Check If digit[k] is greater than digit[k+1] 
Set temp=digit[k] 
Set digit[k]=digit[k+1]
Set digit[k+1]= temp
Repeat for j=0 to len
Set num= num+ (digit[j]* pow(10,k)) 
End for
End If 
End For 
Print num 
Stop 

7676

 28787

/
5456

None of the mentioned options

Q107. What will be the output of the following pseudocode for the input x=22 and y=3?
 Start 
 Declare x, y,m, n
  Set m = x and n = y 
 while m not equal to n then
 if m greater than n
  m = m – 1
  Otherwise
  n = n - 1 
 End if 
 End while
  Print n 

12

None of the mentioned options

Q108. What will be the output of the following pseudocode if n = 40 and LIMIT = 1000? 
1. Integer fun2(1nteger n) 
2. if( n < = 0) 
3. return 1 
4. end if 4
 5. if ( n > LIMIT) 
6. return 2 
7. end if
 8. Print n 
9. fun2(2 * n)
 10. Print n 
11. End function fun2() 

40,80,160,320,640

40,80,120,240,480,960

640

40,80,160,320,640,320,160,80,40

Q109. What will be the output of the following pseudocode? 


  Integer i, j, sum, n
  Set sum=0, n=7 
  Repeat for i = 1 to n
   set  sum=+(i*i) 
   End loop 
   Print sum
/
204

49

64

Q110. What will be the output of the following pseudocode? 


1. Integer a, b, c 
2. Set a = 3, b = 5, c=1
 3. a = a+b+c-8.
4. b = a+ c - 8 
5. if ( a > b) 
6. Print Fine 
7. else
 8. Print Thankyou

Thankyou 

Fine Thankyou

Fine

Nothing will be printed

Q111. What will be the output of the following pseudocode? 


1. Integer i, j
 2. for(i = 2; i < 25; in) 
3. for(j = 2; j <= (i/j); j++)
 4. if(!(i MOD j)) 
S. JUMP out of the loop 
6. end if 
7. if(j is greater than ( i/j ))
 8. Print i 
9. end if 
[Note: ! Operater here basically inverts true to false and false to true] 

2 3 5 8 11 14 17 19 23 

 1 3 7 11 13 17 19 23 25

2 4 5 8 11 12 17 14 23 

2 3 5 7 11 13 17 19 23 

Q112. What will be the output of the following pseudocode?  /


1. Integer x,Y 
2. Set x = 4, y=7
3. x = x + y 
4. y = x - y 
5. X = x + 4 
6. Print x, y 

47 

   None of the mentioned options 

11 4 

15 4

Q113. What will be the output of the following pseudocode? 


1. Integer x=1, y
 2. for( each x from 1 to 9)
 3. x = x + 1
 4. end for 
5. Print x 

11 

10

12

Q114. What will be the output of the following pseudocode?


1. Int a=18,b=4,i
2. If(a>b)
3.            If(a+b >14)
4.                     Print a
5.            Else
6.                      for(i=1 to 3)
7.                               a=a+i
8.                      End for loop
9.                      Print a
10.                        Print b

14

/
16

18 18 4

Q115. What will be the output of the following pseudocode?


1. Int p=4,q=7,r=10
2. p=q mod r
3. q=q+p
4. r=r+q
5. print p,q and r

7  11 17

7  14   21

7  14 24

4  11   17

Q116. What will be the output of the following pseudocode?

1.Integer a,b,count=0,count1=0

2.Set a=1,b=1
 
3.while(a<=5)

4.b=1

5.while(b<=5)

6.b=b+1

7.count1 = count1 + 1 

8.end while

9.a = a + 1

10.count = count + 1

11. end while 

12.Print count, count1

5  25

24 5 

5 5  

25 5
/
Q117. What will be the output of the following pseudocode?
1.int m= 0, n=13, ag = 0, i
2. m = n/2 
3. for (i = 2 to m)
 4. if (n mod i = 0)
 5. ag = 1
 6. go to line number 9
 7. end if 
8. end for loop 
9. if( ag = 0) 
10.            print 0
11. else print 1

13

Q118. what will be the output of the following pseudocode ?


Integer n,rev,rem,orig
Set n=61206,rev=0;
Set orig=n
Repeat while n not Equals 0
rem=n MOD 10
rev = rev * 10 + rem
n=n/10
end while
if(orig IS EQUAL To rev)
print  rev
else
print (orig-rev)/6
end if

165

61206

60216

Q119. What will be the output of the following pseudocode 


1. Integer x, y, z
 2. Set x = 10, y = 12, z = 12 
3. z = (x + y) /0 // Line 3 
4. if(z IS EQUAL TO 12) 
5. Print successful 
6. else
 7. Print unsuccessful 

error at line 3
 

/
Logical error 

unsuccessful 

successful

Q120. What will be the output of the following pseudocode 


1. Integer y , z , k , c
 2. Set y = 8, z= 3, k= 1 
3. if ( z + k < y )
 4. if( z MOD 2 NOT EQUALS 0
 5. c = y + z 
6. else 
7. c = y + k 
8. y=y+z+k+e 
9. else 
10. y = y+c+k
 11. end if
 12. Print y 

21

23

20

Q121. What will be the output of the following pseudoocde?


1. Integer a,b
2. Set a=10, b=7
3. for(int i=1;i<=5;i++)
4.          a=a+i+b
5.         While(a>6)
6.                    a=a+b
7.                    b=b-1
8.                     a=a-1
9.          End while
10.          Print a
11. End for

-6 -13-19-24-28

3 2 1 0 -3

3 -3-8-12-15

3-3-8-15

Q122. what will be the probability of selecting a random node from a given singly linked list?

/
1/N

2N-1

N/2(N-1)

2(N-1)N

Q123. What will be  the output of the following pseudocode?


1. Int  j= 41,k=37
2. j=j+1
3. k= k-1
4. j=j/k
5. k=k/j
6. print k,j

36 1

11

1  36

42 36

Q124. What will be  the output of the following pseudocode?


1. Integer a=1,b=2
2. for(int i=0;i<=6;i=i+2)
3.          a=a+b+i
4.           a=a+b
5.           b=a-b
6.          Print b
7. End for

3  10   27 71

3  10   27 70

3  7 10

3  9 23  70

Q125. what will happen if there is no base criteria mentioned in a recursive program?

it will not be executed 

/
it will execute until all conditions match

it will execute in nitely

it will obtain a progressive approach

Q126. What  will be the output of the following pseudocode a=1?


fun(int a)
if(a  < 1 )
return
else
Print a
fun(a-1)
Print a
Return

11

12

2112

321123

Q127. Which of the following graph analysis would be applied for nding shortest paths it is a weighted graph and can also be used for
nding  transitive closure of a relation R?

Meshy’s algorithm

Prim’s algorithm

Floyd’s algorithm

Dijikstra’s algorithm

Q128. Which of the following is a direct search technique?

Tree search 

Linear search

/
Hashing

Binary search 

Q129. Which of the following is the correct pseudocode for validating the entered date is correct or not? 

1. Input dd, mm and yy 


2. 2. If yy>=1900 and yy<=9999 
3. 3. If nm>=1 and mm<=12
4.  4. If (dd>81 and dd<=31) or (mm=: and mn81 and mm=c. and mm87 and
mm=5 and mm=10 and mm=12))
5.  5. Print Date is valid
6.  6. Use If (dd>=1 and dd<=30) or (mm=4 and mm=o and mm=9 and mm=11)) 
7. 7. Print Date is valid
8.  8. Else If (dd>=1 and dd<=28) or (mm=2)) 
9. 9. int Date is valid 
10. 10. Else If(dd=29 and m=2 or (yy%400=0 and (yy%4=0 and yy%108:=0)) 
11. 11. Print Date is valid 
12. 12. Else Print Day is invalid 
13. 13. End If 
14. 14. Else Print Month is invalid 
15. 15. End If 
16. 16. Use Print Year is invalid 
17. 17. 1+. End If

1. Input dd, run and yy 


2. 2. If yy>=1908 and yy<=9999 
3. 3. If nm>=1 and mnc=12 
4. 4. If (dd>=1 and dd<=31) and (mm=1 or mm=3 or mm=5 or mm=7 or mm=8
or m=10 or mm=12)) 
5. 5. Print Date is valid
6.  6. Else If (dd>=1 and ddc=30) and (mm=4 or mm=6 or mm=9 or mm=11)) 
7. 7. Print Date is valid 
8. 8. Else If (dd>=1 and ddc=28) and (mm=2)) 
9. 9. Print Date is valid 
10. 10. Else If(dd=29 and mm=2 and (yy%400=0 or (yy%4=0 and yy%100!=0)) 
11. 11. Print Date is valid 
12. 12. Else Print Day is invalid 
13. 13. End If 
14. 14. Else Print Month is invalid 
15. 15. End If 
16. 16. Else Print Year is invalid
17.  17. End If

    1. Input dd, mm and yy


2. If yy>=1900 and yy<=9999
 3. If mm>=1 and man 
4. If (dd>=1 or dd<=31)an. d (M7=1 or AM=3 or AM=5 or 1711=7 or M7=8 Or
WW16 or mm=12)) 5. Print Date is valid 
6. Else If (dd>=1 or dd<=30) and (mm=4 or mm=6 or mm=9 or mm=11)) 
7. Print Date is valid 
8. Else If (dd>=1 or ddc=28) and (mm=2)) 
9. Print Date is valid
 L0. Else If(dd=29 or mm=2 and (yy%400=0 or (yy%4=0 and yy%100I=0)) 
11. Print Date is valid 
12. Else Print Day is invalid 
13. End If 
14. Else Print Month is invalid 
15. End If Le 
16. Else Print ‘fear is invalid 
17. End If 

/
  None of the mentioned options

Q130. Which of the following would store the information of an array which is used in a program? 

Activation record

System table

Symbol table 

Dope vector

Q131. Which of the following operators can be pre x or post x?

Increment and Decrement Operators


 

 Bitwise Operators
 

 All of the mentioned options 

Cast Operators

Q132. What will be the output of the following pseudocode?


Integer a, b, c, d, e 
Set a = 20, b = 9, C = 88, d = 30 
e = c mod a 
a=a+b+e
d= c mod a 
print d

37

14

12

Q133. What will be the output of the following pseudocode?


Integer num, x, y, count
Set num = 85, count = 0
x = num = 1
y = x^ num
y=y+1
while ( y / 2 ) NOT EQUALS )
if (y MOD 2 NOT EQUALS 0)
count = count + 1
else
              y = y / 2
/
if
              end while if (count)
Print "0";
Print y ;
 else
              Print "1"
Print x;
              end if

A. 33

B. 23

C. 43

D. None of the mentioned options

Q134. What will be the output of the following pseudocode?


Integer a , b
Set a = 2, b = 50
while( b>0);
a = b MOD 2 + a
if ( a MOD 3 IS EQUAL TO 0);
Print (a);
else
print(b-1)
              Print b = b / 5;
              a = a + 1
end while;

A. 49 31

B. 50 102

C. 3 33

D. 50 32

Q135. What will be the output of the following pseudocode?


           1. int a =10,b=4,i
           2.if(a>b)
           3.        if(a + b > 14)
           4.                    print a
           5.        else
           6.                    for( i= 1 to 3)
           7.                    a =a + i
           8.                    end for loop
           9.                    print a
           10.else
           11.      print b

A.    14

B.    10

C.   16

D.   4

/
Answer Key & Solution
Section 1 - technical
Q1
only 1,3, and 4

Solution

No Solution

Q2
C.   2 1 1 2

Solution

No Solution

Q3
 A. (N-1)(N-2)...(N-(m - 1)/(m - 2)]/NM-1

Solution

No Solution

Q4
D.10

Solution

No Solution

Q5
A.n

Solution

No Solution

Q6
B. Statement s1 will be executed

Solution

No Solution

Q7
A.    One sixth of the product of the 3 consecutive integers

Solution

No Solution

Q8
B.3

Solution

No Solution
/
Q9
C. 19000

Solution

No Solution

Q10
D. 2H-1 - 1 

Solution

No Solution

Q11
A.All the mentioned options are correct

Solution

No Solution

Q12
A.All the mentioned options are correct.

Solution

No Solution

Q13
D.3

Solution

No Solution

Q14
C. Inorder successor

Solution

No Solution

Q15
 D.row major

Solution

No Solution

Q16
A. Parallel edges

Solution

No Solution

Q17
D. 358 

/
Solution

No Solution

Q18
C.    3

Solution

No Solution

Q19
A.31

Solution

No Solution

Q20
B.    Only the rear will change

Solution

No Solution

Q21
C.    3 & 3

Solution

No Solution

Q22
A.    n

Solution

No Solution

Q23
D.0 1 2 4

Solution

No Solution

Q24
D.2 4

Solution

No Solution

Q25
A.    20

Solution

/
No Solution

Q26
B. 3 4 1 2

Solution

No Solution

Q27
D.    64

Solution

No Solution

Q28
D. 16

Solution

No Solution

Q29
B. 3

Solution

No Solution

Q30
C. None of the mentioned option

Solution

No Solution

Q31
B. 45, 72

Solution

No Solution

Q32
A.343 343

Solution

No Solution

Q33
B.278

Solution

No Solution

Q34 /
B. 7

Solution

No Solution

Q35
B. 1

Solution

No Solution

Q36
B.12 13 23 45 67

Solution

No Solution

Q37
C. 57 0 62  

Solution

No Solution

Q38
B. 49 3 1  

Solution

No Solution

Q39
C.336

Solution

No Solution

Q40
A.    45 72

Solution

No Solution

Q41
A. 2  3

Solution

No Solution

Q42
B.    3 10 27 70

Solution
/
No Solution

Q43
B.    40320

Solution

No Solution

Q44
C.2 6 9

Solution

No Solution

Q45
D.23 9 14

Solution

No Solution

Q46
A.104

Solution

No Solution

Q47
B. The quotient and remainder of 'x divided by y' operation 

Solution

No Solution

Q48
A.14:12:1

Solution

No Solution

Q49
B.    7

Solution

No Solution

Q50
C.1/N

Solution

No Solution

Q51 /
  C.It will execute in nitely

Solution

No Solution

Q52
B.   5476

Solution

No Solution

Q53
A.   120

Solution

No Solution

Q54
C.   56

Solution

No Solution

Q55
C.Binary search

Solution

No Solution

Q56
D.All of the mentioned options

Solution

No Solution

Q57
A.    Simple queue

Solution

No Solution

Q58
D. Circular queue

Solution

No Solution

Q59
D.Floyd’s Algorithm

Solution
/
No Solution

Q60
D.None of the mentioned options

Solution

No Solution

Q61
nn       

Solution

No Solution

Q62
 The elements in the array should be sorted

Solution

No Solution

Q63
Quick sort

Solution

No Solution

Q64
Pass

Solution

No Solution

Q65
n + m< x < 2n and 2m< n + m 

Solution

No Solution

Q66
22,33,11,40,44,90,77,60,99,55,88,66

Solution

No Solution

Q67 /
Tests whether a Binary Tree is a Binary Search Tree 

Solution

No Solution

Q68
n less than 1

Solution

No Solution

Q69
F3<F2<F4<F1

Solution

No Solution

Q70
In nite loop

Solution

No Solution

Q71
x>y>z

Solution

No Solution

Q72
In x

Solution

No Solution

Q73
  32                         

Solution

No Solution

Q74
O(e+n)

/
Solution

No Solution

Q75
in-order successor

Solution

No Solution

Q76
pre order traversal

Solution

No Solution

Q77
row major

Solution

No Solution

Q78
Edges

Solution

No Solution

Q79
[(N-1)(N-2)…(N-(m-1))(m-2)]/Nm-1

Solution

No Solution

Q80
O(n2)

Solution

No Solution

Q81
n(n+2)

Solution

/
No Solution

Q82
26

Solution

No Solution

Q83
-A/B•C-DE 

Solution

No Solution

Q84
-+pq*rt

Solution

No Solution

Q85
30     

Solution

No Solution

Q86
278

Solution

No Solution

Q87
12  24 36 48  60 61

Solution

No Solution

Q88
 Inside else 

Solution

No Solution
/
Q89
no output

Solution

No Solution

Q90
3 -3 -8 -12 -15

Solution

No Solution

Q91

Solution

No Solution

Q92
7 14 24 

Solution

No Solution

Q93
  165

Solution

No Solution

Q94
120

Solution

No Solution

Q95
140

Solution

No Solution

Q96
23 9 14

Solution

/
No Solution

Q97
0124

Solution

No Solution

Q98
3 10 27 70

Solution

No Solution

Q99
7

Solution

No Solution

Q100
 1  0 5

Solution

No Solution

Q101
3113

Solution

No Solution

Q102
3412

Solution

No Solution

Q103
3

Solution

No Solution
/
Q104
28

Solution

No Solution

Q105
 72  

Solution

No Solution

Q106
None of the mentioned options

Solution

No Solution

Q107
3

Solution

No Solution

Q108
40,80,160,320,640,320,160,80,40

Solution

No Solution

Q109
49

Solution

No Solution

Q110
Fine

Solution

No Solution

Q111
2 3 5 7 11 13 17 19 23 

Solution

No Solution

/
Q112
15 4

Solution

No Solution

Q113
10

Solution

No Solution

Q114
18 18 4

Solution

No Solution

Q115
7  14 24

Solution

No Solution

Q116
5  25

Solution

No Solution

Q117
0

Solution

No Solution

Q118
165

Solution

No Solution

Q119
Logical error 

/
Solution

No Solution

Q120
21

Solution

No Solution

Q121
3 -3-8-12-15

Solution

No Solution

Q122
1/N

Solution

No Solution

Q123
36 1

Solution

No Solution

Q124
3  10   27 70

Solution

No Solution

Q125
it will execute in nitely

Solution

No Solution

Q126
11

/
Solution

No Solution

Q127
Floyd’s algorithm

Solution

No Solution

Q128
Hashing

Solution

No Solution

Q129

1. Input dd, run and yy 

2. 2. If yy>=1908 and yy<=9999 

3. 3. If nm>=1 and mnc=12 

4. 4. If (dd>=1 and dd<=31) and (mm=1 or mm=3 or mm=5 or mm=7 or mm=8 or m=10 or mm=12)) 

5. 5. Print Date is valid

6.  6. Else If (dd>=1 and ddc=30) and (mm=4 or mm=6 or mm=9 or mm=11)) 

7. 7. Print Date is valid 

8. 8. Else If (dd>=1 and ddc=28) and (mm=2)) 

9. 9. Print Date is valid 

10. 10. Else If(dd=29 and mm=2 and (yy%400=0 or (yy%4=0 and yy%100!=0)) 

11. 11. Print Date is valid 

12. 12. Else Print Day is invalid 

13. 13. End If 

14. 14. Else Print Month is invalid 

15. 15. End If 

16. 16. Else Print Year is invalid

17.  17. End If

Solution

No Solution

Q130
/
Dope vector

Solution

No Solution

Q131
 All of the mentioned options 

Solution

No Solution

Q132
14

Solution

No Solution

Q133
D. None of the mentioned options

Solution

No Solution

Q134
A. 49 31

Solution

No Solution

Q135
C.   16

Solution

No Solution

/
Capgemini tech

Section 1- technical

1. Which one of the following sentences is true?

a) The body of a while loop is executed at least once.

b) The body of a do ... while loop is executed at least once.

c) The body of a do ... while loop is executed zero or more times.

d) A for loop can never be used in place of a while loop.

2. Which one of the following is not a linear data structure?

a) Array

b) Binary Tree

c) Queue

d) Stack

3. How many digits are present after the decimal in float value?

a) 1

b) 3

c) 6

d) 16
4. In a 32-bit compiler, which 2 types have the same size?

a) Char and short

b) short and int

c) int and float

d) float and double

5. There are two groups of string functions defined in the header

<string.h>.

What are they?

a) first group names beginning with str; second group names beginning

with mem

b) first group names beginning with str; second group names beginning

with is

c) first group names beginning with string; second group names

beginning with mem

d) first group names beginning with str; second group names beginning

with type

6. What is the use of function char *strchr(ch, c)?

a) return pointer to first occurrence of ch in c or NULL if not present


b) return pointer to first occurrence of c in ch or NULL if not present

c) return pointer to first occurrence of ch in c or ignores if not present

d) return pointer to first occurrence of cin ch or ignores if not present

7. Which code from the given option return pointer to last occurrence of c

in ch or NULL if not present?

a) char *strchr(ch, c)

b) char *strrchr(ch, c)

c) char *strncat(ch, c)

d) char *strcat(ch, c)

8. Which among the given options compares atmost n characters of string

ch to string s?

a) int strncmp(ch, s, n)

b) int strcmp(ch, s)

c) int strncmp(s, ch, n)

d) int strcmp(s, ch)

9. Which among the given options is the right explanation for the

statement size_t strcspn(c, s)?


a) return length of prefix of s consisting of characters not in c

b) return length of prefix of s consisting of characters present in c

c) return length of prefix of c consisting of characters not in s

d) return length of prefix of c consisting of characters present in s

10.What is the function of void *memset(s, c, n)?

a) places character s into first n characters of c, return c

b) places character c into first n characters of s, return s

c) places character s into first n characters of c, return s

d) places character c into first n character of s, return c

11.Functions whose names begin with “strn”

a) manipulates sequences of arbitrary characters

b) manipulates null-terminated sequences of characters

c) manipulates sequence of non – null characters.

d) returns a pointer to the token

12.What is the function of strcoll()?

a) compares the string, result is dependent on the LC_COLLATE

b) copies the string, result is dependent on the LC_COLLATE


c) compares the string, result is not dependent on the LC_COLLATE

d) copies the string, result is not dependent on the LC_COLLATE

13.Recursive functions are executed in a?

a) First In First Out Order

b) Load Balancing

c) Parallel Fashion

d) Last In First Out Order

14. The worst case time complexity of AVL tree is better in comparison

to binary search tree for

a) Search and Insert Operations

b) Search and Delete Operations

c) Insert and Delete Operations

d) Search, Insert and Delete Operations

15.In which tree, for every node the height of its left sub tree and right

sub tree differ almost by one?

a) Binary search tree

b) AVL tree
c) Threaded Binary Tree

d) Complete Binary Tree

16.A language has 28 different letters in total. Each word in the language

is composed of maximum 7 letters. You want to create a data-type to

store a word of this language. You decide to store the word as an array of

letters. How many bits will you assign to the data-type to be able to store

all kinds of words of the language?

a) 7

b) 35

c) 28

d) 196

17.Parul takes as input two numbers: a and b. a and b can take integer

values between 0 and 255. She stores a, b and c as 1-byte data type. She

writes the following code statement to process a and b and put the result

in c. c = a + 2*b To her surprise her program gives the right output with

some input values of a and b, while gives an erroneous answer for others.

For which of the following inputs will it give a wrong answer?

a) a = 10 b = 200

b) a = 200 b = 10
c) a = 50 b = 100

d) a = 100 b = 50

18.Which is used to convert source code to target language?

a) Linker

b) Compiler

c) Executer

d) loader

19. Trisha wants to store a list of binary data. Which of following data

types should she use?

a) Integer

b) Float

c) Character

d) Boolean

20. Which of the following options is an exception to being a part of

composite data types?

a) Union

b) Array
c) Structure

d) Stack

21. What will be output of the following program?

int main()

int b[4]={5,1,32,4};

int k,l,m;

k=++b[1];

l=b[1]++;

m=b[k++];

printf(“%d, %d, %d”,k,l,m);

return 0;

}a) 2, 2, 4

b) 3, 2, 32

c) 3, 2, 4

d) 2, 3, 32

22. What is the output of this C code?


#include

void main()

m();

void m()

printf(“SimpleWay2Code”);

a) SimpleWay2Code

b) Compile time error

c) Nothing

d) Varies

23. How many times the program will print “SimpleWay2Code” ?

#include

int main()

{
printf(“SimpleWay2Code”);

main();

return 0;

a) Infinite times

b) 32767 times

c) 65535 times

d) Till stack overflows

24.What will happen if in a C program you assign a value to an array

element whose subscript exceeds the size of array?

a) The element will be set to 0.

b) The compiler would report an error.

c) The program may crash if some important data gets overwritten.

d) The array size would appropriately grow.

25.What is the right way to access value of structure variable book {price,

page}?

a) printf("%d%d", book.price, book.page);


b) printf("%d%d", price.book, page.book);

c) printf("%d%d", price::book, page::book);

d) printf("%d%d", price->book, page->book);

26.Which of the following is not a derived data type in c?

a) Function b) Pointer c) Enumeration d) Array

27.Integral data type is ____?

a) Void b) Char c) Float d) Double

28.The Format Identifier %u is used for?

a) Float b) Char c) Decimal d) Unsigned decimal

29.Size of an int data type is ____?

a) 4 Bytes b) 8 Bytes c) Depends on Compiler/System d) Can’t be

determined

30.Data type qualifiers can be classified into?

a) 4 b) 5 c) 2 d) 8

31.The C language defines ____ fundamental data types.

a) 3 b) 4 c) 5 d) 6
32.In the following loop construct, which one is executed only once

always? for(exp1; exp2; exp3)

a) exp1 b) exp3 c) exp1 and exp3 d) exp1, exp2 and exp3

33.Choose a C Conditional Operator from the list.

a) ?: b) :? c) :< d) <:

34.The value obtained in the function is given back to main by using

________ keyword.

a) Static b) Return C) New d) Volatile

35. What is the return-type of the function sqrt ()?

a) Int b) Float c) Double d) depends on the data type of the parameter

36.What is the default return type if it is not specified in function

definition?

a) Void b) Int c) Double d) Short int

37. What is the output of this C code?int foo();

int main()

int i = foo();
}

foo()

printf("2 ");

return 2;

a) 2

b) Compile time error

c) Depends on the compiler

d) Depends on the standard

38.In C, if you pass an array as an argument to a function, what actually

gets passed?

a) Value of elements in array

b) First element of the array

c) Base address of the array

d) Address of the last element of array

39. Which of the following concepts make extensive use of arrays?


a) Binary trees

b) Scheduling of processes

c) Caching

d) Spatial locality

40. What are the advantages of arrays?

a) Objects of mixed data types can be stored

b) Elements in an array cannot be sorted

c) Index of first element of an array is 1

d) Easier to store elements of same data type

41. Assuming int is of 4bytes, what is the size of int arr[15];?

a) 15 b) 19 c) 11 d) 60

42. Which of these best describes an array?

a) A data structure that shows a hierarchical behaviour

b) Container of objects of similar types

c) Arrays are immutable once initialised

d) Array is not a data structure


43. Entries in a stack are “ordered”. What is the meaning of this

statement?

a) A collection of stacks is sortable

b) Stack entries may be compared with the ‘<‘ operation

c) The entries are stored in a linked list

d) There is a Sequential entry that is one by one

44.What data structure would you mostly likely see in a non recursive

implementation of a recursive algorithm?

a) Linked List

b) Stack

c) Queue

d) Tree

45. Which data structure is needed to convert infix notation to postfix

notation?

a) Branch

b) Tree

c) Queue
d) Stack

46. Which of the following is not an inherent application of stack?

a) Reversing a string

b) Evaluation of postfix expression

c ) Job scheduling

d)Implementation of recursion

47. The type of expression in which operator succeeds its operands is?

a) Infix Expression

b) Prefix Expression

c) Postfix Expression

d) Both Prefix and Postfix Expressions

48. If a two dimensional array is used as a formal parameter, then

a) both the subscripts may be left empty

b) the first (row) subscript may be left empty

c) the first subscript must be left empty

d) both the subscripts must be left empty


49. If arr is a two dimensional array of 10 rows and 12 columns, then arr

(5) logically points to the

a) Sixth row

b) Fifth row

c) Fifth column

d) Sixth column

50. The function that actually created from a call to a template function is

called

a) Generated

b) Inherited

c) Spawned

d) Declassified

51. What is the number of edges present in a complete graph having n

vertices?

a) (n*(n+1))/2

b) (n*(n-1))/2

c) n
d) Information given is insufficient

52. Which among the following statement is right?

a) sizeof(struct stemp*) > sizeof(union utemp*) > sizeof(char *)

b) sizeof(struct stemp*) < sizeof(union utemp*) < sizeof(char *)

c) sizeof(struct stemp*) = sizeof(union utemp*) = sizeof(char *)

d) the order Depends on the compiler

53.Which of the following properties does a simple graph not hold?

a) Must be connected

b) Must be unweighted

c) Must have no loops or multiple edges

d) Must have no multiple edges

54. Which of the following is true?

a) A graph may contain no edges and many vertices

b) A graph may contain many edges and no vertices

c) A graph may contain no edges and no vertices

d) A graph may contain no vertices and many edges


55. A graph with all vertices having equal degree is known as a

__________

a) Multi Graph

b) Regular Graph

c) Simple Graph

d) Complete Graph

56. Improper formation of which of the following data-structures can

cause unintentional looping of a program that uses it.

a) Linked list

b) Array

c) Queue

d) Stack

57. Which of the following is true?

a) Array is a dynamic data structure whose size can be changed while

stacks are static data structures whose sizes are fixed.

b) Array elements can be accessed and modified (elements can be added

or removed) only at the ends of the array while any elements of the stack

can be accessed or modified randomly through their indices.


c) An array can have elements of different data types.

d) Elements of a linked-list can be accessed only sequentially.

58. Which of the following statements is FALSE?

a) The time complexity of binary search is O(log n).

b) A linear search requires a sorted list.

c) A binary search can operate only on a sorted list.

d) The time complexity of linear search is O(n).

59. Esha wrote a function fact ( ) in "C" language to calculate factorial of

a given number and saved the file as fact.c. She forgot to code the main

function to call this fact function. Will she be able to compile this fact.c

without the main () function?

a) Yes, she can compile provided the compiler option -no strict-checking

is enabled.

b) No, she can’t compile as the main function is required to compile any

C program file.

c) Yes, she can compile as main ( ) is not required at compile time.

d) Yes, she can compile and run as the system will supply default values

to fact function.
60. The difference between variable declaration and variable definition is:

a) Declaration and definition are the same. There is no difference.

b) A declaration is used for variables and definition is used for functions.

c) Declaration associates type to the variable whereas definition

associates scope to the variable.

d) Declaration associates type to the variable whereas definition gives the

value to the variable.

61. In C, if you pass an array as an argument to a function, what actually

gets passed?

a) Value of elements in array

b) First element of the array

c) Base address of the array

d) Address of the last element of array

62. Which of the flowing statements should be used to obtain a remainder

after

dividing 3.14 by 2.1?

a) rem = 3.14 % 2.1;


b) rem = modf(3.14, 2.1);

c) rem = fmod(3.14, 2.1);

d) Remainder cannot be obtain in floating point division.

63. Property of external variable to be accessed by any source file is

called by C90 standard as

a) External linkage

b) External scope

c) Global scope

d) Global linkage

64. What is the difference between a function and a method?

a. Function is a named code unlike method which is a part of an object

b. Function contained in an object is called a method

c. Function cannot change variables outside its scope unlike method

d. There is no difference between the two

65. Which of this is used to skip one iteration:

a) continue

b) break
c) goto

d) return

66. Which of the following does not require to include math.h header file?

a) pow()

b) rand()

c) sqrt()

d) sinh()

67. Choose the correct statement

while (0 == 0) { }

a) It has syntax error as there are no statements within braces {}

b) It will run forever

c) It compares 0 with 0 and since they are equal it will exit the loop

immediately

d) It has syntax error as the same number is being compared with itself

68. Predict the output of following code:

main()

{
int a=10,x;

x= a– + ++a;

printf(“%d”,x);

a) 19

b) 20

c) 22

d) 23

69. What is the purpose of ftell?

a) to get the current file position

b) to get the current file attribute

c) to get the current file status

d) to get the current file name

70. What is recursion?

a) Looping

b) a function calls another function repeatedly

c) a function calls repeatedly


d) function calls itself repeatedly

71. What is the similarity between enum and struct?

a) can assign new values

b) can create new data types

c) nothing in common

d) they are same

72. atoi() function is used for:

a) convert ASCII character to integer value

b) convert a character string to its equivalent integer value

c) gets index value of character in an array

d) converts an array of characters to array of equivalent integers

73. Which of the following is NOT declared in string.h?

a) strlen()

b) strcpy()

c) strptr()

d) strupr()

74. Which of the below function is NOT declared in math.h?


a) and()

b) pow()

c) exp()

d) acos()

75. Where are the local variables stored?

a) In a Queue

b) In stack Memory

c) In hard Disk

d) In heap Memory

76. while declaring parameters for main, the second parameter argv

should be declared as

a) char argv[]

b) char argv

c) char ** argv[]

d) char * argv[]

77. Which among the following has the highest precedence?

a) &
b) <<

c) sizeof()

d) &&

78. What is the sizeof(void) in a 32-bit C?

a) 0

b) 1

c) 2

d) 4

79. What type of value does sizeof return?

a) char

b) short

c) unsigned int

d) long

80. A memory leak happens when

a) a program allocates memory in heap but forgets to be allocate it

b) when an un-assigned pointer is used is freed using free function

c) when realloc() is called on a pointer that is not allocated


d) A program allocates memory in stack

81. Which of the following statements about stdout and stderr are true?

a) They both are the same.

b) Run time errors are automatically displayed in stderr.

c) Both are connected to the screen by default.

d) Stdout is line buffered but stderr is unbuffered.

82. Neelam wants to share her code with a colleague, who may modify it.

Thus she wants to include the date of the program creation, the author and

other she wants to include the date of the program creation, the author

and other information with the program. What component should she

use?

a) Header files

b) Iteration

c) Comments

d) Pre-processor directive

83. What is the output of the following code statements? The compiler

saves the first integer at the memory location 4165 and the rest at
consecutive memory spaces in order of declaration. Integer is one byte

long.

a) 30

b) 4165

c) 40

d) 4166

84. A 10-bit unsigned integer has the following range:

a) 0 to 1000

b) 0 to 1024

c) 1 to 1025

d) 0 to 1023

85. Choose the correct answer Saumya writes a code which has a function

which calls itself. Which programming concept is Saumya using?

a) This is bad programming practice and should not be done.

b) Recursion

c) Decision Making

d) Overloading
86. Consider the following function function calculate( n ) { if(n equals 5)

return 5 else return (n + calculate(n-5)) end } Shishir calls the function by

the statement, calculate(20). What value will the function return?

a) 50

b) 200

c) 35

d) 20

87. Choose the correct answer function g(int n) { if (n > 0) return 1; else

return -1; } function f(int a, int b) { if (a > b) return g(b-a); if (a < b)

return g(a-b); return 0; } If f(a,b) is called, what is returned?

a) Always -1

b) 1 if a > b, -1 if a < b, 0 otherwise

c) -1 if a > b, 1 if a < b, 0 otherwise

d) 0 if a equals b, -1 otherwise

88. Choose the correct answer Afzal writes a piece of code, where a set of

three lines occur around 10 times in different parts of the program. What

programming concept can he use to shorten his program code length?

a) Use for loops


b) Use functions

c) Use arrays

d) Use classes

89. Talika wants to implement heterogeneous linked list for her project.

Which of the following will help her do the same?

a) Void pointer

b) Null pointer

c) Wild pointer

d) Heterogeneous list follows the same procedure as the homogeneous list.

Hence no different pointer is required.

90. Which of the following ways can be used to represent a graph?

a) Adjacency List and Adjacency Matrix

b) Incidence Matrix

c) Adjacency List, Adjacency Matrix as well as Incidence Matrix

d) No way to represent

91. Which of the following is false about a binary search tree?

a) The left child is always lesser than its parent


b) The right child is always greater than its parent

c) The left and right sub-trees should also be binary search trees

d) In order sequence gives decreasing order of elements

92. What is the speciality about the in order traversal of a binary search

tree?

a) It traverses in a non increasing order

b) It traverses in an increasing order

c) It traverses in a random fashion

d) It traverses based on priority of the node

93. Which of the following real world scenarios would you associate with

a stack data structure?

a) Piling up of chairs one above the other

b) people standing in a line to be serviced at a counter

c) offer services based on the priority of the customer

d) tatkal Ticket Booking in IRCTC

94. What does ‘stack underflow’ refer to?

a) Accessing item from an undefined stack


b) adding items to a full stack

c) removing items from an empty stack

d) index out of bounds exception

95. What will be the output of the following C code?#include <stdio.h>

int *i;

int main()

if (i == 0)

printf("true\n");

return 0;

a) true

b) true only if NULL value is 0

c) Compile time error

d) nothing

96. What will be the output of the following C code?

#include <stdio.h>
static int x = 5;

void main()

x = 9;

int x = 4;

printf("%d", x);

a) 9

b) 4

c) 5

d) 0

97.Which for loop has range of similar indexes of ‘i’ used in for (i = 0;i <

n; i++)?

a) for (i = n; i>0; i–)

b) for (i = n; i >= 0; i–)


c) for (i = n-1; i>0; i–)

d) for (i = n-1; i>-1; i–)

98.What will be the output of the following C code?

#include <stdio.h>

int main()

int i = 0;

for (foo(); i == 1; i = 2)

printf("In for loop\n");printf("After loop\n");

int foo()

return 1;

a) After loop

b) In for loop after loop

c) Compile time error


d) Infinite loop

99. What is the best case time complexity of deleting a node in Singly

Linked list?

a) O (n)

b) O (n2)

c) O (nlogn)

d) O (1)

100. Which of the following statements are not correct with respect to

Singly Linked List (SLL) and Doubly Linked List (DLL)?

a) Complexity of Insertion and Deletion at known position is O(n) in SLL

and O(1) in DLL

b) SLL uses lesser memory per node than DLL

c) DLL has more searching power than SLL

d) Number of node fields in SLL is more than DLL

101. Which is correct with respect to the size of the data types?

a) char > int > float

b) int > char > float


c) char < int < double

d) double > char > int

102. What will be the output of the following C code?

#include <stdio.h>

void main()

int i = 0, j = 0;

for (i = 0;i < 5; i++)

for (j = 0;j < 4; j++){

if (i > 1)

break;

printf("Hi \n");

a) Hi is printed 5 times
b) Hi is printed 9 times

c) Hi is printed 7 times

d) Hi is printed 4 times

103. What will be the output of the following C code?

#include <stdio.h>

void main()

int i = 0;

int j = 0;

for (i = 0;i < 5; i++)

for (j = 0;j < 4; j++)

if (i > 1)

continue;

printf("Hi \n");

}
}

a) Hi is printed 9 times

b) Hi is printed 8 times

c) Hi is printed 7 times

d) Hi is printed 6 times

104. What will be the output of the following C code?

#include <stdio.h>

int main()

int i = 0;

do

i++;

if (i == 2)

continue;

printf("In while loop ");


} while (i < 2);

printf("%d\n", i);}

a) In while loop 2

b) In while loop in while loop 3

c) In while loop 3

d) Infinite loop

105. What will be the output of the following C code?

#include <stdio.h>

void main()

int i = 0;

do

printf("Hello");

} while (i != 0);

a) Nothing
b) H is printed infinite times

c) Hello

d) Run time error

106. Which keyword can be used for coming out of recursion?

a) break

b) return

c) exit

d) both break and return

107. Can we use a function as a parameter of another function? [Eg: void

wow(int func())].

a) Yes, and we can use the function value conveniently

b) Yes, but we call the function again to get the value, not as convenient

as in using variable

c) No, C does not support it

d) This case is compiler dependent

108. Which of the following is not a data type?

a) Symbolic Data
b) Alphanumeric Data

c) Numeric Data

d) Alphabetic Data

109. What does FORTRAN stands for?

a) Formula Transfer

b) Formula Transformation

c) Formula Translation

d) Format Transformation

110. A standardized language used for commercial applications.

a) C

b) Java

c) COBOL

d) FORTRAN

111. What will be the output of the following C code?

#include <stdio.h>

int x;

void main()
{

if (x)

printf("hi");

else

printf("how are u");

a) hi

b) how are you

c) compile time error

d) error

112. Which of the following statements for a simple graph is correct?

a) Every path is a trail

b) Every trail is a path

c) Every trail is a path as well as every path is a trail

d) Path and trail have no relation

113. If a simple graph G, contains n vertices and m edges, the number of

edges in the Graph G'(Complement of G) is ___________


a) (n*n-n-2*m)/2

b) (n*n+n+2*m)/2

c) (n*n-n-2*m)/2

d) (n*n-n+2*m)/2

114. For a given graph G having v vertices and e edges which is

connected

and has no cycles, which of the following statements is true?

a) v=e

b) v = e+1

c) v + 1 = e

d) v = e-1

115. On which of the following statements does the time complexity of

checking if an edge exists between two particular vertices is not,

depends?

a) Depends on the number of edges

b) Depends on the number of vertices

c) Is independent of both the number of edges and vertices


d) It depends on both the number of edges and vertices

116. Pushing an element into stack already having five elements and stack

size of 5, then stack becomes

a) Overflow

b) Crash

c) Underflow

d) User flow

117. Which of the following applications may use a stack?

a) A parentheses balancing program

b) Tracking of local variables at run time

c) Compiler Syntax Analyzer

d) Data Transfer between two asynchronous process

118. What is the result of the following operation?

Top (Push (S, X))

a) X

b) X+S

c) S
d) XS

119. What is the output of the following piece of code?

public class array

public static void main(String args[ ])

int [ ]arr = {1,2,3,4,5};

System.out.println(arr[2]);

System.out.println(arr[4]);

a) 3 and 5

b) 5 and 3

c) 2 and 4

d) 4 and 2

120. What are the disadvantages of arrays?

a) Data structure like queue or stack cannot be implemented


b) There are chances of wastage of memory space if elements inserted in

an array are lesser than the allocated size

c) Index value of an array can be negative

d) Elements are sequentially accessed

121. Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are

using the usual stack algorithm to convert the expression from infix to

postfix notation. The maximum number of symbols that will appear on

the stack AT ONE TIME during the conversion of this expression?

a) 1

b) 2

c) 3

d) 4

122. What will be the output of the following C code?

#include <stdio.h>int main()

float x = 'a';

printf("%f", x);

return 0;
}

a) a

b) run time error

c) a.0000000

d) 97.000000

123. What will be the output of the following C code?

#include <stdio.h>

int main()

void foo();

printf("1 ");

foo();

void foo()

printf("2 ");

}
a) 1 2

b) Compile time error

c) 1 2 1 2

d) Depends on the compiler

124. What will be the output of the following C code?

#include <stdio.h>

void foo();

int main()

void foo(int);

foo();

return 0;

void foo()

printf("2 ");

}
a) 2

b) Compile time error

c) Depends on the compiler

d) Depends on the standard

125. What will be the output of the following C code?

#include <stdio.h>

void m()

printf("hi");

void main()

m();

a) hi

b) Run time error

c) Nothing
d) Varies

126. What will be the output of the following C code?

#include <stdio.h>

void main()

static int x = 3;

x++;

if (x <= 5)

printf("hi");

main();

a) Run time error

b) hi

c) Infinite hi

d) hi hi
127. How many child nodes does each node of Ternary Tree contain?

a) 4

b) 6

c) 5

d) 3

128. Which of the following is the name of the node having child nodes?

a) Brother

b) Sister

c) Mother

d) Parent

129. What is the depth of the root node of the ternary tree?

a) 2

b) 1

c) 0

d) 3

130. Which node is the parent node of Node 6?


a) 1

b) 5

c) 2

d) 3

131. How many extra nodes are there in full ternary tree than a complete

ternary tree?

a) 1

b) 2

c) 3

d) both have same number of nodes

132. Which of the following is the implementation of the ternary tree?

a) AVL Tree

b) Ternary Heap
c) Hash Table

d) Dictionary

133. In the given graph identify the cut vertices.

a) B and E

b) C and D

c) A and E

d) C and B

134. For the given graph (G), which of the following statements is true?
a) G is a complete graph

b) G is not a connected graph

c) The vertex connectivity of the graph is 2

d) The edge connectivity of the graph is 1

135. What is the number of unlabeled simple directed graph that can be

made with 1 or 2 vertices?

a) 2

b) 4

c) 5

d) 9
136. Assuming value of every weight to be greater than 10, in which of

the following cases the shortest path of a directed weighted graph from 2

vertices u and v will never change?

a) Add all values by 10

b) subtract 10 from all the values

c) multiply all values by 10

d) in both the cases of multiplying and adding by 10

137. What is the maximum number of edges present in a simple directed

graph with 7 vertices if there exists no cycles in the graph?

a) 21

b) 7

c) 6

d) 49

138. Which of the given statement is true?

a) All the Cyclic Directed Graphs have topological sorting

b) All the Acyclic Directed Graphs have topological sorting

c) All Directed Graphs have topological sorting


d) All the cyclic directed graphs hace non topological sorting

139. What is the value of the sum of the minimum in-degree and

maximum out-degree of a Directed Acyclic Graph?

a) Depends on a Graph

b) Will always be zero

c) Will always be greater than zero

d) May be zero or greater than zero

140. How many times below for loop will be executed?

#include<stdio.h>

int main()

int i=0;

for(;;)

printf("%d",i);

return 0;

a) Infinite times
b) 0 times

c) 10 times

d) I time

You might also like