Chapter 1.0
Chapter 1.0
FUNDAMENTAL
What ?
Computer Programming
How to program ?
•Requires knowledge in the application domain
•Follow the steps in software development method
Programming is a problem-solving
activity
Programming Language ?
Method of communication for which
computers could understand and execute Function?
the instructions written in source code.
A programming
language is
therefore a Hello! What can I
do to you?
practical way
for us (humans)
to give
instructions to
a computer.
Tell me 1 + 1 is
equal to what???
1.1.2 Background of C programming.
C History
Why use C?
Examples of C programming
1.1.4 Explain the compile and execute programs.
Reference: http://c.camden.rutgers.edu/c_resources/c_programming/
1.2 Definition and types of
programming.
1.2.1 Define the following terms:
• Programme
• Programmer
• Programming language
1.2.1 Define the following terms:
Programme:
• A set of step-by-step instructions that tells a
computer to perform a specific task and to produce
the required results.
• written by the programmer
• Produced through programming
16
1.2.1 Define the following terms:
Programme.
Programmer.
Individual that composes instructions for computer systems to refer to
when performing a given action.
Define the following terms:
What is programming?
1.2.1
Programming
• Programming is a process of designing/
creating a program.
• It is a communication technique to explain the
instructions to the computer.
• Used to produce the program.
20
1.2.1 Define the following terms:
Programming Language.
a set of conventions in which instructions for the
machine are written.
A high-level language used to write computer
programs, as COBOL or BASIC, or, sometimes, an
assembly language.
An artificial language used to write instructions
that can be translated into machine language and
then executed by a computer.
1.2.1 Define the following terms:
Programming Language.
C language
assembly
Language
Motorola I.C
1.2.2 Describe the various types of
programming languages
High
Machine Assembly level
language
evel l an guage
Low l
23
1.2.2 Describe the various types of
programming languages
Category Explanation
Machine Binary number codes understood by
language a specific CPU
Assembly Mnemonic codes that correspond to
language machine language instructions
High level Machine-independent programming
language language that combines algebraic
expressions and English symbols.
PC architecture
1.2.2 Describe the various types of
programming languages
Assembler:
assembly machine
compiler or interpreter
high level machine
38
Assembly
code
Assembler
Object code
(machine language)
39
1.2.2 Describe the various types of
programming languages
• Structured programming
• Modular programming
• Object-Oriented programming
1.3.1 Explain the following types of programming:
module1 module2
data+data1 data+data2
procedure2 procedure3
procedure1
56
1.3.1 Explain the following types of programming:
Structured Programming is less secure as there is Object Oriented Programming is more secure
no way of data hiding. as having data hiding feature.
Structured Programming can solve moderately Object Oriented Programming can solve any
complex programs. complex programs.
Less abstraction and less flexibility. More abstraction and more flexibility.
1.4 Algorithm, flowchart
and pseudocode
Define the algoritm in programming
i. Definition: an algorithm is a step-by-step procedure
to solve a given problem.
Define the algoritm in programming.
i. An algorithm gives a solution to a particular problem as a
well defined set of steps.
ii. A recipe in a cookbook is a good example of an algorithm.
When a computer is used for solving a particular problem,
the steps to the solution should be communicated to the
computer.
iii. An algorithm is executed in a computer by combining lot of
elementary operations such as additions and subtractions to
perform more complex mathematical operations.
Define the algoritm in programming.
Advantages Disadvantages
Easily maintained
Easy to identify the mistake by non Difficult task to draw flow charts for big
computer person programs
Algorithm and flow chart to read the name and print the name.
Construct flowchart for the given problem.
a. Sequence structure.
In a computer program or an
algorithm, sequence involves
simple steps which are to be
executed one after the other. The
steps are executed in the same
order in which they are written.
a. Sequence structure.
Apply flowchart for the following
b. Selection Structure.
Selection is used in a
computer program or
algorithm to determine
which particular step or set
of steps is to be executed.
b. Selection Structure.
c. Looping Structure.
true
false
Apply flowchart for the following
c. Looping Structure.