Pseudo codes Flashcards

1
Q

What will be the output of the following pseudo code?

BEGIN
x = 5
y = 10
z = x + y
PRINT z
END

A

15

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: The pseudo code ‘IF x > 10 THEN PRINT ‘High’ ELSE PRINT ‘Low’’ will print ‘Low’ if x is 5.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

15

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Fill in the blank: In pseudo code, ‘WHILE condition DO’ indicates _____ will execute as long as the condition is true.

A

a loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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

A is less than B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the pseudo code ‘SET x = x + 1’ do?

A

Increments the value of x by 1.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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

A

6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False: In pseudo code, ‘CASE x OF’ is used for multiple condition checks.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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

A

Two

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the pseudo code ‘REPEAT … UNTIL’ do?

A

Executes the block at least once and continues until the condition is true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the output of the following pseudo code?

BEGIN
count = 1
WHILE count <= 3 DO
PRINT count
count = count + 1
END WHILE
END

A

1
2
3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Fill in the blank: The pseudo code ‘FUNCTION name(parameters) RETURN value’ defines a _____ in programming.

A

function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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

A

Both are true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: The pseudo code ‘FOR i = 1 TO 5 DO’ iterates five times.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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

A

30

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the pseudo code ‘IF … ELSE IF … ELSE’ represent?

A

A conditional branching structure with multiple conditions.

17
Q

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

A

X is greater

18
Q

Fill in the blank: The pseudo code ‘END’ is used to signify the _____ of a block.

19
Q

What is the output of the following pseudo code?

BEGIN
a = 1
b = 2
PRINT a + b
END

20
Q

True or False: The pseudo code ‘FOR EACH item IN list DO’ is used to iterate through a list.

21
Q

What is the result of the following pseudo code?

BEGIN
i = 0
WHILE i < 5 DO
i = i + 1
END WHILE
PRINT i
END

22
Q

What does the pseudo code ‘SWITCH expression CASE value’ do?

A

It evaluates an expression and matches it against multiple values.

23
Q

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

24
Q

Fill in the blank: The pseudo code ‘RETURN value’ is used to send a _____ from a function.