You are on page 1of 3

Daevan A/L Ravee 1111112771 DCS 5088 OBJECT ORIENTED PROGRAMMING

Tutorial 1

Tutorial 1 Chapter 1: Introduction 1) What is procedural programming? Constructs procedures or functions Collection of programming statements that perform a specific task. Each procedures contain their own variables and commonly share variables with other procedures 2) Describes the main characteristics of procedural programming? 1. Comment

Comment is used to make a program easier be read.

2. Pre-processor directives

A component in C++ compiler will direct the pre-processor directives to insert the content of iostream.h file into the program

3. Function header

Consists of value, which will be returned (in the example, the value is of type int). It is a function, which will be first executed by the compiler.

4. Main() function body

Braces on the left side {shows the beginning of each function and the one on the right side} shows the ending of the function. All statements in C++ function is delimited in braces and called block.

3) What are the main conceptual differences between object-oriented programming and the other programming techniques? The main aspects of OOP is that the programs are defined in terms of objects. Each object contains data and code to manipulate data.

MULTIMEDIA UNIVERSITY

Daevan A/L Ravee 1111112771 DCS 5088 OBJECT ORIENTED PROGRAMMING

Tutorial 1

4) Give explanation to the following terms: a. Object - Object is the term used to explain many things b. Class - Class is the blueprint of objects. c. Data abstraction - Data abstraction is a process to delete all unnecessary attributes and remain d. Data encapsulation - Encapsulation is a principle about hiding the details of the implementation of the interface e. Inheritance - Inheritance is the ability to create a new object from an existing one f. Dynamic binding The property of OOP language where the code executed to performe a given operation is determine at minimum time 5) Explain the benefits of using Object Oriented Programming. Code extensibility

Ability to add codes, which are already existing and consistent with, needs. It is more suitable for a new program. Example: A VCR remote control functions the same way as the new VCR, which will be used in the future. Code reusability

Existing code can be tested first before it is inherited from previous module. This will save cost and time needed to develop software. With this method, it will help to increase programmers productivity. Represent real world

Using object-oriented concept, it will assist the programmer in creating a module because data used represents real situations. Thus, difficulties in developing software can be reduced. Data security

The use of encapsulation concept has made data to be protected from misuse by an unauthorized person.

MULTIMEDIA UNIVERSITY

Daevan A/L Ravee 1111112771 DCS 5088 OBJECT ORIENTED PROGRAMMING

Tutorial 1

6) What is an algorithm? How does it differ from a program? The algorithm define a collection of function especially designed to be used on ranges of elements. 7) Distinguish between variables and objects. Variable holds single data and object holds many variables. 8) Identify the errors in the C++ program below //First C++ program main() cin<<Hello!<<endl; return 0; main() cout<<Hello!<<endl; return 0;

MULTIMEDIA UNIVERSITY

You might also like