You are on page 1of 3

CLO2 (30)

TOTAL /30
RETURN DATE
*For PK(Lecturer) use only

DEPARTMENT OF INFORMATION AND COMMUNICATION TECHNOLOGY


COURSEWORK ASSESSMENT (Session: 2 2021/2022)

Name : Reg. No. :


Code&Course : DFC20113 / PROG. FUNDAMENTALS Programme/ Class :
Lecturer(s) : Week (Date) : W5 (4.04.22 – 8.4.22)
Submission Date :
Lab. Task(s) No. :1/2 [CLO: CLO2P] Duration : 2 hours

CLO2: Show simple programs by developing code to solve problems in a computer


using C++ programming language. (P2, PLO 3)

Instruction: Answer ALL the questions below.

1. Convert the following algorithm into C++ code and display the output. [CLO 2]

[15M]

Steps to calculate and display the average of three numbers.


Step 1: Declare the variables name as Number1, Number2, Number3, Total and Average with
data type float
Step 2: Prompt the user to enter a number and take the first number entered as Number1.
Step 3: Prompt the user to enter another number and take the number entered as Number2.
Step 4: Prompt the user to enter another number and take the number entered [15as Number3.
Marks]
Step 5: Assign the value obtained by the expression Total = Number1+Number2+Number3.
Step 6: Assign the value obtained in Total by the expression Average=(Total/3)
Step 7: Use the ‘cout’ statement to display the value of ‘Average’ on the screen.

Prepared by; Checked by; Verified by;

NURHANI BINTI MOHD SABRI


KETUA PROGRAM DDT
Jabatan Teknologi Maklumat & Komunikasi
(AHMAD ZULFAQAR AQWA BIN (NORZIMAH BINTI CHE HASSAN ) (NURHANIPoliteknik
BINTI MOHD SABRI)
Balik Pulau
ABU BAKAR)
Course Lecturer Course Coordinator (Cop Jawatan Ketua Jabatan /Ketua
Program/Ketua Kursus)

Date: 6/4/2022 Date: 6/4/2022 Date: 6/4/2022


DFC20113 / Laboratory Task 2/ Session II 2021/2022

2. Fill in the blanks for the following programs. Write the correct answers and complete the
code to display the output as in figure 1. [CLO 2]
[15M]

#include <iostream>
using namespace std;

int main()

, sub, mult, ,module; //create variables name as sum, sub, mult,


div, module using the same type
int a,b;

cout<<"Enter the first value ="


<< ; //take the value enter and save in variable a
cout<<"Enter the second value =;
cin<<b;

sum=a+b;
sub=a-b
mult=a*b;
div=a/b;
module=a%b;

//Complete the code to display output


return 0;
}

Sample output.

Figure 1
DFC20113 / Laboratory Task 2/ Session II 2021/2022

‘RUBRIK
,Question 1
CLO Criteria Exceptional Acceptable Amateur Unsatisfactory Unsolved
(5) (4) (3) (2) (1)
CLO 2 Program The C++ More than More than Less than No proper
program is 75% 50% 50% program program.
excellently program is program is is correct.
correct. correct. correct.
Declaration The More than More than Less than No proper
declaration of 75% 50% 50% declaration of
the variable declaration declaration declaration of variable and
and statement of variable of variable variable and statement.
is perfectly and and and statement is
correct based statement is statement correct.
on the given correct. is correct.
algorithm.
Output Output meets Output More than Less than Output does not
or exceeds the meets 75% output 50% output meet
requirement requirement meets meet requirement
requirement requirement

Question 2
CLO Criteria Exceptional Acceptable Amateur Unsatisfactory Unsolved
(5) (4) (3) (2) (1)
CLO 2 Program The C++ More than More than Less than No proper
program is 75% 50% 50% program program.
excellently program is program is is correct.
correct. correct. correct.
Correct Perfectly fill in More than More than Less than No correction of
the the blanks 75% of the 50% of the 50% of the the errors.
errors errors is errors is errors is
correct. correct. correct.
Output Output meets Output More than Less than Output does not
or exceeds the meets 75% output 50% output meet
requirement requirement meets meet requirement
requirement requirement

You might also like