HCL Code Input Output Quiz – 1

Question 1

Time: 00:00:00
What will be the following output of the following code if a = 3, b = 1 ?
Integer func(Integer a,Integer b)
if(a0 OR a>0)
return func(a-1, b)
Else
return a
End if
return b
End function func()

1

1

2

2

-3

-3

8

8

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What will be the output of the following pseudo code ?
Integer a, b, c
Set a = 2, b = 11, c = 6
if((b + c) > (c + b))
b = c + a
End if
if((c + b) > (b – c))
c = (9 + 4) + a
End if
Print a + b + c

47

47

21

21

28

28

32

32

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
What will be the output of the following pseudo code ?
Integer a, b, c
Set a = 8, b = 2, c = 15
for (each c from 2 to 4)
b = 6 + b
End for
b = 10 ^ b
Print a + b

39

39

49

49

38

38

33

33

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What will be the output of the following pseudocode for p = 2, q = 2 ?
Integer func(Integer p, Integer q)
if(q>0 OR p>0)
return func(p-1, q-1) + func(q-1, p-1)
Else
return p
End if
return q
End function func()

3

3

2

2

8

8

Zero

Zero

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is output of following code if a=10,b=12.
func(int x , int y)
if(x>1)
func(x-3 ,y-2)
else
print(y)
END if-else
func(a,b)

5

5

10

10

6

6

12

12

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What will be the output of the following pseudo code for a = 5, b =4 ?
Integer func(Int a, Int b)
Int c
Set c = a + b
c = c + a
a = b + c
return a + b
End function func()

21

21

28

28

24

24

22

22

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
What will be the output of the following pseudo code ?
#include
int main()
{
int a=0;
if(a==5);
{
printf(“Hello World\t”);
}
printf(“Good Evening”);
}

Good Evening

Good Evening

Hello World Good Evening

Hello World Good Evening

Hello World

Hello World

None

None

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What will be the output of the following pseudo code ?
Integer n
for(n = 5 ; n!=0; n–)
print n
n=n-2
END FOR

5 4 3 2 1

5 4 3 2 1

5 5 5 5 5

5 5 5 5 5

Error

Error

Infinite Loop

Infinite Loop

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What will be the output of the following pseudo code for a = 3, b=5, c=4 ?
Integer func(Int a, Int b, Int c)
if((4+7) a)
c = a ^ a
a = 8 + a
Else
a = (4+1) + b
End if
return a + b + c
End function func()

27

27

19

19

16

16

22

22

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
What will be the output of the following pseudo code ?
Int p, q, r
Set p = 5, q = 10, r = 5
if(r>q OR (q+p)>(p-q))
q = p
p = (r + p) + p
End if
Print p + q + r

25

25

29

29

42

42

10

10

Once you attempt the question then PrepInsta explanation will be displayed.

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/10

Accuracy

0%

Prime

Prime Video

Complete Video Course for HCL

For HCL
Get Prime Video

Prime

Prime Mock

Topic-Wise Full Mock for HCL

For HCL
Get Prime Mock
Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects