Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
104 views

ICT - JAVA1-Grade11 - IntroToProgrammingLanguage

Uploaded by

Randy Mercado
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views

ICT - JAVA1-Grade11 - IntroToProgrammingLanguage

Uploaded by

Randy Mercado
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Mind and Integrity College, Inc.

San Cristobal, Calamba City


In collaboration with
Department of Education
Region IV – CALABARZON

JAVA 1
Quarter 1 – Module 2:
Introduction to Programming Languages

SELF LEARNING MODULE


GRADE 11

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.

The school initiated the distribution of a Self-Learning Module (SLM) in order to


meet the essential learning competencies required to be learned by your child whether
your child opts for online, modular, or blended learning modality. The learning activities
in this SLM are arranged chronologically from simple to complex that will lead your child
to think critically, act skillfully, and reflect deeply on each lesson and to practice them
into real life settings. Most importantly, this SLM promotes self-paced learning as your
child can always review the least understood lessons as often as he/she pleases.

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,

Welcome to a brand-new year of learning!

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.

The following are the lessons contained in this module:


1. Introduction to Programming Languages

What I Need to Know

At the end of this module, you should be able to:

1. Be familiar with the different types of programming language

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

Icons of this Module


What I Need to This part contains learning objectives that are
Know set for you to learn as you go along the
module.

What I know This is an assessment as to your level of


knowledge to the subject matter at hand,
meant specifically to gauge prior relatedt
Knowledge
What’s In This part connects previous lesson with that of
the current one.

What’s New An introduction of the new lesson through


various activities, before it will be presented to
you

What is It These are discussions of the activities as a


way to deepen your discovery and under-
standing of the concept.

What’s More These are follow-up activities that are in-


tended for you to practice further in order to
master the competencies.

What I Have Activities designed to process what you


Learned have learned from the lesson

What I can do These are tasks that are designed to show-


case your skills and knowledge gained, and
applied into real-life concerns and situations.

Assessment This is a task which aims to evaluate your level


of mastery in achieving the learning competency

©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

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

4. Which of the following is not a programming language?


A. FORTRAN B. JAVA
C. C++ D. CSS

5. These are artificial notational languages created or developed to be used in


preparing coded instructions on the computer for later execution by the computer.
A. Programming Language B. Computer Program
C. Computer Programmer D. FORTRAN

6. Which of the following is the art of developing computer programs?


A. Programmer B. Designing
C. Computing D. Programming

7. What is the language which express step-by-step algorithms written to solve a


problem?
A. Procedural Language B. Non – Procedural Language
C. Assembly Language D. Machine Language

8. They are skilled to develop executable and acceptable computer programs.


A. Web Designer B. Data Analyst
C. Computer Programmer D. DB Administrator

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

10. The following are examples of High – Level Languages EXCEPT:


A. C# B. DOS
C. PHP D. RUBY

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 6 of 17
Lesson 1: Introduction to Programming Languages

What I Need to Know

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. A well written program could
be parcelled well to form an application package customized for solving specific type of problem
on the computer system.

A computer programmer is computer scientist (a professional) skilled in using


constructs of programming languages to develop executable and acceptable computer
programs. A software developer is a programmer. Programmers often work hand in hand with
system analysts on large projects.

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.
They are usually composed of series of usage rules (syntax) that determine the meaning
(semantics) of expressions written in the language. Each programming language comes handy
with its own translator i.e interpreter or compiler as the case may be.

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.

For example, the following statement:

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.

A Classification of Programming Languages

We give in Figure 1 a classification of programming languages. We have classified high


level machine independent languages into three groups, namely, procedural, non-procedural
and problem-oriented. Procedural languages have as their starting point an algorithm to solve
the problem. Languages such as FORTRAN, COBOL and C are purely algorithmic. These
languages provide a methodology to break up a large job into a number of tasks and
programming the tasks independently as functions or subroutines. These functions or
subroutines are then combined to form a program. The general idea is to simplify debugging a
program and to reuse the procedures in other programs which may need them. Over the years it
was realised that this was not sufficient to enable re-use of programs. Subroutines and functions
are too rigid. They require the specification of the type of data to be used a priori and the data to
be passed to them in a pre-specific order. As the cost of programming continually increased it
was realised that ‘building’ programs using a library of reusable ‘components’ was imperative.
This led to the emergence of the so-called object-oriented languages. In these languages the
concept of subroutine/functions is extended to that of an object. An object models a complex
real world or an abstract object. A real world object, for example, is a student whereas an
abstract object is a course taken by a student. In an object oriented (OOP) program an object is
modelled by a collection of data structures and a set of procedures that can be performed on
this data structure. A program consists of a collection of objects, each object providing a service
when it is invoked and all the objects co-operating to get the job done. Objects are invoked by
sending messages to them and objects return messages when the job is done. The action
performed in response to a message can vary depending on the data and type of parameters.
This is called polymorphism. Objects form class hierarchy with super class (parent) and
subclass (child) relationship. An object can use procedures and data defined on objects in its
superclass through inheritance. The advantages of object oriented programming (OOP) accrue

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

Figure 1. Classification of Programming Languages.

What’s New

Activity 1: Procedural Languages vs. Non – procedural Languages


Explain the difference between procedural and Non – procedural Language. Write your
answer on a yellow pad paper.

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

Figure 2. Illustrating portability of JAVA.

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

Table 1. Comparison of Languages

Non-procedural Languages: In procedural languages (also known as imperative languages)


each statement causes the values stored in one or more memory locations to change. Program
design consists of writing a sequence of statements, which transform the ‘state’ of the memory
from an initial state to a final state which is the solution to the problem. Non-procedural

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

Another non-procedural class of languages is called rule based languages or logic


programming languages. A logic program is expressed as a set of atomic sentences (known as
facts) and Horn clauses (if then rules). A query is then posed. Execution of the program now
begins and the system tries to find out if the answer to the query is true or false for the given
facts and rules. PROLOG is the best known language of this type.

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.

Table 2. Difference between Hardware and Software


Type of Language
(Machine/Assembly, Algorithmic,
Business - Oriented, Education - Invented
Language Invented By
Oriented, Scripting Language, Date
Document - Formatting Language,
Declarative, Object - Oriented)
ADA      
BASIC      
C      
C++      
C#      
DYNAMO      
EPL      
F#      
FORTRAN      
Google Apps Script      
High Level Assembly      
IDL      
JAVA      
Javascript      
Kaleidoscope      
Lisp      
MATLAB      
NewLISP      
Objective-C      
PASCAL      
QCL      
RUBY      
Swift (by Apple)      
TypeScript      
UNITY      
WebAssembly      
X++      
YQL      
ZPL      

What I Have Learned

©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

4. Which of the following is not a programming language?


A. FORTRAN B. JAVA
C. C++ D. CSS

5. These are artificial notational languages created or developed to be used in


preparing coded instructions on the computer for later execution by the computer.
A. Programming Language B. Computer Program
C. Computer Programmer D. FORTRAN

6. Which of the following is the art of developing computer programs?


A. Programmer B. Designing
C. Computing D. Programming

7. What is the language which express step-by-step algorithms written to solve a


problem?
A. Procedural Language B. Non – Procedural Language
C. Assembly Language D. Machine Language

8. They are skilled to develop executable and acceptable computer programs.


A. Web Designer B. Data Analyst
C. Computer Programmer D. DB Administrator

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

10. The following are examples of High – Level Languages EXCEPT:


A. C# B. DOS
C. PHP D. RUBY

References
“Programming Languages”
http://repository.ias.ac.in/38341/1/12-PUB.pdf

“Introduction to Programming (BASIC)”


https://www.researchgate.net/publication/317182495_INTRODUCTION_TO_COMPUTER_PRO
GRAMMING_BASIC

©2020 Mind and Integrity College, Inc. All Rights Reserved Page 17 of 17

You might also like