Question 1

Time: 00:00:00
What will be the value of s, if n=127?

Read n
i=0,s=0
Function Sample(int n)
while(n>0)
r=n%10
p=8^i
s=s+p*r
i++
n=n/10
End While
Return s;
End Function

27

27

187

187

87

87

120

120

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

Please login to submit your explanation

Question 2

Time: 00:00:00
What will be the value of s if N=20?

Read N
Function sample(N)
s = 0
f = 1
i = 1
while i <= N:
f = f * i
s = s +(i / f)
i+=1
End while
return(s);
End Function

3.789456

3.789456

infinite loop

infinite loop

2

2

80

80

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

Please login to submit your explanation

Question 3

Time: 00:00:00
What will be the output if limit = 6?

Read limit
n1 = 0, n2= 1, n3=1, count = 1;
while count <= limit
count=count+1
print n3
n3 = n1 + n2
n1 = n2
n2 = n3
End While

112358

112358

12358

12358

123581321

123581321

12358132

12358132

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

Please login to submit your explanation

Question 4

Time: 00:00:00
What will be the value of even_counter if number = 2630?

Read number
Function divisible(number)
even_counter = 0, num_remainder = number;
while (num_remainder)
digit = num_remainder % 10;
if digit != 0 AND number % digit == 0
even_counter= even_counter+1
End If
num_remainder= num_remainder / 10;
End While
return even_counter;

3

3

4

4

2

2

1

1

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

Please login to submit your explanation

Question 5

Time: 00:00:00
What will be the value of t if a = 56 , b = 876?

Read a,b
Function mul(a, b)
t = 0
while (b != 0)
t = t + a
b=b-1
End While
return t;
End Function

490563

490563

49056

49056

490561

490561

None of the mentioned

None of the mentioned

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

Please login to submit your explanation

Question 6

Time: 00:00:00
Code to sort given array in ascending order:




Read size
Read a[1],a[2],…a[size]
i=0
While(i<size)
j=i+1
      While(j<size)       
            If a[i] < a[j] then           
t= a[i];
a[i] = a[j];
a[j] = t;

End If
j=j+1
End While
i=i+1
End While
i=0
While (i<size)
print a[i]
i=i+1
End While




Line 4

Line 4

Line 6

Line 6

Line 7

Line 7

No error

No error

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

Please login to submit your explanation

Question 7

Time: 00:00:00
What will be the output of the following pseudocode for a = 9, b = 7?

Integer funn(Integer a, Integer b)
Integer c 
Set c = 2 
b = b mod c 
a = a mod c
return a + b 
End function funn()

17

17

5

5

2

2

-5

-5

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

Please login to submit your explanation

Question 8

Time: 00:00:00

What will be the output of the following pseudocode for input a = 30, b = 60, C = 90?



Integer a, b, c, sum 
Read a, b, c 
Set sum = a + b + c 
if ((sum EQUALS 180) and (a NOT EQUALS 0) and (b NOT EQUALS 0) and (c NOT EQUALS 0))
Print " Success" 
Otherwise 
Print "Fail" 
End if

Success

Success

Fail

Fail

compilation error

compilation error

None of the mentioned

None of the mentioned

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

Please login to submit your explanation

Question 9

Time: 00:00:00
What will be the output of the following pseudo-code?

integer i
set i=3
do
print i+3
i=i-1
while( i < 0)
end while

6 5 4

6 5 4

6 4 2

6 4 2

3 2 1

3 2 1

1 2 3

1 2 3

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

Please login to submit your explanation

Question 10

Time: 00:00:00




How many times the following loop will be executed?

main()
{
ch = ‘b’;
while(ch >= ‘a’ && ch <= ‘z’)
ch++;
}




Compilation error

Compilation error

25

25

26

26

1

1

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

Please login to submit your explanation

["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%

Get over 200+ Courses under One Subscription

mute

Don’t settle Learn from the Best with PrepInsta Prime Subscription

Learn from Top 1%

One Subscription, For Everything

The new cool way of learning and upskilling -

Limitless Learning

One Subscription access everything

Job Assistance

Get Access to PrepInsta Prime

Top Faculty

from FAANG/IITs/TOP MNC's

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.