Infosys Fully solved PseudoCode Questions | Infosys previous year question paper

Today we are going to discuss some Infosys Fully solved PseudoCode Questions that has been asked in previous years in Infosys for System Engineer role.

So, If you have applied in Infosys for System Engineer role, then there are fair chances that you can get same difficulty level of questions in your actual exam.

Infosys Pseudocode questions

Hi all, Welcome to Jobs Adda. Here you would get all fresher jobs updates and placement material for engineering graduates related to IT/Core sector.

To get all job updates on time, Don’t forget to join our whatsapp group. Click below to join.


Infosys Pseudocode Questions:

Q1. Predict the output of the following pseudo code if the value of the number is 6:

Read number K=2

i=2

while i<=number

k=k*i

i=i+1

end while

write k.

A) 1440.0

B) 1700.0

C) 1560.0

D) 1340.0

Answer: Option A


Explanation:


First iteration: num=6, k=2, i=2
while condition true
k=k*i= 2*2 = 4
i=2+1 = 3


second iteration: num=6, k=4, i=3
while condition true
k=k*i= 4*3 = 12
i=3+1 = 4


Third iteration: num=6, k=12, i=4
while condition true
k=k*i= 12*4 = 48
i=4+1 = 5


Fourth iteration: num=6, k=48, i=5
while condition true
k=k*i= 48*5 = 240
i=5+1 = 6

Fifth iteration: num=6, k=240, i=6
while condition true
k=k*i= 240*6 = 1440
i=6+1 = 7


Sixth iteration: num=6, k=1440, i=7
while condition false
Printing k value which is 1440


Q2. Predict the output of the following pseudo code if the value of the n is 35?

Read n
i= 0
While n%10!=0
n=n+3
i++
end while
n=n+i
write n


A) 50.0
B) 55.0
C) 53.0
D) 45.0

Answer: Option C
Explanation:


1st iteration: n=35, i=0,
35%10!=0 True
n = n+3= 35+3 = 38
i=i++ = 1
n = n+I = 38+1= 39


2nd iteration: n=39, i=1,
39%10!=0 True
n = n+3= 39+3 = 42
i=i++ = 2
n = n+i = 42+2= 44


3rd iteration: n=44, i=3,
44%10!=0 True
n = n+3= 44+3 = 47

i=i++ = 3
n = n+i = 47+3= 50

4th iteration: n=50, i=3,
50%10!=0 False
n = n+3 // will not be executed
i=i++ // will not be executed
n = n+i = 50+3= 53
print n that is 53


Q3. What will be the number of “*” printed by the given pseudocode when input is 25?

Write ”Please enter the number”

Read input

Repeat while input>0

If (star>0 and star<=10)

Write*

Else if(star>10 and star <=20)

Write**

Else if(star>20 and star<=30)

Write ***

Input—

End if

End while

A) 55.0

B) 35.0

C) 25.0

D) 45.0

Answer: Option D
Explanation:

1st if condition will be satisfied for 1 to 10 values of the input and print 10 stars.
2nd if condition will be satisfied for 11 to 20 values of the input and print 20 stars.
3rd if condition will be satisfied for 21 to 25 values of the input and print 15 stars.
Therefore the total stars printed is 10+20+15 = 45 stars


Q4. You have a vehicle class, a car class, and a person class, you have to implement the
functionalities of a bird, dog, cat, bus, auto and 2 specialized car classes for hybrid and electric
vehicles.
Which of these options is the most efficient way to do so?

  1. Make a new class for all the required methods and implement all methods separately.
  2. Inherit the car class into the specialized car and then implement the extra methods.
  3. Make a new class Big vehicles and then inherit properties from it to make the bus classes.
  4. Inherit the person class to bird, dog, cat, and then override the methods that are not required.
  5. Make new class animals and use this to make the dogs, cats and birds class.
  6. Make a new three wheeled vehicle inherited from vehicle class for auto.
  7. Inherit vehicle class for auto.
    A) 2,5,7
    B) 2,5,6
    C) 3,4,6
    D) 1

Answer: Option A


Explanation: The process to be followed is; Inherit the car class into the specialized car and then
implement the extra methods, Make new class animals and use this to make the dogs, cats and birds
class, 1. Inherit vehicle class for auto.


Q5. Class A contains two methods, namely “me” and “see”. Class B inherits Class A and overrides the “see” method. Class C also inherits methods from Class A and overrides the “see” method. Class B and class C are both inherited by class D using the concept of multiple inheritances.
In the given scenario, identify the problem generated by the behaviour of the “see” method?
A) Dexterity problem
B) Coherence Problem
C) Cohesion Problem
D) Diamond Problem

Answer: Option D

Explanation: Here the problem would be with the path for the methods to be inherited from the class
A, there would be an ambiguity in the call of the methods see basically from which of the classes i.e.
will it be from B or C. This is a famous problem in inheritance called the diamond problem as it looks
like a diamond in a flow chart. This problem can be resolved using scope resolution operators or
Super keyword.


Also Check:

Last Year Infosys Puzzle Based Questions

Leave a Reply

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