0% found this document useful (0 votes)
21 views

CP 2 Lesson 2

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)
21 views

CP 2 Lesson 2

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/ 7

QUARTER 1 – Week 2

Introduction to Computer Programming 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. Demonstrate an understanding of the history of programming languages


2. Explain the differences in the levels of programming languages.

Three Levels of Programming

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"

3. HIGH LEVEL LANGUAGES


 High-level languages, like C,C++, JAVA etc., are more English-like and,
therefore, make it easier for programmers to “think” in the programming
language. High-level languages also require translation to machine
language before execution. This translation is accomplished by either a
compiler or an interpreter. Compilers translate the entire source code
program before execution.(Eg: C++, Java) Interpreters translate source
code programs one line at a time. (Eg: Python)Interpreters are more
interactive than compilers.
Differences between Machine-Level language and Assembly language

The following are the differences between machine-level language and assembly
language:

High-Level Language

The high-level language is a programming language that allows a programmer to


write the programs which are independent of a particular type of computer. The high-
level languages are considered as high-level because they are closer to human
languages than machine-level languages.

When writing a program in a high-level language, then the whole attention needs to be
paid to the logic of the problem.

A compiler is required to translate a high-level language into a low-level language.

Advantages of a high-level language

 The high-level language is easy to read, write, and maintain as it is written in


English like words.
 The high-level languages are 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.

Differences between Low-Level language and High-Level language

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.

 It 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 in contrast to using simple tests and
jumps such as the go to statement, which can lead to “spaghetti code” that is
potentially difficult to follow and maintain.

 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.

Three main categories of control structures:


 Sequence
o Very boring. Simply do one instruction then the next and the next. Just
do them in a given sequence or in the order listed. Most lines of code
are this.
 Selection
o This is where you select or choose between two or more flows. The
choice is decided by asking some sort of question. The answer
determines the path (or which lines of code) will be executed.
 Iteration
o Also known as repetition, it allows some code (one to many lines) to be
executed (or repeated) several times. The code might not be executed
at all (repeat it zero times), executed a fixed number of times or
executed indefinitely until some condition has been met. Also known
as looping because the flowcharting shows the flow looping back to
repeat the task.
 Branching
o An uncontrolled structure that allows the flow of execution to jump to a
different part of the program. This category is rarely used in modular
structured programming

Example of Structured programming


Wh
at I
1.hav
What level of programming do you thing is easy to use?
2. In creating a structured program what type are you going to consider?
3. eIn near future being a software developer, what kind of applications or
software do you plan to develop and why?
4.lear
What motivates you to become our future software developer?
ned
? Read and understand the following sentences. Identify what is being
Direction:
asked in the each statement.

__________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.

You might also like