ICT - JAVA1-Grade11 - IntroToProgrammingLanguage
ICT - JAVA1-Grade11 - IntroToProgrammingLanguage
JAVA 1
Quarter 1 – Module 2:
Introduction to Programming Languages
Development Team:
Writer: Randy T. Mercado
Reviewer: Marife P. De Castro
Layout: Laurence E. Leonen
Management: Dr. Edwin T. Casila, MCL – Principal
Christian D. Manalansan – President
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 1 of 17
Mind and Integrity College, Inc.
Selina-Liz Bldg. National Hi-way, San Cristobal, Calamba City, Laguna
Contact #: 049-531-1604 / 0908-965-0010
Email Address: mai.school@yahoo.com
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 2 of 17
Dear Parents,
Mind and Integrity College, Inc. is one with every Filipino family in coping with the
demands of our modern times amidst the threat of COVID-19 pandemic.
Thank you in advance for being one with us! Together, let us envision that, by the
end of this school year, we will see your child as one responsible young person with a
heart and mind for humanity, for nature, for the country, and for God.
Dear Learner,
This is our gift to you. The school initiated the distribution of Self-Learning
Modules (SLM) that will help you keep up with the lesson whether you opted for online,
modular, or blended learning as a modality.
Please take time to read and do the activities in these SLM as if you are reporting
in school. Set a regular study schedule for you as much as possible, but keep in mind
that these SLM will enable you to learn at your own pace. If you do not understand a
lesson, the SLM would not mind you flipping back the pages repeatedly for review. Also,
remember to keep in touch with your teachers. Send them a message through your
online sessions or write them a note as you do your modular activities.
We wish you good luck in your studies, and we hope that you will remain happy
and enthusiastic in learning!
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 3 of 17
What This Module is About
Welcome to the 21st Century Society!
We live in a world where the advancement of technologies are going fast – paced and as
the first century looms ahead, it is clear to see that it has advancements that humanity may
never have dreamed of and one of these shining developments is the well-recognized
computer. Having the Latin meaning of ‘computing’ or ‘reckoning’ the computer is an invention
that was called the ‘MAN OF THE YEAR’ in a survey carried out by an international magazine.
This module is an introductory part for the subject in JAVA 1, which will pave the way
towards more meaningful discussions and interactions. This is aimed in introducing the concept
of Programming Languages to Senior High School learners, as solid ground for college
readiness. Basic concepts and terminologies will be presented as we go along the module.
Together, let us scan the next few pages of this module in order for us to be fully
equipped and to be computer literate individual. There are several standard symbols (icons)
used as you go about in the completion of this module. For instance, a hand cupped with a
sprout represents an activity that introduces you to a new lesson or concept. This is reinforced
with the magnifying glass icon that discusses the activity as a part of the lesson, enabling you to
discover and understand the totality of the lesson. Highlighting each lesson is your application of
learning, an activity that shall transfer the skills and knowledge gained into your real life
situations, symbolized with a nut and wrench tandem.
This module contains varied activities that can help you as a Senior High School student
to not just be a computer literate individual, but a creative and critical thinker as well as solving
problems and logical thinking.
NOTE: Prepare yellow pad papers where you would write all your outputs for this
module. Do not forget to label your works properly corresponding to the title of each
activity. Do not forget to write your name, section and the date of first entry.
Make sure to clip/staple your works so that they will not easily be separated. It is advised
to take down notes about the important information from each lesson because of the
modules will be returned at the end of every week. Please do not write anything on
module.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 4 of 17
How to Learn from this Module
To achieve the objectives cited above, you are to do the following:
Take your time reading the lessons carefully.
Follow the directions and/or instructions in the activities and exercises diligently.
Answer all the given tests and exercises.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 5 of 17
What I Know
Multiple Choice: Select the letter of the best answer from among the given choices.
1. It is a set of instructions written in a language (such as BASIC) understandable by the
computer to perform a particular function on the computer.
A. Computer B. Computer Program
C. Programmer D. Programming Language
3. This type of translator scan the whole program and translate it into an equivalent
machine language program.
A. Compiler B. Transistor
C. Interpreter D. Runner
9. This precisely specify the ‘words’ of the language, and how they may be combined legally.
A. Backus – Naur Form B. Logic Rules
C. Semantic Rules D. Syntax Rules
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 6 of 17
Lesson 1: Introduction to Programming Languages
Programming is the art of developing computer programs with the aid of selected
programming language by a computer programmer. It is a special skill whose quality is tested
by the quality of the resulting program or software. In programming, programming stages must
be properly followed, i.e from problem definition to maintenance and review.
Assembly Language. The first step in the evolution of programming languages was the
development of what is known as an assembly language. In an assembly language, mnemonics
are used to represent operations to be performed by the computer and strings of characters to
represent addresses of locations in the computer’s memory where the operands will be stored.
Thus the language is matched to a particular computer’s processor structure and is thus
machine dependent. A translator called an assembler translates a program written in assembly
language to a set of machine instructions, which can be executed by a computer. Now-a-days
programs are written in assembly language only in applications which are cost sensitive or time
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 7 of 17
critical as efficiency of machine code is of paramount importance in these types of applications.
A cost sensitive application is one in which microprocessors are used to enhance the
functionality of consumer items such as washing machines or music systems. In these cases
the program is stored in a read only memory and its size is small. Thus code optimisation is
important. A time-critical application is use of microprocessors in aircraft controls where real
time operation of the system is required. Here again the number of machine instructions
executed should be minimised.
High Level Languages. During the evolution of computers, till about 1955, computers were
slow and had a small memory. Thus programming efficiency was very important and assembly
language was dominant. With improvements in technology, computers were designed with
larger memory capacity, higher speed and improved reliability. The tremendous potential of
computer applications in diverse areas was foreseen. It was evident that this potential could be
realised only if a non-expert user could effectively use the computer to solve problems. It was
thus clear that a user should be concerned primarily with the development of appropriate
algorithms to solve problems and not with the internal logical structure of a computer.
Consequently a good notation to express algorithms became an essential requirement. For
algorithms to be executed by computers, the notation to express them should be simple,
concise, precise and unambiguous. The notation should also match the type of algorithm. For
example, programming languages to solve science and engineering problems should support
arithmetic using wide ranging, high precision real and complex numbers and should have
features to express operations with arrays and matrices. On the other hand, algorithms for
processing business data would have operations to be performed on massive amounts of
organised data known as files. The notation, in this case, must facilitate describing files and
formatting and printing intricate reports. Such notations to express algorithms are known as high
level, machine independent, programming languages. High level programming languages are
further classified as procedural and non-procedural. Languages which express step-by-step
algorithms written to solve a problem are known as procedural languages whereas those which
express specifications of a program to be solved are known as nonprocedural. We will first
discuss the common features of procedural languages.
Procedural Languages. Procedural languages have facilities to: i) specify data elements such
as real, integer, boolean, characters and data structures such as arrays, matrices, stacks,
records, sets, strings of characters, lists, trees, etc., ii) control structures to sequence operations
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 8 of 17
to be performed. An if then else structure is necessary to allow programs to follow different
sequences of statements based on testing a condition.
if ( a > b ) then
x=y+z;
p = q + t;
else
x=y–z;
p=q*t
endif
commands that the statements x = y + z and p = q + t are to be executed if ( a > b ) is
true. If ( a > b ) is false x = y – z and p = q ∗ t are executed.
iii. Repetition structures which carry out a group of statements again and again while a
condition is true as shown below
while (a > b ) do
x=y–z;
p=q*r
end while
iv. Statements to input and output data. Procedural languages are designed using a set of
syntax rules, which precisely specify the ‘words’ of the language, and how they may be
combined legally. The rules of syntax are specified using a notation called Backus–Naur Form
(BNF) which recursively defines various syntactic units of the language. These rules are similar
to the ones used by the great Sanskrit grammarian Panini. A sample BNF definition of a variable
name is
< variable name > : = < letter >
< variable name > : = < letter > < digit >
< variable name > : = < variable name > < variable name >
where < letter > is any upper case English letter A to Z and < digit > is any digit between 0 and
9. Observe the third line in the above definition, which is a recursive definition.
Besides rules of syntax each language has semantic rules. Each syntactically correct structure
should have one and only one semantic interpretation.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 9 of 17
Associated with each high level language is an elaborate computer program which
translates it into the machine language of the computer in which it is to be executed. There are
two types of translators. One of them takes each statement of the high level language,
translates it and immediately executes it. This is called an interpreter. Interpreters are easy to
write but the translated programs’ execution is slow. The other approach is to scan the whole
program and translate it into an equivalent machine language program. Such a translator is
called a compiler. A compiler is a complex program but the compiled machine code takes lesser
time to execute compared to an interpreted program.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 10 of 17
only when a large software project is undertaken – also known as ‘programming in the large’.
The methodology of OOP enables a programmer to remain close to the conceptual higher level
model of the real world problem. One of the earliest OOP languages to be developed was
Smalltalk. It, however, did not become popular. Currently an object oriented version of C known
as C++ is the most popular OOP language.
What’s New
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 11 of 17
What Is It
Another development, which has taken place in the last few years, is the internet
– an international network of a very large number of national computer networks. The
technology developed in creating the internet has been adapted for networking
computers within an organization. A computer network within an organization using
protocols and providing services similar to an internet is called an intranet. In both inter
and intranet small application programs (agents or objects to perform some services –
known as applets) may be developed at any one of the computers connected to the
network. One would like to create a new application by using these applets by either
importing them to one’s own computer or using them via the network. A language known
as JAVA, which is an object oriented language achieves this. This language achieves
machine independence by defining a JAVA virtual machine for which the compiler is
written. The JAVA code compiled for the virtual machine is then executed on any
machine by an interpreter which generates machine code from the compiled code. This
technique makes it easy to port JAVA language to any machine quickly (see Figure 2).
JAVA is getting wide acceptance now as a programming language to write applications
for a network of heterogeneous computers.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 12 of 17
Scripting Languages: Programming languages such as C and JAVA are also known as
system programming languages as they have been used to develop large systems. For
example C has been used to write the Unix operating system. System programming
languages are strongly typed, that is, each variable must be declared as a particular type
– real, integer, pointer etc. Typing is used both for easy readability and enabling more
efficient compilation and error detection. Another class of languages, which are gaining
wider acceptance is called scripting language. Scripting languages assume that a
collection of useful programs, each performing a task, already exists in other languages.
It has facilities to combine these components to perform a complex task. A scripting
language may be thus thought of as a gluing language, which glues together
components. One of the earliest scripting languages is Unix Shell. Unix shell filter
programs, read a stream of bytes from an input and write a stream of bytes on to an
output. Any two programs can be connected by attaching the output of one program to
the input of the other. The following shell commands stack three filters to count the
number of lines in the selection that contains the word ‘language’.
select | grep language | wc
The program select reads the given text that is currently on the display and prints the
text on its output; the grep program reads its input and prints as its output the lines
containing the word ‘language’; the wc program counts the number of lines on its input.
Each of these programs select, grep and wc are independent programs which could be
combined with other programs also in many ways. Another popular scripting language is
Visual Basic, which is used to develop Graphical User Interfaces (GUI) on the screen of
a Visual Display Unit. It is expected that with increasing complexity of applications it will
be more cost effective to glue together existing ‘program components’ using scripting
languages. In Table 1 we give a comparison of some of the languages.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 13 of 17
functional languages solve a problem by applying a set of functions to the initial variables in
specific ways to get the answer. The syntax of such languages is similar to
f n (fn–1 (fn–2 ..........f1 (data))......)
where f’s are the successive function applications which transform their arguments which, at the
start, is the initial data. LISP and ML are two languages in use which support this model. LISP
has been widely used to program artificial intelligence applications.
Problem Oriented Languages: Problem oriented languages are designed to solve a narrow
class of problems. A user of such a language need not express in detail the procedure used to
solve a problem. Readymade procedures are pre-programmed. The user merely presents the
data in a flexible ‘language’. MATLAB is a very popular language among scientists and
engineers to solve a wide class of problems in digital signal processing, control systems,
modelling systems described by differential equations, matrix computations etc. Another class of
problem oriented languages is for symbolic manipulation, for example, simplifying a complex
algebraic expression or getting the indefinite integral of a complex expression. MATHEMATICA
is a popular language of this type.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 14 of 17
What’s More
Activity 2:
Instruction: Take a research for the following programming languages and answer the
following. The first one is done for you. Write your answer on your yellow pad paper.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 15 of 17
Activity 3: Synthesizing Your Learning
Answer the following questions based on your learning. Be brief and concise. Write your
answer on your yellow pad paper.
1. What is the role of programming language?
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
2. “A computer will not work without a software/computer program” Explain this in your own
point.
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
What I Can Do
Activity 4
Instruction: Give a reason why you need to learn basic programming. Write your answer on
your yellow pad paper.
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
Summary
1. A program is a set of instructions written in a language (such as BASIC)
understandable by the computer to perform a particular function on the computer.
2. A computer programmer is computer scientist (a professional) skilled in using
constructs of programming languages to develop executable and acceptable
computer programs.
3. Programming languages are artificial notational languages created or
developed to be used in preparing coded instructions on the computer for later
execution by the computer.
4. In an assembly language, mnemonics are used to represent operations to be
performed by the computer and strings of characters to represent addresses of
locations in the computer’s memory where the operands will be stored.
5. A high-level programming language is a programming language with strong
abstraction from the details of the computer.
6. Procedural languages have facilities to: i) specify data elements such as real,
integer, boolean, characters and data structures such as arrays, matrices, stacks,
records, sets, strings of characters, lists, trees, etc., ii) control structures to sequence
operations to be performed.
7. Non-procedural functional languages solve a problem by applying a set of functions
to the initial variables in specific ways to get the answer.
8. Problem oriented languages are designed to solve a narrow class of problems.
11.
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 16 of 17
Assessment: (Post-Test)
Multiple Choice. Answer the question that follows. Choose the best answer from among the
given choices. Write your answer on your yellow pad paper.
1. Who is the first computer programmer?
A. Charles Babbage B. Egyptians
C. Lady Ada
D. Alexander Graham – Bell
2. In this programming language, mnemonics are used to represent operations to be
performed by the computer and strings of characters to represent addresses of
locations in the computer’s memory where the operands will be stored.
A. High – Level Language B. Procedural Language
C. Assembly Language D. Object – Oriented Language
3. This type of translator scan the whole program and translate it into an equivalent
machine language program.
A. Compiler B. Transistor
C. Interpreter D. Runner
9. This precisely specify the ‘words’ of the language, and how they may be combined legally.
A. Backus – Naur Form B. Logic Rules
C. Semantic Rules D. Syntax Rules
References
“Programming Languages”
http://repository.ias.ac.in/38341/1/12-PUB.pdf
©2020 Mind and Integrity College, Inc. All Rights Reserved Page 17 of 17