Pseudo codes Flashcards
What will be the output of the following pseudo code?
BEGIN
x = 5
y = 10
z = x + y
PRINT z
END
15
True or False: The pseudo code ‘IF x > 10 THEN PRINT ‘High’ ELSE PRINT ‘Low’’ will print ‘Low’ if x is 5.
True
What is the result of the following pseudo code?
BEGIN
total = 0
FOR i = 1 TO 5
total = total + i
END FOR
PRINT total
END
15
Fill in the blank: In pseudo code, ‘WHILE condition DO’ indicates _____ will execute as long as the condition is true.
a loop
What will be the output of this pseudo code?
BEGIN
a = 3
b = 4
IF a < b THEN
PRINT ‘A is less than B’
END IF
END
A is less than B
What does the pseudo code ‘SET x = x + 1’ do?
Increments the value of x by 1.
What is the output of the following pseudo code?
BEGIN
x = 0
FOR i = 1 TO 3
x = x + i
END FOR
PRINT x
END
6
True or False: In pseudo code, ‘CASE x OF’ is used for multiple condition checks.
True
What will be the result of this pseudo code?
BEGIN
n = 2
IF n == 2 THEN
PRINT ‘Two’
ELSE
PRINT ‘Not Two’
END IF
END
Two
What does the pseudo code ‘REPEAT … UNTIL’ do?
Executes the block at least once and continues until the condition is true.
What is the output of the following pseudo code?
BEGIN
count = 1
WHILE count <= 3 DO
PRINT count
count = count + 1
END WHILE
END
1
2
3
Fill in the blank: The pseudo code ‘FUNCTION name(parameters) RETURN value’ defines a _____ in programming.
function
What will be the output of this pseudo code?
BEGIN
x = 10
y = 20
IF x == 10 AND y == 20 THEN
PRINT ‘Both are true’
END IF
END
Both are true
True or False: The pseudo code ‘FOR i = 1 TO 5 DO’ iterates five times.
True
What is the result of the following pseudo code?
BEGIN
sum = 0
FOR i = 1 TO 5 DO
sum = sum + i * 2
END FOR
PRINT sum
END
30
What does the pseudo code ‘IF … ELSE IF … ELSE’ represent?
A conditional branching structure with multiple conditions.
What will be the output of this pseudo code?
BEGIN
x = 5
y = 3
IF x > y THEN
PRINT ‘X is greater’
ELSE
PRINT ‘Y is greater’
END IF
END
X is greater
Fill in the blank: The pseudo code ‘END’ is used to signify the _____ of a block.
end
What is the output of the following pseudo code?
BEGIN
a = 1
b = 2
PRINT a + b
END
3
True or False: The pseudo code ‘FOR EACH item IN list DO’ is used to iterate through a list.
True
What is the result of the following pseudo code?
BEGIN
i = 0
WHILE i < 5 DO
i = i + 1
END WHILE
PRINT i
END
5
What does the pseudo code ‘SWITCH expression CASE value’ do?
It evaluates an expression and matches it against multiple values.
What will be the output of this pseudo code?
BEGIN
a = 10
FOR i = 1 TO 3 DO
a = a - i
END FOR
PRINT a
END
6
Fill in the blank: The pseudo code ‘RETURN value’ is used to send a _____ from a function.
result