Infosys Pseudo-code Questions and Answers 2022

Infosys Pseudo Code Questions

Infosys Pseudo-code Questions with Answers 2022 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-2022

Infosys Pseudo-code Questions with Answers 2022

CompanyInfosys
Total Time Duration10 minutes
Number of Question5 Ques
Negative MarkingNo

Infosys Pseudo-Code Topics
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>
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

41.8%

7 6 9

7 6 9

31.27%

678

678

16.79%

679

679

10.14%

Here, in the given code, >> is the bitwise right shift operator and x>>y => x/(2^y) and & is the bitwise and operator and gives 1 only if both bits are same. Now, for x = 10, (10>=0) z = 10 & (10>>1) => z = 10 & 5 => z=10. Similarly for x= 9, 8, 5, 4, 2, 1 and 0 , z will be zero and for x=7, z will be 3 , for x= 6, z will be 2 and for x=3, z will be 1 for x=7, 6, and 3 z is non zero so the will get printed on the output screen. Hence, we get output as 7 6 3

2. What is the output?

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

%a

%a

9.52%

%x

%x

23.15%

100

100

33.49%

None

None

33.84%

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

34.39%

0.0

0.0

25.32%

garbage value

garbage value

22.17%

Logical Error

Logical Error

18.11%

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

22.88%

zero

zero

52.92%

4

4

12.68%

8

8

11.52%

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

59.02%

340

340

15.96%

360

360

19.43%

380

380

5.6%

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

50.23%

Compilation Error

Compilation Error

30.05%

3 6 7

3 6 7

10.19%

None

None

9.54%

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

21.06%

zero

zero

73.17%

4

4

4.14%

8

8

1.63%

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

24.79%

1

1

36%

2

2

11.34%

3

3

27.86%

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

29.65%

Garbage Value

Garbage Value

20.87%

1.000000

1.000000

34.93%

Error

Error

14.56%

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.63%

Null

Null

37.19%

Compilation fails

Compilation fails

20.53%

An exception throws at runtime

An exception throws at runtime

27.66%

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

8 comments on “Infosys Pseudo-code Questions and Answers 2022”