You are on page 1of 2

NAME

REGISTRATION NO MARKS

/30
CLASS
CODE/SUBJECT DFC20113 – PROGRAMMING
FUNDAMENTAL
ASSESSMENT LAB TASK 1
LECTURER

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


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

TOPIC: 1.2: EXPLAIN IDENTIFIER AND DATA TYPES


1.3: IDENTIFY THE BASIC OF COMPUTER PROGRAM
1.4: DESCRIBE THE COMPILING AND DEBUGGING PROCESS, AND
ERRORS IN PROGRAMMING

DURATION: 2 HOURS
INSTRUCTION: ANSWER ALL THE QUESTIONS

QUESTION 1
#include<iostream>

using namespace std;

int main(){
_____ hours;
_____ payment;
_____ price1 = 2;

cout<<"Enter hours :";


cin>>hours;
payment = hours * _____;
cout<<"Your fee is: RM"<<_____ <<endl<<"Please come again!"<<endl;
return 0;

}//end of int main()


Figure 1

Based on the program in Figure 1:


i. Type and compile the program given. Fix the error by complete the program with
correct data types. Print screen the program after compiling. (CLO2, P2)
(10 marks)

ii. Display your output. (CLO2, P1)


(2 marks)
NAME
REGISTRATION NO MARKS

/30
CLASS
CODE/SUBJECT DFC20113 – PROGRAMMING
FUNDAMENTAL
ASSESSMENT LAB TASK 1
LECTURER

QUESTION 2
#include <iostream>
#include <______>

using namespace std;

int ______(){
string name;
______ address;
string matrixNumber;
string ______;

cout<<"Enter Following Data : "<<endl<<endl;


cout<<"Name : ";
getline (cin, ______);

cout<<"Address : ";
getline (cin, address);

cout<<"Matrix Number : ";


cin>>______;

cout<<"Department: ";
getline (cin, department);

cout<<endl;
cout<<"PMJ Student Data"<<endl;
cout<<"------------------------------"<<endl;

cout<<"Name : "<<name<<endl;
cout<<"Address : "<<______<<endl;
cout<<"Matrix Number : "<<matrixNumber<<endl;
cout<<"______ "<<department<<endl;

return 0;

}
Figure 2

Based on Figure 2 given above:


i. Type the given code. Print screen the process of debugging and compiling. Then fix
the error by complete the program with correct elements of programming. (CLO2, P2)
(14 marks)

ii. Display your output. (CLO2, P1)


(4 marks)

You might also like