0% found this document useful (0 votes)
27 views15 pages

TTS_Module1-CC102

COMPUTER PROGRAMMING

Uploaded by

darwinteberio0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views15 pages

TTS_Module1-CC102

COMPUTER PROGRAMMING

Uploaded by

darwinteberio0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

INFORMATION SHEET PR-1.1.

1
“Introduction to Computer Program”

What is a computer program?


Computers can do such a wide variety of things because they can be programmed. This
means that computers are not designed to do just one job, but to do any job that their programs tell
them to do.
A computer program is a set of instructions that tells the computer exactly what to do.
Programs are designed to perform specific tasks. Without programs, computer is useless. A program is
like a recipe. It contains a list of ingredients (called variables) and a list of directions (called statements)
that tell the computer what to do with the variables. These programs are written by programmers-
individuals who write the debug computer programs.
For example, Figure 1-1 shows screens from two commonly used programs, Microsoft Word and
Adobe Photoshop. Microsoft Word is a word processing program that allows you to create, edit, and
print documents with your computer. Adobe Photoshop is an image editing program that allows you to
work with graphic images, such as photos taken with your digital camera

Why writes Programs?


If you want your computer to do exactly what you want it to do, you must write a program. A
computer does nothing on its own. A computer does nothing more than blindly follow instructions
supplied by a programmer, it cannot think for itself.
Programming
Programming is the art and science of creating programs. It is a problem-solving activity that
involves planning and designing solutions for a particular problem and then writing the solution in code
using a programming language.
How a Program Works
A computer’s CPU can only understand instructions that are written in machine language.
Because people find it very difficult to write entire programs in machine language, other programming
languages have been invented.
We stated that the CPU is the most important component in a computer because it is the part
of the computer that runs programs. Sometimes the CPU is called the “computer’s brain,” and is
described as being “smart.” Although these are common metaphors, you should understand that the
CPU is not a brain, and it is not smart. The CPU is an electronic device that is designed to do specific
things. In particular, the CPU is designed to perform operations such as the following:
 Reading a piece of data from main memory
 Adding two numbers
 Subtracting one number from another number
 Multiplying two numbers
 Dividing one number by another number
 Moving a piece of data from one memory location to another
 Determining whether one value is equal to another value

As you can see from this list, the CPU performs simple operations on pieces of data. The CPU
does nothing on its own, however. It has to be told what to do, and that’s the purpose of a program. A
program is nothing more than a list of instructions that cause the CPU to perform operations. Each
instruction in a program is a command that tells the CPU to perform a specific operation. Here’s an
example of an instruction that might appear in a program: 10110000

To you and me, this is only a series of 0s and 1s. To a CPU, however, this is an instruction to
perform an operation. It is written in 0s and 1s because CPUs only understand instructions that are
written in machine language, and machine language instructions always have an underlying binary
structure. A machine language instruction exists for each operation that a CPU is capable of performing.
For example, there is an instruction for adding numbers, there is an instruction for subtracting one
number from another, and so forth. The entire set of instructions that a CPU can execute is known as
the CPU’s instruction set.
NOTE: There are several microprocessor companies today that manufacture CPUs. Some of the
more well-known microprocessor companies are Intel, AMD, and Motorola. If you look carefully at your
computer, you might find a tag showing a logo for its microprocessor. Each brand of microprocessor has
its own unique instruction set, which is typically understood only by microprocessors of the same brand.
For example, Intel microprocessors understand the same instructions, but they do not understand
instructions for Motorola microprocessors.

Programs are usually stored on a secondary storage device such as a disk drive. When you install a
program on your computer, the program is typically copied to your computer’s disk drive from a CD-
ROM, or perhaps downloaded from a website. Although a program can be stored on a secondary
storage device such as a disk drive, it has to be copied into main memory, or RAM, each time the CPU
executes it. For example, suppose you have a word processing program on your computer’s disk. To
execute the program, you use the mouse to double-click the program’s icon. This causes the program to
be copied from the disk into main memory. Then, the computer’s CPU executes the copy of the program
that is in main memory. This process is illustrated in Figure 1-16.
The example shown is an actual instruction for an Intel microprocessor. It tells the
microprocessor to move a value into the CPU.
When a CPU executes the instructions in a program, it is engaged in a process that is known as
the fetch-decode-execute cycle. This cycle, which consists of three steps, is repeated for each
instruction in the program. The steps are:
1. Fetch A program is a long sequence of machine language instructions. The first step of the cycle
is to fetch, or read, the next instruction from memory into the CPU.
2. Decode A machine language instruction is a binary number that represents a command that
tells the CPU to perform an operation. In this step the CPU decodes the instruction that was just
fetched from memory, to determine which operation it should perform.
3. Execute The last step in the cycle is to execute, or perform, the operation. Figure 1-17 illustrates
these steps.

The Program Development Process


1. Planning – First identify the problem. Once you have an idea, or if someone comes to you with
the idea or a need for a program, spend some time thinking through the major components and
parts of the program. Decide the overall goals of the program. Will the program produce
reports? Will the program calculate values?
One must determine the problems that needs to be addressed, plan for solutions and
analyze how these solutions can solve the problem. This will help you in determining the
program’s goals and the inputs and outputs required.
2. Coding – This is the second stage, writing the source code. You can use a program development
tool such as Visual Basic to write the program. It is the most tedious part of the programming
stage. The source code is the actual programming instructions that the computer follows. You
will spend most of your programming time working on the source code. Just remember that
before you start coding, you should have planned properly what the program is for and what it
should do.
3. Testing and Debugging – Errors called bugs, often appear in programs because of the details
and syntax needed for even the simplest of programs. Therefore, one most test the program
thoroughly the fix the errors. Fixing errors is called debugging. Once all the errors are out of the
program, one has a finished application.
4. Documentation – When the program is finished and thoroughly tested, documentation is
included for its distribution. Documentation includes the necessary information about the
profile and requirements of the program the hardware requirements and operating system
needed to run the program. It also contains technical information such as where and who
created the program, who to contact with, and what are the instructions in the use and
maintenance of the program.
5. Maintenance – The final stage in programming is the maintenance or updating of the program.
This is the stage where the programmer is tasked to keep the program running smoothly and
updated with the development and changes in the field where it is used.
Classification of Program Bugs
1. Syntax Error – refers to the error in spelling and grammar of the particular programming
language. These errors occur when commands or statements used in the program are not
written correctly or when a statement or an expression references non-existing variables.
2. Logic Error – syntactically correct but still produces incorrect results. Errors that may occur
unnoticed by the programmer. These errors are sometimes caused by wrong formulas or
miscalculations.
Programming Languages
A programming language is a vocabulary and set of grammatical rules for instructing a computer
or computing device to perform specific tasks. The term programming language usually refers to high-
level languages, such as BASIC, C, C++, COBOL, Java, FORTRAN, Ada, and Pascal.
Each programming language has a unique set of keywords (words that it understands) and a
special syntax for organizing program instructions.
Example of Programming Languages
Classifications of Programming Languages
Programming languages can be viewed or classified by their level. There are four distinct levels
of programming languages.
1. Declarative language – the most English-like programming language in its most expressive
power and functionality. This is the highest level of language compared to its counterparts and
focuses more on Object-Oriented Programming. (Ex. Visual Basic, Delphi, Visual C++, PROLOG,
Smalltalk).
2. High-level language – until the outbreak of object-oriented programming, this has been the
most widely used level of programming language. It is easier to understand because it used
English commands to carry out of instructions. (Ex. BASIC, COBOL, Pascal, FORTRAN).
3. Assembly language – a type of low-level language that allows the programmer to interact
directly with the hardware. This language requires the user to have an extensive knowledge of
computer architecture. Programs written in this language needs to be translated by the
programmer into machine language using a tool called an assembler.
4. Machine language – this is the only language that a computer can understand. Otherwise
known as machine code, machine language is the result of the compilation of other higher-level
languages such as Pascal or C.
INFORMATION SHEET PR-1.1.2
“ALGORITHM”
Algorithm
Algorithm is a finite set of instructions that specify a sequence of operations to be carried out in
order to solve a specific problem or class of problems / is a step-by-step procedure for calculations.
Algorithms are used for calculation, data processing and automated reasoning. (Ex. recipe, instructions)
The term algorithm originally referred to any computation performed via a set of rules applied
to numbers written in decimal form. The word is derived from the phonetic pronunciation of the last
name of Abu Ja'far Mohammed ibn Musa al-Khowarizmi, who was an Arabic mathematician who
invented a set of rules for performing the four basic arithmetic operations (addition, subtraction,
multiplication and division) on decimal numbers.

An algorithm is a representation of a solution to a problem. If a problem can be defined as a


difference between a desired situation and the current situation in which one is, then a problem
solution is a procedure, or method, for transforming the current situation to the desired one. We solve
many such trivial problems every day without even thinking about it, for example making breakfast,
travelling to the workplace etc. But the solution to such problems requires little intellectual effort and is
relatively unimportant. However, the solution of a more interesting problem of more importance usually
involves stating the problem in an understandable form and communicating the solution to others. In
the case where a computer is part of the means of solving the problem, a procedure, explicitly stating
the steps leading to the solution, must be transmitted to the computer. This concept of problem
solution and communication makes the study of algorithms important to computer science.

Throughout history, man has thought of ever more elegant ways of reducing the amount of
labor needed to do things. A computer has immense potential for saving time/energy, as most
(computational) tasks that are repetitive or can be generalized can be done by a computer. For a
computer to perform a desired task, a method for carrying out some sequence of events, resulting in
accomplishing the task, must somehow be described to the computer. The algorithm can be described
on many levels because the algorithm is just the procedure of steps to take and get the result. The
language used to describe an algorithm to other people will be quite different from that which is used by
the computer, however the actual algorithm will in essence be the same. An example of an algorithm
people use would be a recipe to make a cake.

"4 extra large eggs, beaten


1&1/2 C. stock
1/2 teaspoon salt
1 scallion, minced
1 C. small shrimp or lobster flakes
1 t. soy sauce
1 Tablespoon oil
1. Mix all the ingredients, except the oil, in a deep bowl.
2. Put 1" water in wide pot, then place deep bowl of batter inside.
3. Cover pot tightly and steam 15 min.
4. Heat oil very hot and pour over custard.
5. Steam 5 more min. Serves 4 people"
6. This breaks down 'Making Chinese egg custard' into smaller steps. To make the product
7. one still needs to know how to execute each of the steps in the procedure and understand
8. all of the terms.

A procedure is a finite sequence of well-defined instructions, each of which can be mechanically


carried out in a finite amount of time.

The procedure must break up the problem solution into parts that the recipient party can
understand and execute. In the case of a computer, the problem solution is usually in the form of a
program that encompasses the algorithm and explains to the computer a clearly defined procedure
for achieving the solution. The procedure must consist of smaller steps each of which the computers
understand. There may be no ambiguities in the translation of the procedure into the necessary
action to be taken. A program is then just a specific realization of an algorithm, which may be
executed on a physical device.

A computer is essentially a physical device designed to carry out a collection of primitive actions.
A procedure is a sequence of instructions written in terms of which evoke a proper operation. To
make effective use of an algorithm on a computer one must not only find and understand a solution
to the problem but also convey the algorithm to the computer, giving the correct sequence of
understood commands that represent the same algorithm.

Reference:
Introduction to Computers 1 and Programming(0321537114.pdf)
https://www.webopedia.com/TERM/P/programming_language.html#:~:text=A%20programming
%20language%20is%20a,FORTRAN%2C%20Ada%2C%20and%20Pascal.
https://whatis.techtarget.com/definition/algorithm
SELF CHECK PR-1-1-1

Identify the following:

1. _______________________ This is the highest level of language compared to its counterparts


and focuses more on Object-Oriented Programming
2. _______________________ is a finite sequence of well-defined instructions, each of which can
be mechanically carried out in a finite amount of time.
3. _______________________ is a set of instructions that tells the computer exactly what to do.
4. _______________________ is a representation of a solution to a problem
5. _______________________ this is the only language that a computer can understand
SELF-CHECK ANSWER KEY PR-1.1.1

1. Declarative Language
2. Procedure
3. Program
4. Algorithm
5. Machine language
STUDENT NAME: __________________________________ SECTION: __________________

PERFORMANCE TASK PR-1-1-1


PERFORMANCE TASK TITLE: Computer Programs

PERFORMANCE OBJECTIVE: The learners independently demonstrate core competencies about


Computer Programs
MATERIALS:
Computer / Android phone

Applications / Software:
MS Word
Internet Browser (ex. Google Chrome, Safari, Opera)
Procedure:
A. Give 5 example of computer programs
B. Type the name and example screenshot of a program(picture).
Ex. MS Paint

PRECAUTIONS:
 Undertake final inspections to ensure the program conform to requirements
ASSESSMENT METHOD: PERFORMANCE TASK CRITERIA CHECKLIST
STUDENT NAME: __________________________________ SECTION: __________________

PERFORMANCE TASK CRITERIA CHECK LIST PR-1.1-1


SCORING
CRITERIA
1 2 3 4 5
1. Quality of Work – the ability to follow procedures with precision and the
art, skill and finality of work
2. Speed – efficiency of work
3. Proper use of statement – the ability to apply proper statement for a
given task
TEACHER’S REMARKS:  QUIZ  RECITATION  PROJECT
GRADE:

5 - Excellently Performed
4 - Very Satisfactorily Performed
3 - Satisfactorily Performed
2 - Fairly Performed
1 - Poorly Performed

_________________________________
TEACHER

Date: ______________________
STUDENT NAME: __________________________________ SECTION: __________________

WRITTEN WORK PR-1.1.1


WRITTEN WORK TITLE: Algorithm.

WRITTEN TASK OBJECTIVE: The learners independently demonstrate core competencies in


understand the algorithm.
MATERIALS:
 Pen and Paper
TOOLS & EQUIPMENT:
 None
ESTIMATED COST: None
Give the answer of the following problem:
1. 5-2*9+3(4+6)/2 = ____
2. 45*9+50/8-10 = ____
3. (9*9-5)+(5+8*9)= ____
4. x=5
x = x +5
x = x*9
x = ____
5. y=0
y=y+8
y=y-2
y=0
y=___

PRECAUTIONS:
 None
ASSESSMENT METHOD: WRITTEN WORK CRITERIA CHECKLIST
STUDENT NAME: __________________________________ SECTION: __________________

WRITTEN OUTPUT CRITERIA CHECK LIST PR-1.1.1

CRITERIA SCORING
Did I . . .
1 2 3 4 5
1. Observe safety precautions?
2. Use proper syntax?
3. Observed correctly the output?
TEACHER’S REMARKS:  QUIZ  RECITATION  PROJECT

GRADE:

5 - Excellently Performed
4 - Very Satisfactorily Performed
3 - Satisfactorily Performed
2 - Fairly Performed
1 - Poorly Performed

_______________________________
TEACHER

Date: ______________________

You might also like