9. Complete this table. Make sure all cells that contain numbers are filled.
|
PSEUDO-CODE INSTRUCTIONS |
X |
Y |
Z |
|
X := 7 |
|||
|
Y := -12 |
|||
|
Z := 13 |
|||
|
IF (X + Y + Z) <> X*Y THEN |
|||
|
BEGIN |
|||
|
X : = (X – Y) ÷ X |
|||
|
Y := X – 3 * Y |
|||
|
Z : = X + 5 |
|||
|
END |
|||
|
IF (X - Y + Z) <> X +Y THEN |
|||
|
BEGIN |
|||
|
X : = 2 * (X – Y) ÷ X |
|||
|
Y := X – 3 * Z |
|||
|
Z : = X – 2 |
|||
|
END |
10.
X := 12
Y := 15
Z := 5
Z := X
X := Y
Y := Z
The above sequence of commands will exchange the values in the
variables, resulting finally in
X= _____; Y =
______; Z =
__________
11.
W:=7
U:= 2
W:= 5 + (W*(W + U÷W) + 2)÷2
T := W +1
The above sequence of instructions will store _ in T
12.
X := 3
X := 2*X -
X
X := 2*X + X
X := 2*X -
X
X := 2*X + X
X := 2*X - X
X := 2*X +
X
Y := 2*X + 1
The above sequence of instructions will store ________ in Y.
13. What is the purpose of writing the following algorithm:
T := N1
IF N2 < T THEN
BEGIN
T := N2
END
IF N3 BEGIN
T := N3
END
Z := T
(a.). To assign the lowest value to
Z
(b.) To assign the highest value to Z
14. What does the programmer want to find out from the following algorithm:
IF 2*(X÷2) = X THEN
BEGIN
EVEN :=
1
END
IF 2*(X÷2) <> X THEN
BEGIN
ODD:= 1
END
_______________
15.
Complete the following table. Make sure all cells with numbers are
filled.
|
INSTRUCTIONS |
X1 |
X2 |
X3 |
TEMP |
|
X1:= 7 |
||||
|
X2:= 2 |
||||
|
X:3= 10 |
||||
|
IF X1 < X2 THEN |
||||
|
BEGIN |
||||
|
TEMP := X1 |
||||
|
X1 := X2 |
||||
|
X2 := TEMP |
||||
|
END |
||||
|
IF X2 < X3 THEN |
||||
|
BEGIN |
||||
|
TEMP := X2 |
||||
|
X2 := X3 |
||||
|
X3 := TEMP |
||||
|
END |
9. Complete this table. Make sure all cells that contain numbers are filled. PSEUDO-CODE INSTRUCTIONS X...