CP 2 Lesson 2
CP 2 Lesson 2
Reminder to Parents
Learners may need your guidance and assistance when it comes to some
lessons in this module. You may assist them in some process and directions in
answering question on their activities. Make sure that they will easily understand and
perform the skills needed to this module
Reminder to Learners
This module is created to assist you and make you understand in the easiest way
on how to understand Computer Programming 2. It is develop to guide you step by step
ways on how to create basic programming and how programming begins. This module
contains discussions, activities, practices and pre-test and quizzes for you to assess
your learning’s with regards this subject.
Introduction
In this subject, students are introduced to programming concepts. Students work
in a hands-on environment, allowing time to discuss and practice each programming
concept. Students learn to write and debug programs in an integrated development
environment. Topics include memory concepts, control structures, using built in
functions, building sub procedures and functions, error handling and sequential file
processing. This course also helps students gain basic HTML/JavaScript Programming
skills and is an entry point into both the Web and Windows app training paths .. This
course focuses on using HTML/JavaScript to implement programming logic, define and
use variables, perform looping and branching , develop user interfaces, capture and
validate user input, store data and create well-structured application. The focus will be
on coding activities that enhance the performance and scalability of the Web site
application.
Chapter 1 Lesson 2 – Levels of Programming Languages
Learning Objective
1. MACHINE LANGUAGES
It is the “native tongue” of the computer, the language closest to the
hardware itself.
Each unique computer has a unique machine language. A machine
language program is made up of a series of binary patterns (e.g.,
01011100) which represent simple operations that can be accomplished
by the computer (e.g., add two operands, move data to a memory
location).
They are executable, meaning that they can be run directly. Programming
in machine language requires memorization of the binary codes and can
be difficult for the human programmer. A nice and interactive example is
present here.
2. ASSEMBLY LANGUAGES
They represent an effort to make programming easier for the human. The
machine language instructions are replaced with simple pneumonic
abbreviations (e.g., ADD, MOV). Thus assembly languages are unique to
a specific computer (machine). Prior to execution, an assembly language
program requires translation to machine language. This translation is
accomplished by a computer program known as an Assembler.
Assemblers are written for each unique machine language.
The following assembly language can be used to add the numbers
3 and 4:
mov eax, 3- loads 3 into the register "eax"
mov ebx, 4- loads 4 into the register "ebx"
add eax, ebx, ecx - adds "eax" and "ebx" and stores the result (7) in
"ecx"
The following are the differences between machine-level language and assembly
language:
High-Level Language
When writing a program in a high-level language, then the whole attention needs to be
paid to the logic of the problem.
The following are the differences between low-level language and high-level
language:
Chapter 1 Lesson 3 – Programming Structures
Structured Programming
is a programming paradigm aimed at improving the clarity, quality, and
development time of a computer program by making extensive use of the
structured control flow constructs of selection (if/then/else) and repetition (while
and for), block structures, and subroutines.
is most frequently used with deviations that allow for clearer programs in some
particular cases, such as when exception handling has to be performed.
It emerged in the late 1950s with the appearance of the ALGOL 58 and ALGOL
60 programming languages, with the latter including support for block structures.
Contributing factors to its popularity and widespread acceptance, at first in
academia and later among practitioners, include the discovery of what is now
known as the structured program theorem in 1966,and the publication of the
influential "Go To Statement Considered Harmful" open letter in 1968 by Dutch
computer scientist Edsger W. Dijkstra, who coined the term "structured
programming".
Control Structured
It is the mechanisms that allow us to control the flow of execution.
Flowcharting - is a method of documenting (charting) the flow (or paths) that
a program would execute.
__________1. The “native tongue” of the computer, the language closest to the
hardware itself.
__________2. This is a programming paradigm aimed at improving the clarity, quality,
and development time of a computer program
__________3. It make it easier for programmers to “think” in the programming
language.
__________4. It is the mechanisms that allow us to control the flow of execution.
__________5. A method of documenting (charting) the flow (or paths) that a program
would execute.
__________6. An uncontrolled structure that allows the flow of execution to jump to a
different part of the program.
__________7. The machine language instructions are replaced with simple pneumonic
abbreviations
__________8. He coined the term "structured programming".
__________ 9. This is where you select or choose between two or more flows.
__________10.Allows some code (one to many lines) to be executed (or repeated)
several times.
__________11.it is most frequently used with deviations that allow for clearer programs
in some particular cases, such as when exception handling has to be
performed.
__________12. It is designed to overcome the limitation of low-level language, i.e.,
portability. The high-level language is portable; i.e., these languages
are machine-independent
__________13. Each unique computer has a unique machine language. A machine
language program is made up of a series of binary patterns (e.g.,
01011100) which represent simple operations that can be
accomplished by the computer (e.g., add two operands, move data to a
memory location).
__________14. is a method of documenting (charting) the flow (or paths) that a
program would execute
__________15. , it allows some code (one to many lines) to be executed (or repeated)
several times.