Capgemini Pseudo Code MCQs | Set - 1

Try to solve these questions: [For testing your skill] 

Capgemini Pseudo Code MCQ


Ques 1. Consider the program fragment given below:

int A[5][5], k, j;
for(k = 0; k <5; +k){
 for (i 0; j<5 ; j){
  A[k][j] = A[j][k];
 }
}


Which of the following is true regarding the given program fragment?
A. It transposes the given matrix A
B. It doesn't alter the given matrix A
C. It makes the given matrix A, symmetric.
D. None of the mentioned options


Ques 2. What will be the output of the following C code?

#include<stdio.h>
void main()
{
 long double a;
 signed char b;
 int arr[sizeof(!a+b)];
 printf("%d", sizeof(arr));
}


[Consider the size of a is 16 and size of b is 1]
A. 16
B. 0
C. 6
D. 4


Ques 3. Which of the following statements is true regarding Automatic Storage Class?

A. It is used to give a reference of a global variable that is visible to all the program files.
B. It instructs the compiler to keep a local variable in existence during the life-time of the program
C. It is the default storage class for all local variables.
D. It is used to define local variables that should be stored in a register

Ques 4. What will be the output of the following C code?

#include <stdio.h>
int main()
{
 int x = 4, y=0;
 int z;
 z = (y++, y);
 printf("%d\n", z)
 return 0
}


A. 1
B. 0
C. Undefined behavior due to the order of evaluation can be different.
D. Compilation error.


Ques 5. What will be the output of the below code when 1 is entered?

#include <stdio.h>
void main()
{
 int ch;
 printf("enter a value btw 1 to 2:");
 scanf("%d", &ch);
 switch (ch, ch + 1)
 { 
  case 1:
   printf("1\n");
  case 2:
   printf("2");
   break;
  default:
   printf("3");
 }
}



Ques 6. What is the maximum degree of any vertex in a simple graph with n vertices?

A. n + 1
B. 2n - 1
C. n
D. n-1

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

A. Edges
B. Parallel edges
C. Nodes
D. Direction of edges


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

A. Circular queue
B. None of the mentioned options
C. Priority queue
D. Simple queue


Ques 9. Consider an algorithm that tries to sort an array S[11] by comparing the elements of the array. Following are the steps involved:

I.   Compare S[1] and [11]
II.  If S[1] < S[11], then sort [1 ... 5] by Step I
III. Sort S[7. 11
IV. Merge s[1 .. 6) and S[7.. 11] into another array

What is the time complexity of the above algorithm

A. O(log n)
B. O(n)
C. O(n log n)
D. O ( n^2)

Ques 10. What will be the output of the following pseudocode for input 134?



[Note: Static variables have a property of preserving their value even after they are out of their scope ]

A. 8
B. 3
C. 2
D. 431

Ques 11. What will be the output of the following pseudocode for input 7 ?

A. 32
B. 76
C. 56
D. 28

Ques 12. What will be the output of the following pseudocode for n 2?


A. 2
B. 16
C. 8
D. 4

Ques 13. What will be the output of the following pseudocode  ?


A. 12
B. 5
C. 7
D. 6


Ques 14. What will be the output of the following pseudocode ?


A. 42 36
B. 36 1
C. 1  1
D. 1  36

Ques 15. What will be the necessary condition to get the desired element from a given array by using the following algorithm?


A. The elements in an array should be in the sorted form
B. The array should contain more than one element
C. The elements in an array should be in unsorted form
D. No pre-condition is required for the algorithm to work


Capgemini Pseudo Code MCQ - Set 1

Capgemini Pseudo Code MCQ - Set 2

Capgemini Pseudo Code MCQ - Set 3

Capgemini Pseudo Code MCQ - Set 4

Capgemini Pseudo Code MCQ - Set 5


This Blog is Hard work !

Can you give me a treat 😌

Post a Comment

0 Comments