You are on page 1of 6

COURSE NAME BASIC PROGRAMMING MARKS:

COURSE CODE SKJ1053


STUDENT NAME
/10
DANISH HAKIM BIN AZRUL HISHAM
MATRIC NUMBER 1220496

QUESTION NO. 1

1. The area of the rectangle is the region enclosed by the perimeter of the rectangle and is equal to
product of length and width.
a. Identify an input, process and output to develop a program to calculate AREA of a rectangle.
i. Input data:
 Length
 Width
ii. Process the input:
 Area = Length X Width
iii. Output Data:
 Area

b. Develop a pseudocode based on Question No. 1.

START
SET area is equal to zero
READ length, width
CALCULATE area = length x width
PRINT area
END
c. Draw a flowchart for a program in Question No. 1.
QUESTION NO. 2

2. What is the output of the following flowchart when the input Num = 4.

Output : Result = 10

Initialize Result = 0 Count


= Num

Result = Result +
Count
Count = Count - 1
QUESTION NO. 3

3. What will be the output for the following input?


a. Book Green 350.00
Book Green, 350.00

b. Curtain Red 500.00


Curtain Red, 450.00
QUESTION NO. 4

4. Write down a pseudocode and draw a flowchart to read two numbers. If the first number is
greater than the second number and it is larger than 50, find the sum and print the sum. Else,
print the difference.
a. Pseudocode

BEGIN
READ num1, num2
PRINT “Enter the first number”
INPUT num1

PRINT “Enter the second number”


INPUT num2

IF num1 > num2


IF num1 > 50
sum = num1 + num2
PRINT “The sum is “ sum

ELSE
difference = num1 – num2
PRINT “The difference is” difference
END
b. Flowchart

You might also like