Sunteți pe pagina 1din 4

MKS1013 Problem Solving Techniques

Matric No./Name: MUHAMMAD FARIS BIN MOHD FAUZI


Group: A / B

EXERCISES

1. What is the difference between a variable and a constant?


Variable: Can be an any number
Constant: Cannot be an any number just
2. What is the difference between 'FOR' and 'WHILE'?
FOR: Have a

3. What are the differences between sequence, selection and loop (repetition)?

4. Which of the following modular arithmetic operations is incorrect?

A. 8 mod 4 = 0.
B. -11 mod 4 = 1.
C. 250 div 10 = 25.
D. -100 mod -3 = -1.

5. Which logical operation should be used when both statements should be true? Give
one example involving this operation.
AND
= Today is 20 September 2019, today is Friday.

6. Represent this statement in a flow chart form.

"If your cheat in final exam, then you will be suspended"

Semester 1 Session 2019/2020


MKS1013 Problem Solving Techniques

START

FINAL EXAM

SUSPENDED

CHEAT
YES

NO

END

Semester 1 Session 2019/2020


MKS1013 Problem Solving Techniques

7. You need to obtain the temperature expressed in Fahrenheit degree and convert it to
degree Celsius. Express your answer in IPO Table, flow chart and pseudo code.

8. As a programmer, you are asked to code a program that requires and input as follows.

Input: username, password, name, address, postal code, state, telephone


number

State the appropriate data type for each of these input.

Variables Data Types


username STRING
password STRING
name CHAR
address STRING
postal_code INT
state CHAR
telephone_number INT

9. There are 10 software engineering (SE) majors and 5 creative industry (CI) majors in
computer science course. Draw ad IPO Table to represent the selection of five student
representatives to be selected, where three are SE majors while the rest are CI
majors?

10. A student can be approved for distinction if the mark is greater than or equal to 80 and
the grade achieved is 'A'. Find the algorithm to solve this question.

Semester 1 Session 2019/2020


MKS1013 Problem Solving Techniques

11. Compute the average of 20 numbers.

12. Read numbers and add them up until their total value reaches (or exceeds) a set value
represented by R.

13. Based on Table 1, decide on a student grade based on their coursework marks.

Table 1: UPSI's Grading Scale

Gred Julat Markah PNK (S/K)


A 80 – 100 4.00
A- 75 – 79 3.75
B+ 70 – 74 3.50
B 65 – 69 3.00
B- 60 – 64 2.75
C+ 55 – 59 2.50
C 50 – 54 2.00
C- 45 – 49 1.75
D+ 40 – 44 1.50
D 35 – 39 1.00
F 0 – 34 0

14. As a teacher of Class 3 Intrinsic, you are required to calculate the BMI for all 30
students. The readings for weight and height are in gram and cm, respectively. Then,
you need to find the average for all.

15. A container in a laboratory consists of 100 bacteria initially. A scientist found that 8% of the
colony of bacteria will reproduce after each hour. Represent this situation in an algorithm.

Semester 1 Session 2019/2020

S-ar putea să vă placă și