Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE HELP me those questions 15. IF X < 0 THEN BEGIN X : = -1*X END IF 2*(X÷2)

ID: 3932675 • Letter: P

Question

PLEASE HELP me those questions

15.
IF X < 0 THEN
BEGIN
X : = -1*X
END
IF 2*(X÷2) <> X THEN
BEGIN
X := X - 1
END
ELSE
BEGIN
X : = X + 1
END
The purpose of writing the above algorithm is
If X is negative, make it positive. If X is odd, subtract one from X;
If X is negative, make it positive. If X is even, add one to X.
(a.) TRUE (b.) FALSE

18. What is the purpose of writing the following algorithm:
T := N1
IF N2 < T THEN
BEGIN
T := N2
END
IF N3 <T THEN
BEGIN
T := N3
END
Z := T
(a.). To assign the lowest value to Z

(b.) To assign the highest value to Z

19. What does the programmer what 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
___________________________________

Explanation / Answer

15) both the statements are true it is converting negative number into positive and if it is odd subtracting 1 else add 1 to even number. The condition checking it is as follows:

2*(X÷2) <> X

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote