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

Week 7 Computer Programming Module

Uploaded by

arun siva
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
515 views

Week 7 Computer Programming Module

Uploaded by

arun siva
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

 

 
 
 
 
 
 

 
 
 
Introductory Message 
 
This  school-based  module  of  ​Leandro  V.  Locsin  Senior  High  School  is  produced 
through  the  efforts,  collaboration,  and  teamwork  of  LVLSHS  Faculty  Members,  Quality 
Assurance  Team,  and  under  the  supervision  of  the  school  principal,  Dr.  Merygee  L. 
Javier.  This  is  in  connection  to  the  ​LVLSHS’  U-WINN​,  an  innovation  or  school  project 
planned  and  organized  by  the  above-named  people.  This  D-WINN  ​project  which  means 
Upholding  Writing  Skills  through  Instructions  in  the  New  Normal  enhanced  and 
developed teachers’ writing or research skills which are necessary in academic writing.  
 
This  module  is  under  the  umbrella  of  the  school’s  ​Learning  Continuity  Plan  for  this 
school  year  2020-2021.  Also,  this  is  an  additional  learning  material  which  can  be  used 
by the students and teachers for a better teaching-learning process.  
 
Likewise,  this  module  has  been  designed  to  provide  simple yet meaningful and valuable 
activities  which  can  be  utilized  by  the  learners  even  at  their own pace. This assures the 
health and safety of educators and students in this time of the “New Normal”.  
 
The  lesson/s  in  this  module  is/are  aligned  with  the  Department  of  Education’s  Most 
Essential Learning Competencies (MELCS) crafted to streamline the K to 12 Curriculum.  
 
This  school-based  module  has  the  following  parts  with  the  corresponding  icons  and 
their descriptions: 
 
 
Icon  Part  Description 
  Topic  at  a  This  part  presents  the  specific  title  of  the 
  Glance  lesson,  module  number,  week  number,  and 
    the  focused  learning  competency  where  this 
  module abounds.   
  Pretest  This  part  presents  an  activity  which  helps  to 
identify  the  easy  and  difficult  areas  of  the 
lesson.  
 

1
Read  to  This  part  includes  the  brief  discussion  of  the 
Learn  lesson  and  the  specific  reading  material/s 
used  by  the  writer  as  a  springboard  of  the 
  lesson  and  the  learning  process  of  the 
competency involved.  
Key Points  This  part  presents  the  important  information 
or  key  concepts  which  the learners must know 
and comprehend in the lesson.  
 
Activity/ies  This  includes  preliminary  activity/ies  which 
  will  evaluate  students’  understanding  of  the 
  lesson.  
Enrichment  This  part  contains  additional  activity/ies 
Activity/ies  which  will  enrich  or  enhance  students’ 
knowledge of the lesson learned. 
 
  Assessment  This  part  is  a  summative  test  which  aims  to 
  evaluate  the  comprehension  level  of  the 
learners in achieving the learning competency. 
References  This  part  includes  a  list  of  learning  resources 
used  by  the  writer  in  accomplishing  or 
  developing this module.  
 
 
LVLSHS welcomes you! Happy learning. 
_______________________________________________________________________________ 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
MELC-Based Modified Module in ​Computer Programming​: 
An Additional Learning Material of LVLSHS  
SY:2020-2021 
Writer: ​Ma. Cecilia C. Siva   
 
 
Semester: 1 
Quarter: First 
Track/Strand: ​TVL/ICT/Computer Programming/(Specialized Subject) 
 
 
 
 
 
Topic​:​ ​Use Mathematical Concepts and Techniques   
Sub Topic​ : Apply Mathematical Procedure/Solution   
Module No​: 7   
Learning Competency (Learning Outcome): 
● Apply mathematical techniques based on the problem identified 
● Perform mathematical computations to the level of accuracy required for the 
problem  
● Determine results of mathematical computation and verify based on job 
requirements 
 
OBJECTIVES: 
At the end of the lesson, the students would be able to: 
1. Articulate on the use of Pseudocode in creating a standard algorithm. 
2. Formulate a pseudocode based on the given problem. 
3. Apply Mathematical techniques based on the problem identified   
 
 
 
 
 
 
 
Multiple Choice: Choose the letter of the correct answer that referred to the statements 
below.  
1. The aim of pseudocode is to make programming easier by using symbols. 
a. Yes 
b. No  
2. Is a way of expressing an algorithm without conforming to specific syntactic rules. 
a. Pseudocode  
b. Data Type 
c. Algorithm  
d. Flowchart 
3. It is a set of rules on how to use and organize statements in a programming language.  
a. Variable 
3
b. Syntax  
c. Language 
d. Code  
4. Before you write a piece of computer code, you should? 
a. Conform to specific syntax 
b. Create a variable 
c. Know what the program is suppose to do  
d. Describe an algorithm  
5. In writing basic pseudocode is not like writing an actual coding language. It cannot 
be compiled or run like a regular program. It can be written on?  
a. How you want 
b. Computer  
c. Peripheral input and output devices  
d. Accepted notations 
 
 
 
 
 
 
Technical Terms: 
Pseudocode​ – used to describe processes using natural language.  
Syntax  -  is the set of rules that defines the combinations of symbols that are considered 
to be a correctly structured document or fragment in that language. 
Task  -  is  a  basic  unit  of  programming  that  an operating system controls. Depending on 
how  the  operating  system  defines  a  task  in  its  design,  this unit of programming may be 
an entire program or each successive invocation of a program.  
Variable  - is a value that can change, depending on conditions or on information passed 
to the program. Typically, a program consists of instructions that tell the computer what 
to do and data that the program uses when it is running. 
 
 

 
 
 
Although  showing  learners  direct  translations  between  block-based  and 
text  based  languages  can  be  useful,  this  is  not  always  possible.  For 
instance,  most  block-based  languages  cannot  communicate  with  a 
computer’s  operating  system,  so  file  handling  isn’t  really  possible,  nor  are 
communication  between  one  computer and another, or access to peripheral 
input  and  output  devices.  Pseudocode  is  a  way  of  expressing  an  algorithm 
without conforming to specific syntactic rules. By learning to read and write 
pseudocode,  learners  can  more  easily  communicate  ideas  and  concepts  to 
4
other  programmers,  even  though  they  may  be  using  completely  different  languages. 
What’s  more,  algorithmic  solutions  to  many  problems  are  often  provided, meaning an 
ability  to  translate  between  pseudocode  and  a  given  programming  language  is  a 
valuable  skill.  There  is  no  such  thing  as  correct pseudocode, although there are a few 
generally  accepted  notations that are widely understood by programmers (e.g. x <-- 10 
to  create  a  variable  called  x  with  a value of 10), no matter which language they use. It 
always  leads  to  a  solution  and  tries  to  be  the  most  efficient solution we can think up. 
It's  often  a  good  idea to number the steps, but you don't have to. Instead of numbered 
steps,  some  folks  use  indentation  and  write  in  pseudocode,  which  is  a 
semi-programming  language  used to describe the steps in an algorithm. But, we won't 
use  that  here  since  simplicity  is  the  main  thing.  Before  you  write  one  piece  of 
computer  code,  you  have  to  know  what  the  program  is  supposed  to  do.  Before  you 
write  one  line  of  code  in  any language, it is a good idea to write it in a simple way first 
to  ensure  you  have  included  everything  you  need.  The  best  way  to  set  this  up  is  by 
using pseudocode. 
 
 
 
 
 
 
In  ​computer  science​,  ​pseudocode  is  a  ​plain  language  description  of  the  steps  in  an 
algorithm  or  another  system.  Pseudocode  often  uses  structural conventions of a normal 
programming  language​,  but  is  intended  for  human  reading  rather  than  machine 
reading.  It  typically  omits  details  that  are  essential  for  machine  understanding  of  the 
algorithm,  such  as  ​variable  declarations  and  language-specific  code.  The  programming 
language  is  ​augmented  with  ​natural  language  description  details,  where  convenient,  or 
with  compact  ​mathematical  notation​.  The  purpose  of  using  pseudocode  is  that  it  is 
easier for people to understand than conventional programming language code, and that 
it  is  an  efficient  and  environment-independent  description  of  the  key  principles  of  an 
algorithm.  
 
A  ​pseudocode  is  a  description  of  an  algorithm  or  a  computer  program  using  natural 
language.  Because  the  aim  of  pseudocode  is  to  make  reading  programs  easier,  some 
codes  that  are  not  essential  for  human  understanding  are  omitted.  This  language  is 
commonly  used  in  planning  out  structure  of  a  program  or  a  system,  like  the  blueprint 
for creating a house or a building 
 
A  pseudocode  is  a  simple  way  of  writing  programming  code  in  English.  Pseudocode  is 
not  an  actual  programming  language.  It  uses  short  phrases  to  write  code  for  programs 
before  you  actually  create  it  in  a  specific  language.  Once you know what the program is 
about  and  how  it  will  function,  then  you  can  use  pseudocode  to  create  statements  to 
achieve the required results for your program. 
 
  A  ​pseudocode  makes  creating  programs  easier.  Programs  can  be  complex  and  long; 
preparation  is  the  key.  It  is  challenging  to  find  a  mistake  without  understanding  the 
complete  flow  of  a  program.  That  is  where  pseudocode  becomes  more appealing. To use 
pseudocode, all you do is write what you want your program to say in English. 
 
Pseudocode  allows  you  to  translate  your  statements  into  any  language  because  there 
are  no  special  commands  and  it  is  not  standardized.  Writing  out  programs  before  you 
5
code  can  enable  you  to  better  organize  and  see  where  you  may  have  left  out  needed 
parts  in  your  programs.  All  you  have  to  do  is  write  it  out  in  your  own  words  in  short 
statements. Let's look at some examples. 
 
 
STEPS IN WRITING AN ALGORITHM IN PROGRAMMING 
• Determine the outcome of your code  
Answer:​ Know what is the specific problem you want to solve or 
the task you want to accomplish. What data/inputs are available? 
Where is that data located? What formulas are applicable to the 
issue at hand? What are the rules to working with the available 
data? How do the data values relate to each other?  
• Decide on a starting point  
Answer: ​Find your starting and ending point are crucial to listing 
the steps of the process. To determine a starting point, determine 
the answers to these questions: What data/inputs are available? Where is that data 
located? What formulas are applicable to the issue at hand? What are the rules to 
working with the available data? How do the data values relate to each other?  
• Find the ending point of the algorithm  
Answer:​ As with the starting point, you can find the end point of your algorithm by 
focusing on these questions: What facts will we learn from the process? What changes 
from the start to the end? What will be added or no longer exist?  
• List the steps from start to finish 
Answer:​ Start with broad steps. To use a real-world example, let's say your goal is to 
have lasagna for dinner. You've determined that the starting point is to find a recipe, 
and that the end result is that you'll have a lasagna fully cooked and ready to eat by 7 
PM. 
• Determine how you will accomplish each step 
Answer​: Now that you have a step-by-step outline, it's time to think about how you 
might code each step 
• Review the algorithm  
Answer​: Now that you've written your algorithm, it's time to evaluate the process. Your 
algorithm is designed to accomplish something specific, and you'll need it to start 
writing your program. 
• Determine how you will accomplish each step  
Answer​: Now that you have a step-by-step outline, it's time to think about how you 
might code each step.  
• Review the algorithm 
Answer​: Now that you've written your algorithm, it's time to evaluate the process. 
Your algorithm is designed to accomplish something specific, and you'll need it to start 
writing your program. 
 
 
 
 
1. Create a program to add 2 numbers together and then display the result. 
• Start Program 
• Enter two numbers, A, B  
• Add the numbers together 
• Print Sum  
• End Program  
 
6
2. Compute the area of a rectangle.  
• Get the length, l, and width, w  
• Compute the area = l*w  
• Display the area  
 
3. Compute the perimeter of a rectangle. 
• Enter length, l  
• Enter width, w  
• Compute Perimeter = 2*l + 2*w 
• Display Perimeter of a rectangle 
 
Remember,  writing  basic  pseudocode  is  not  like  writing  an  actual  coding  language.  It 
cannot  be  compiled  or  run  like  a  regular  program.  Pseudocode  can  be  written  how  you 
want.  But  some  companies  use  specific  pseudocode  syntax  to  keep  everyone  in  the 
company  on  the  same  page.  Syntax  is  a  set  of  rules  on  how  to  use  and  organize 
statements  in  a  programming  language.  By  adhering  to  specific  syntax,  everyone  in the 
company  can  read  and  understand  the  flow  of  a  program.  This  becomes  cost  effective 
and there is less time spent finding and correcting errors. 
 
 
 
 
 
Write your own pseudocode program to accomplish a simple task. 
 
Step 1: Choose a Task 
•  Choose  a  simple  task  to  accomplish  with  your  program.  You  want  this  to  be 
complex  enough  to  require  multiple  steps  while  still  being  relatively  simple  to 
accomplish. Some ideas are: 
❏ Walk across a room  
❏ Find the difference between two numbers  
❏ Determine if a number is even or odd 
Step 2: Write the Pseudocode  
• When writing the code, remember the four guidelines: 
❏ The language should be universal. o Limit each line to one task/action. 
❏ Capitalize all keywords (even if not at the beginning of a sentence). 
❏ Indent loops (like if/then statements) 
❏ Don't forget to start with 'Start Program' and end with 'End Program'. 
 
Step 3: Test Your Code  
•  After  you  have  written  your  pseudocode  program,  put  it  aside  for at least 1 day 
(more is better).  
❏ The  act  of  resting  the  ideas  you  have  written  will  help  you  to  edit  your 
work more accurately later. 
• When you are ready, try to follow your program exactly. 
❏ Did you accomplish the task? 
❏ If  you  were  not  successful  in  completing  the  task,  troubleshoot  your 
program  to  find  out  why.  You have likely left out a small step that seemed 
logical  to  you  as  you  were writing the code, but needed to be spelled out to 
get an accurate program.  
•  If  you  need  to  do  any  trouble  shooting,  wait  another  day  or  two  before  testing 
your code again.  
❏ Continue  to  test  until  you  successfully  include  all  steps  required  to 
7
complete your task.  
•  Alternatively,  you  can  ask  someone  to  attempt  to  complete  your  task  following 
your pseudocode precisely.  
❏ Troubleshoot as described above. 
 
Generalization 
Creating  a  pseudocode  for  a  program  makes  the task easier because it foresees 
processes  and  points  of  decision.  Pseudocodes  is  ideal  for  explaining  the  processes 
of the program to be created. 
 
 
  
 
 
 
Home Based Activity 1 
 
1. Write a pseudocode to convert the length in feet to centimeters. 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2.​Write pseudocode that will read the two sides of a rectangle and calculate its area.
 
 
 
 
 
 
 
 
 
 
 
 
 
 

8
 
 
Homed Based Activity 2 (Integration to General Mathematics) 
Direction: Make the pseudocode to convert this function :  
 
f(x) = 2x+3 to its inverse function. 
 
 
 
 
 
 
 
 
 

 
 
Home Based Activity 3  
Direction:  Write  your  understanding  about  the  following:  Why  do  you  think  a 
programmer must create a pseudocode? 
 
 
 
 
 
 
 
 

9
 
 
 
 
Multiple Choice: Choose the letter of the correct answer that referred to the statements 
below. 
1. The aim of pseudocode is to make programming easier by using symbols.  
A. Yes  
B. No  
2. Is a way of expressing an algorithm without conforming to specific syntactic rules.  
A. Pseudocode  
B. Data Type 
C. Algorithm 
D. Flowchart 
3. It is a set of rules on how to use and organize statements in a programming 
language.  
A. Variable  
B. Syntax 
C. Language 
D. Code  
4. Before you write a piece of computer code, you should?  
A. Conform to specific syntax 
B. Create a variable 
C. Know what the program is supposed to do  
D. Describe an algorithm  
5. In writing basic pseudocode is not like writing an actual coding language. It cannot 
be compiled or run like a regular program. It can be written on? 
A. How you want  
B. Computer  
C. Peripheral input and output devices  
D. Accepted notations.  
D. Determine how you will accomplish each step. 
 

 
 
10
 
 
Home Based Activity 1  
 
1. Pseudocode: ​Write a pseudocode to convert the length in feet to centimeters. 
● Input the length in feet (Lft) 
● Calculate the length in cm (Lcm) by multiplying Lft with 30  
● Print length in cm (Lcm) 
2. Pseudocode:​Write pseudocode that will read the two sides of a rectangle and calculate its
area.
• Input the width (W) and length (L) of a rectangle 
• Calculate the area (A) by multiplying L with W  
• Print A 
 
Home Based Activity 2  
 
Pseudocode:​Make the pseudocode to convert this function :  
f(x) = 2x+3 to its inverse function. 
● Input the value of f(x) 
● Solve for the value of f(y) 
● Print f​-1 ​(x)
 
Home Based Activity 3  
Why do you think a programmer must create a pseudocode?  
Answer:  The  aim  for  pseudocode  is  to make reading programs easier, some codes that 
are  not  essential  for  human  understanding  are  omitted.  With the help of pseudocode, 
one can easily understand it without having to know the technicalities. 
 
 
 
 
 
●  
 
 
● Programming Copyright @Vibal Group Inc. and Mapua Information and  
Technology Center. 
● APPLYING PROGRAMMING SKILLS IN A SECOND LANGUAGE 
-Division of City School - Manila by GIBSON J. OLAZO Master Teacher II 
Websites: 
https://www.slideshare.net/VarunGarg7/lect-1-introduction-to-programming- 
languages 
https://docs.google.com/document/d/12_tih68i7iTxELhbnusKEJmn--euvScO/edit 
 
 
11
 

12

You might also like