Capgemini Pseudocode Questions | Set 3

In this article, we will be discussing the Capgemini Pseudocode Questions and Answers. Capgemini doesn’t care if you’re a non-CS/IT student, they will anyways ask you about Data Structures. According to them, if you’re applying to an IT company, you must know coding.

Topics No. of questions (approx)
Pseudo Code on C 16 Questions
Pseudo Code on C++ 4
Pseudo Code on DSA 10 Questions

Capgemini Pseudocode Questions

1. Find the output of the following code.

main() {
    int a = 10;      
    if ((fork ( ) == 0))      
    a++;      
    printf ("%dn", a ); 
}
  1. 10 and 11
  2. 10
  3. 11
  4. 11 and 11
    Answer: 10

2. Find the output of the following code.

#include <stdio.h> 
main( ) {
    int i; 
    for ( i=0; i < 5; i++ ) {
        int i = 10;
        printf ( " % d ", i );      
        i++; 
    } 
    return 0; 
}
  1. 10 11 12 13 14
  2. 10 10 10 10 10
  3. 0 1 2 3 4
  4. Compilation error
    Answer: 10 10 10 10 10

3. Guess the output of the pseudo-code.

struct
{
  int si;
  double d;
  float cp;
} s;
void
main ()
{
  printf ("%d, %d, %d",  sizeof (s.si), sizeof (s.d), sizeof (s.cp));
}
  1. 6,10,8
  2. 4,8,4
  3. 2,8,8
  4. 2,4,4
    Answer: 4,8,4

4. Find the output of the following code.

int main ()
{
  int a, b;
  a = b = 4;
  b = a++;
  printf ("%d %d %d %d", a++, --b, ++a, b--);
}
  1. 5 3 7 3
  2. 5 4 5 3
  3. 6 2 6 4
  4. Syntax Error
    Answer: 6 2 6 4

5. Guess the output of the following code.

int main ()
{
  int a[4] = { 25, 16 };
  printf ("%d %d", a[0] & a[1], a[1] | a[2]);
}
  1. Syntax error because of invalid operator symbol
  2. 25 16
  3. 16 16
  4. Syntax error because of invalid array initialization
    Answer: 16 16

6. Find the output of the following pseudocode.

int main ()
{
  static int num = 8;
  printf ("%d", num = num - 2);
  if (num != 0)
    main ();
}
  1. 8 6 4 2
  2. Infinite output
  3. Invalid because the main function can’t call itself.
  4. 6 4 2 0
    Answer: 6 4 2 0

7. Find the output of the following code.

int main ()
{
  int check = 2;
  switch (check)
    {
    case 1:
      printf ("D.W.Steyn");
    case 2:
      printf (" M.G.Johnson");
    case 3:
      printf (" Mohammad Asif");
    default:
      printf (" M.Muralidaran");
    }
  return 0;
}
  1. D.W.Steyn
  2. D.W.Steyn M.G.Johnson
  3. M.G.Johnson
  4. M.G.Johnson Mohammad Asif M.Muralidaran
    Answer: M.G.Johnson Mohammad Asif M.Muralidaran

8. Guess the output of the following code.

int main() {
  int m = -10, n = 20;
  n = (m < 0) ? 0 : 1;
  printf("%d %d", m, n);
}
  1. -10 0
  2. 10 20
  3. 20 -10
  4. 0 1
    Answer: -10 0

9. Predict the output of the given pseudo code.

int main() {
  char c = 'f';
  switch (c) {
    default: printf("unknown colour ");
    case 'r': case 'R': printf("Red ");
    case 'g': case 'G': printf("Green "); break;
    case 'b': case 'B': printf("Blue");
  }
}
  1. Red Green Blue
  2. Error
  3. Green unknown colour Red
  4. unknown colour Red Green
    Answer: unknown colour Red Green

10. Guess the output of the given code below.

 int main() {
  int a = 100, b = 74;
  if (a++ > 100 && b++ > 200)
    printf("High values with a = %d b = %dn", a, b);
  if (a++ < 100 || b++ < 200)
    printf("Low values with a = %d b = %dn", a, b);
 }
  1. Low values with a = 100 b = 74
  2. Low values with a = 101 b = 73
  3. Low values with a = 102 b = 75
  4. Low values with a = 104 b = 75
    Answer: Low values with a = 102 b = 75

11. Find the output of the following code.

int main() {
  char p[] = "%dn";
  p[1] = 'c';
  printf(p, 65);
  int k=40, *a;
  a = &k;
  (*a)++; k++;
  printf("n k=%d",k); 
}
  1. c k=40
  2. b k=44
  3. A k=42
  4. a k=40
    Answer: A k=42

12. Guess the output of the given code.

main() {
 int i = 2, *j;
 j = &i;
 printf("%d", i**j*i+*j); 
} 
  1. Syntax error due to Invalid expression in printf
  2. Print junk value
  3. 16
  4. 10
    Answer: 10

13. Guess the output of the following pseudo-code.

int main() {
 int x,y,z;
 x = '1'-'0'; /* line-1 */
 y = 'a'-'b'; /* line-2 */
 z = x + y;
 printf("%d",z); 
} 
  1. 0
  2. Error because of incorrect line-1 only.
  3. Error because of incorrect line-1 and line-2.
  4. Error because of incorrect line-2 only.
    Answer: 0

14. Find the output of the given code.

void main ( )
{
  char *P = "ayqm" ;
  char c;
  c = ++*p ;
  printf ("%c", c);
}
  1. a
  2. 0x56FA
  3. m
  4. y
    Answer: a

15. Guess the output of the given pseudo code.

void main()
{
  int a = 1, b=2, c=3;
  char d = 0;
  if(a,b,c,d)
  {
    printf("EXAM");
  }
}
  1. No Output and No Error
  2. EXAM
  3. Run time error
  4. Compile time error
    Answer: No Output and No Error

Capgemini Pseudocode Questions FAQs

1. Is pseudocode easy to learn?
Pseudocode is a simple way to represent an algorithm or program. It is written easily in a word processing application and easily modified. Pseudocode is easy to understand and can be written by anyone. Pseudocode can be used with various structured programming languages.

2. Pseudocode is mainly written in which programming language?
Pesudo-Codes are the language-free representation of the algorithm that explains the more coded format of the algorithm but not the complete representation of the code in any specific language.

3. How many Questions are there in Capgemini Pseudocode MCQs?
There are 30 questions that need to be solved within 30 mins.

4. What is the syllabus for Capgemini pseudocode round questions and Capgemini pseudocode questions and answers?
There is no such Syllabus for Capgemini pseudocode questions and answers but from what we have observed it has basic C input-output questions and a basic C Syllabus that was there first and we have given chapter-wise questions above please check them Capgemini Pseudocode Round Questions.

We tried to discuss Capgemini Pseudocode Questions in this article. We hope this article gives you a better understanding of basics in Data Structures and Algorithms. Prepbytes also provides a good collection of Foundation Courses that can help you enhance your coding skills. Want to make sure you ace the interview in one go? Join our Placement Program that will help you get prepared and land your dream job at MNCs. Mentors of Prepbytes are highly experienced and can provide you with basic, in-depth subject knowledge for better understanding.

Leave a Reply

Your email address will not be published. Required fields are marked *