Question 21
EasyWhat does the following pseudocode print?
Integer d = 3
switch (d)
case 1: Print "Mon"
break
case 2: Print "Tue"
break
case 3: Print "Wed"
break
default: Print "Other"
end switch
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Pseudocode and Output Prediction
What does the following pseudocode print?
Integer d = 3
switch (d)
case 1: Print "Mon"
break
case 2: Print "Tue"
break
case 3: Print "Wed"
break
default: Print "Other"
end switch
Wed
Other
Tue
WedOther
Sign up free to see the answer and a step-by-step explanation.
What is the output of this pseudocode?
Integer x = 7, y
y = (x > 5) ? x * 2 : x + 2
Print y
14
12
9
7
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer a = 12, b = 8
if (a mod b == 0)
Print "divisible"
else
Print a mod b
end if
4
8
1
divisible
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer sales = 25000, bonus
if (sales > 20000)
bonus = sales * 10 / 100
else
bonus = sales * 5 / 100
end if
Print bonus
25000
2500
2000
1250
Sign up free to see the answer and a step-by-step explanation.
What will be printed by the following pseudocode?
Integer t = 30
if (t >= 35)
Print "Hot"
else if (t >= 25)
Print "Warm"
else
Print "Cool"
end if
Hot
Cool
Warm
HotWarm
Sign up free to see the answer and a step-by-step explanation.
What does the following pseudocode print?
Integer count = 0
if (6 > 3)
count = count + 1
end if
if (6 > 5)
count = count + 1
end if
if (6 > 7)
count = count + 1
end if
Print count
0
2
1
3
Sign up free to see the answer and a step-by-step explanation.
What is the output of this pseudocode?
Character ch = 'e'
if (ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u')
Print "vowel"
else
Print "consonant"
end if
Error
consonant
vowel
e
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer x = 10
if (x > 5)
x = x + 5
else
x = x - 5
end if
if (x > 12)
x = x * 2
end if
Print x
30
20
15
10
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer y = 1900
if ((y mod 4 == 0 AND y mod 100 != 0) OR y mod 400 == 0)
Print "Leap"
else
Print "Not leap"
end if
1900
Leap
Error
Not leap
Sign up free to see the answer and a step-by-step explanation.
What will be the output of the following pseudocode?
Integer a = 3, b = 8, c = 5, mid
if ((a >= b AND a <= c) OR (a <= b AND a >= c))
mid = a
else if ((b >= a AND b <= c) OR (b <= a AND b >= c))
mid = b
else
mid = c
end if
Print mid
3
16
5
8
Sign up free to see the answer and a step-by-step explanation.