Download - MindTree Technical-Sample Paper-2011

Transcript
  • 8/7/2019 MindTree Technical-Sample Paper-2011

    1/4

    Copyright 2010 HirePro Consulting Private Limited. All rights reserved.Page 1 of 4

    Assumptions

    1. The generic function print() sends its arguments to the default output stream2. The given blocks of code are a part of a class (Java, C++) and a file in C .3. Print ( ) always prints with a new line.

    Section 2: Technical

    1) What will be the result of the following code?

    int i;for(i = 0; i

  • 8/7/2019 MindTree Technical-Sample Paper-2011

    2/4

    Copyright 2010 HirePro Consulting Private Limited. All rights reserved.Page 2 of 4

    5) What will be the result of the following code?

    int sum, index;sum = 1;

    index = 9;do{

    index = index - 1;sum = 2 * sum;

    }while (index > 9);

    print(sum);

    6) What will be the result of the following code?

    int a = 4, b = 0;if (a > 5){

    b = 4;}elseif (a < 10){

    b = 3;}elseif (a < 5){

    b = 2;

    }else{

    b = 1;}

    print(b);

    7) What will be the result of the following code?

    int i = 6720, j = 4;while((i % j) == 0){

    i = i / j;j = j + 1;

    } print(j);

  • 8/7/2019 MindTree Technical-Sample Paper-2011

    3/4

    Copyright 2010 HirePro Consulting Private Limited. All rights reserved.Page 3 of 4

    8) What will be the return value on calling the function checksum(5)?

    int checksum(int n){

    int c;if(n == 1)

    return(1);else

    c = n * checksum(n - 1);return(c);

    }

    9) What will be the result of the following code?

    int i, x;for(i = 1; i > (2 + 1 - 2)) | (1 x)

    print("First");else

    print("Second");if (2 > x)

    print("Third"); print("Fourth"); print("Fifth");

    12) What will be the result of the following code?

    int a = 1;while (a

  • 8/7/2019 MindTree Technical-Sample Paper-2011

    4/4

    Copyright 2010 HirePro Consulting Private Limited. All rights reserved.Page 4 of 4

    13) What will be the result of the following code?

    int count = 5;while (--count + 1