P1 explain the key features of procedural programs
Key features:
Procedures
Procedures in a program are the steps that the program goes through to complete the task. These
procedures can vary since every program might do different things such as calculation then returning
the value, doing a calculation and so on. The program will do the things that are programmed by the
programmer.
Functions
Functions are similar to procedures but they return a value. Functions are specific sections which are
self-contained modules which accomplish a specific set of tasks. Functions in general take the data,
process it and return the result, functions can be used many times in code as it is made to save time
and make code shorter. Functions can also be called from the inside of other functions.
Pre-defined functions
Pre-defined are specific commands in every programming language. They are already created and
ready to use in the wild. Such per defined function is print (), which will printout for example string,
variable and integer writing inside the brackets.
Local variables
Local variable can only be used in the place where it is placed. For example, user create a function
and in this function a variable is created, the variable can only be used in the function and not
outside and that is called local variable.
Global variables
Global variables are variables that can be used throughout the program code which is good for
programs that wants to use the same variable over and over throughout the program.
Parameter passing
Parameter passing is variable values to be passed through the program and then to the procedure.
Modularity
Modularity is how the program has different tasks that are grouped to complete the main tasks. In
every group, it has their own task to complete. Modularity are modules which are split into groups
to complete certain tasks one after another so it will a continuous system.
Programming libraries
Programming libraries have a collection od made up sources of class, codes, values and subroutines
which can be used by the programmer at any time in the program.
, Control structures:
A control structure is a block of programming that analyses variables and choses a direction that is
based on given parameters. The term flow control details the direction the program takes.
Fixed Loop
Fixed loop is a loop that tells the programmer how many times the loop needs to run for.
Example:
count = 0
for x in range (1,1010;
if x%2 ==0;
count = count + x
print(count)
Pre-check Loop
Pre-check loop is a loop that checks the program for any errors before carrying out the procedure
and executing the program to see if it will work.
Example:
x=6
while x>0;
print (“the x is”, x)
print (“that will never appear”)
Post Check Loop
Post check loop is a loop that test runs the program to make sure that it works before running the
actual program.
Break Points
These are temporary makers that tell the programmer to stop the program at a certain statement
and line.
Conditional commands
IF, ELSE, Boolean Operators and other conditional statements are used to tell whether the condition
is true or false.
An Example of IF Else statement:
x=0
if 5 in (1,2,3,4);
x = x+1
else if 4==2;
x =x+2
else if 7>4;
9x = x+4
print(x)
Key features:
Procedures
Procedures in a program are the steps that the program goes through to complete the task. These
procedures can vary since every program might do different things such as calculation then returning
the value, doing a calculation and so on. The program will do the things that are programmed by the
programmer.
Functions
Functions are similar to procedures but they return a value. Functions are specific sections which are
self-contained modules which accomplish a specific set of tasks. Functions in general take the data,
process it and return the result, functions can be used many times in code as it is made to save time
and make code shorter. Functions can also be called from the inside of other functions.
Pre-defined functions
Pre-defined are specific commands in every programming language. They are already created and
ready to use in the wild. Such per defined function is print (), which will printout for example string,
variable and integer writing inside the brackets.
Local variables
Local variable can only be used in the place where it is placed. For example, user create a function
and in this function a variable is created, the variable can only be used in the function and not
outside and that is called local variable.
Global variables
Global variables are variables that can be used throughout the program code which is good for
programs that wants to use the same variable over and over throughout the program.
Parameter passing
Parameter passing is variable values to be passed through the program and then to the procedure.
Modularity
Modularity is how the program has different tasks that are grouped to complete the main tasks. In
every group, it has their own task to complete. Modularity are modules which are split into groups
to complete certain tasks one after another so it will a continuous system.
Programming libraries
Programming libraries have a collection od made up sources of class, codes, values and subroutines
which can be used by the programmer at any time in the program.
, Control structures:
A control structure is a block of programming that analyses variables and choses a direction that is
based on given parameters. The term flow control details the direction the program takes.
Fixed Loop
Fixed loop is a loop that tells the programmer how many times the loop needs to run for.
Example:
count = 0
for x in range (1,1010;
if x%2 ==0;
count = count + x
print(count)
Pre-check Loop
Pre-check loop is a loop that checks the program for any errors before carrying out the procedure
and executing the program to see if it will work.
Example:
x=6
while x>0;
print (“the x is”, x)
print (“that will never appear”)
Post Check Loop
Post check loop is a loop that test runs the program to make sure that it works before running the
actual program.
Break Points
These are temporary makers that tell the programmer to stop the program at a certain statement
and line.
Conditional commands
IF, ELSE, Boolean Operators and other conditional statements are used to tell whether the condition
is true or false.
An Example of IF Else statement:
x=0
if 5 in (1,2,3,4);
x = x+1
else if 4==2;
x =x+2
else if 7>4;
9x = x+4
print(x)