You are on page 1of 7

QUESTION 1

Construct a flow chart based on the pseudo code:

START

INSERT A KEY

FREE THE GEAR

TURN THE KEY TO THE


STARTING POSITION
(START)

CALL FOR
WORKSHOP

END
QUESTION 2
a. What is the suitable input for the problem?
The total remaining salary - tax
b. What will be the expected output?
The total of remaining salary after minus with tax
c. Write the pseudo code and construct the flow chart to solve
the problem.

PSEUDO CODE
1. Start / begin
2. Calculate the remaining salary
3. Subtract the remaining salary with tax

FLOW CHART

START

END
QUESTION 3
Create a flowchart to solve the problem.

START

CHECK

CHECK THE TIME

TIME BETWEEN TIME > 7:00


TIME <
12:00 7:00PM PM
12:00 PM

SELAMAT MALAM
SELAMAT PAGI
SELAMAT PETANG

END
QUESTION 4
a. Program A versus Program B

Program A

Source code
#include<stdio.h>
Int main 0
{
Int c=2, x;
x=2 + =c;
printf(%d\n,x);
return 0 ;
}

Output
>ch-uAB2.C
5
>Exit code : 6
Program B

Source code
#include <stdio.h>
int main ()
{
int c=2,x;
x=2 + c++;
printf (%\n,x);
return 0;
}

Output
>ch-uLAB2.C
4
>Exit code:0

Different between Program A and Program B

- Program A is 2+(2+1) = which is 5 and program B is 2+(2) =


which is 4
b. Program C versus program D

Program C

Source code

#include <stdio.h>
int main()
{
int c=2,x;
x=2 + --c;
printf (%d\n,x);
return 0;
}

Output
>ch-uLAB2.C
3
>Exit code : 0
Program D

Source code
#include <stdio.h>
{
int c=2,x;
x=2 + c --;
printf (%d\n,x);
return 0;
}

Output
>ch-u<ab2.c
4
>Exit code :

Different between program A and program B

- Program C is 2+(2-1) which is 3 and program D is 2+(2) which


is 4

You might also like