Infosys Pseudo-code Questions and Answers 2021-2020

Infosys Pseudo-code Questions with Answers 2021-2020 are available below on this page. Pseudo Code is a normal representation of algorithm code in c, c++ or any other language. In pseudo Code round there will be a total of 5 questions that we need to answer within 10 minutes. The Difficulty level of the paper goes from Moderate to High. Pseudo-Code are not the machine-readable codes it is just as same as algorithm written in coding format. For more detailed information on Infosys Examination, You can visit our Infosys Dashboard.

Infosys Pseudo-Code Questions and Answers 2021-2020

Infosys Pseudo-code Questions with Answers 2021-2020

CompanyInfosys
Total Time Duration10 minutes
Number of Question5 Ques
Negative MarkingNo

Infosys Pseudo-Code Curriculum
Detailed Infosys Pseudo-Code Paper Pattern

TopicsNo. of questions in testSuggested Avg. TimeDifficulty
C1MedMedium
C++2MedMedium
OOPS2HighMedium

1. What is the output?

#include<stdio.h>
using namespace std;
int main()
{
    for (int x = 10; x >= 0; x--) {
        int z = x & (x >> 1);
        if (z)
            printf("%d ", x);
     }
    
}

7 6 3

7 6 3

43.31%

7 6 9

7 6 9

30.06%

678

678

15.8%

679

679

10.83%

Currently there is no PrepInsta Explanation.

2. What is the output?

#include<stdio.h>
int main()
{
    int a = 100;
    printf("%0 %x", a);
}

%a

%a

9.11%

%x

%x

24.73%

100

100

29.96%

None

None

36.2%

In this question %0 will cancel out the a while %x will get printed
but,
if we only write printf("%x"); without passing any parameter for x
it will show an error.

3. What is the output?

#include<stdio.h>
int main() 
{
    typedef int num;
    num bunk = 0.00;    
    printf("%d", bunk);
    return 0;
    
}

Zero

Zero

35.42%

0.0

0.0

26.67%

garbage value

garbage value

18.95%

Logical Error

Logical Error

18.95%

Integer part of 0.00 is equal to 0
hence only zero will be printed with printf("%d", bunk) when 0.00 is passed
because %d stands for integer.

4. What is the output?

#include<stdio.h>
int main(){
    float x = 0.0;
    long int y = 10;
    printf("%d", sizeof(y) == sizeof(x+y));
    return 0;
}

1

1

23.35%

zero

zero

47.31%

4

4

15.62%

8

8

13.72%

sizeof(x) that is float is 4
sizeof(y) that is long int is 8
sizeof(x+y) that also comes out to be float will have size = 4

here it is asking sizeof(y) == sizeof(x+y)
i.e 8 == 4
"==" operator gives result in either 0 or 1
so answer is zero.

5. What is the output?

#include<stdio.h>
int main()
{
    int any = ' ' * 10;
    printf("%d", any);
    return 0;
}

320

320

60.53%

340

340

16.04%

360

360

17.76%

380

380

5.67%

Ascii value of space (' ') is 32 and 32 * 10 is 320

6. What will be the output of the following pseudocode:

#include<stdio.h>
int main()
{
int go = 5.0, num = 1*10;
do 
{
num /= go;
} while(go--);
printf ("%d\n", num);
return 0;
}

Floating Point Exception

Floating Point Exception

47.15%

Compilation Error

Compilation Error

28%

3 6 7

3 6 7

9.02%

None

None

15.83%

In C when you divide the integer with a float without the type casting it gives "Floating Point Exception" error

7.

What will be the output of following pseudo code

#include<stdio.h>
int main(){
    float x = 0.0;
    long int y = 10;
    printf("%d", sizeof(x) == sizeof(x+y));
    return 0;
}

1

1

24.46%

zero

zero

70.18%

4

4

4.1%

8

8

1.26%

sizeof(x) that is float is 4
sizeof(y) that is long int is 8
sizeof(x+y) that also comes out to be float will have size = 4

here it is asking sizeof(x) == sizeof(x+y)
i.e 4 == 4
"==" operator gives result in either 0 or 1
so answer is 1.

8. What will be the output of the following pseudocode:

#include <stdio.h>
int main()
{
    int num = 987;
    int rem;
    while(num!=0)
    {
        rem = num % 4;
        num = num / 10;
    }
    printf("%d",rem);
}

zero

zero

19.85%

1

1

45.97%

2

2

8.79%

3

3

25.39%

Iteration 1 : rem = 3(987 % 4), num = 98
Iteration 2 : rem = 2(98 % 4), num = 9
Iteration 3 : rem = 1(9 % 4), num = 0

9. what will be the output of the following Pseudo Code.

#include<stdio.h>
int main()
{
float i;
i = 1;
printf("%d",i);
return 0;
}

1

1

31.02%

Garbage Value

Garbage Value

12.74%

1.000000

1.000000

37.7%

Error

Error

18.54%

If float variable is declared as an integer type
then, it will always give garbage value.

10. What will be the output of the following pseudocode:

public class Main
{
     public static void main(String[] args)
     {
          String names[] = new String[5];
          for(int x=0; x<args.length; x++)
          names[x] = args[x];
          System.out.println(names[2]);
     }
}

Names

Names

14.2%

Null

Null

31.77%

Compilation fails

Compilation fails

22.78%

An exception throws at runtime

An exception throws at runtime

31.26%

value of args.length is 0
So, the loop will not run either of the time
Hence, null will be printed.

×

Please login to report

 

FAQ on Pseudo-Codes

What is pseudo code test?

Pseudo code is an another round in the Infosys hiring process. Their are total 5 questions and you have 10 minutes of time to complete the test. Its is a n MCQ question round where you have to predict the output of the code written in the pseudo-code format

What is pseudo coding?

Pseudo code is a term used to represent the codes in algorithmic format. These codes are not machine readable, but this are the algorithm representation of the code

Pesudo-codes are mainly written in which programming language?

Pesudo-Codes are the language free representation of the algorithm that explain the more coded format of the algorithm but not the complete representation of the code in any specific language