Program
Program
12.1 Introduction
This unit specifies competencies required to develop computer program. It involves
Identifying program and programming concepts, identifying phases of program development,
perform program design and Analysis, develop a Computer program, Perform Program
testing and debugging, Perform User training and Program Maintenance.
These are the key learning outcomes, which make up workplace function:
s
ea
235
12.3.2 Learning Outcome 1: Identify program and programming concepts
A programming language is a set of commands, instructions, and other syntax use to create
ve
yt
a software program.
s
ea
Program structure The overall form of a program, with particular emphasis on the
individual components of the program and the interrelationships between these components.
Source: www.codeavail.com
Figure 89: Program structure
236
A declaration of a variable is where a program says that it needs a variable. For small
programs, place declaration statements between the two braces of the main method. The
declaration gives a name and a data type for the variable. It may also ask that a particular
value be placed in the variable.
Loops are control structures used to repeat a given section of code a certain number of times
or until a particular condition is met.
om
t.c
ve
yt
s
ea
Source: www.tutorialscampus.com
Figure 90: Loops
237
Source: https://www.bouraspage.com
Figure 91: Control structure
The syntax of a computer language 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.
"objects", which can contain data, in the form of fields (often known as attributes), and code,
t.c
A function is a block of organized, reusable code that is used to perform a single, related
action.
The waterfall model is a breakdown of project activities into linear sequential phases, where
each phase depends on the deliverables of the previous one and corresponds to a
specialization of tasks.
238
• Product
Requirements requirements
document
• Software
Design architecture
Implementation • Software
Verification
om
t.c
ve
syt
Maintainance
ea
Source: https://en.wikipedia.org/wiki/Waterfall_model
Figure 92: Waterfall model
Spiral Model is a combination of a waterfall model and iterative model. Each phase in spiral
model begins with a design goal and ends with the client reviewing the progress.
12.3.2.3 Self-Assessment
i. What is Agile software development model?
ii. What are the benefits of agile approach?
iii. What is waterfall approach?
239
iv. If you needed to execute some code repeatedly based on a certain condition, which of
the following would you use?
A. Variable
B. Compiler
C. Loop
D. Conditional
v. Before source code can be compiled, it has to be _______________
A. Saved in a separate file
B. Viewed in a command prompt
C. Capitalized
D. Parsed
vi. You need special software to write programs?
A. True
B. False
vii. What is object-oriented programming?
A. A type of programming involving a structured method of creating programs
B. A type of programming using only numbers
C. A type of programming not in use anymore
D. A type of programming involving data types representing data structures
om
12.3.2.5 References
• https://techterms.com/definition/programming_language
• https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-
features/control-flow/loop-structures
• https://www.tutorialspoint.com/computer_programming/computer_programming_functio
ns.htm
• Computer Programming: Learn It, Try It!, authored by Brad Edelman published by
Capstone Global Library Ltd., 2017
• Computer Programming and Computer Systems authored by Anthony Hassitt, Anthony
Ralston published by Academic Press, 2014
240
12.3.3 Learning Outcome 2: Identify phases of program development
with managers, stakeholders and users are held in order to determine the requirements like;
t.c
Who is going to use the system? How will they use the system? What data should be input
ve
yt
into the system? What data should be output by the system? These are general questions that
s
ea
get answered during a requirements gathering phase. After requirement gathering these
requirements are analyzed for their validity and the possibility of incorporating the
requirements in the system to be development is also studied.
Design: In this phase the system and software design is prepared from the requirement
specifications, which were studied, in the first phase. System Design helps in specifying
hardware and system requirements and also helps in defining overall system architecture. The
system design specifications serve as input for the next phase of the model.
Testing: After the code is developed it is tested against the requirements to make sure that
the product is actually solving the needs addressed and gathered during the requirements
phase. During this phase all types of functional testing like unit testing, integration testing,
system testing, acceptance testing are done as well as non-functional testing are also done.
Deployment: After successful testing the product is delivered / deployed to the customer for
their use.
241
Read: Phase of program development: https://www.linkedin.com/pulse/what-software-
development-life-cycle-sdlc-phases-private-limited
12.3.3.3 Self-Assessment
i. What are the phases of program development?
ii. Prepare a timeline based on the phases of development for a developing a website.
iii. Prepare a timeline based on the phases of development for a mobile application.
iv. Read about software development processes.
v. Risk analysis of a project is done in:
A. System Analysis Phase
B. Feasibility Study
C. Implementation phase
D. Maintenance phase
vi. Which is the first step in the software development life cycle?
A. Analysis
B. Design
C. Problem/Opportunity Identification
D. Development and Documentation
vii. Which tool is use for structured designing?
A. Program flowchart
om
B. Structure chart
t.c
C. Data-flow diagram
ve
yt
D. Module
s
ea
12.3.3.5 References
• https://www.linkedin.com/pulse/what-software-development-life-cycle-sdlc-phases-
private-limited
242
• Computer Programming and Computer Systems authored by Anthony Hassitt, Anthony
Ralston published by Academic Press, 2014
• Computer Programming: Learn It, Try It!, authored by Brad Edelman published by
Capstone Global Library Ltd., 2017
o Detailed design
yt
o Architectural design
s
ea
243
om
t.c
ve
syt
ea
Source: https://www.teach-ict.com
Figure 93: Data flow
A structure chart in software engineering and organizational theory is a chart, which shows
the breakdown of a system to its lowest manageable levels.
The architectural design is the highest abstract version of the system. It identifies the software
as a system with many components interacting with each other. At this level, the designers
get the idea of proposed solution domain.
244
The high-level design breaks the ‘single entity-multiple component’ concept of architectural
design into less-abstracted view of sub-systems and modules and depicts their interaction
with each other. High-level design focuses on how the system along with all of its
components can be implemented in forms of modules. It recognizes modular structure of
each sub-system and their relation and interaction among each other.
Detailed design deals with the implementation part of what is seen as a system and its sub-
systems in the previous two designs. It is more detailed towards modules and their
implementations. It defines logical structure of each module and their interfaces to
communicate with other modules.
12.3.4.3 Self-Assessment
i. What is HIPO diagram?
ii. Define high-level design.
iii. Differentiate between data-flow diagram and HIPO diagram?
iv. What is pseudocode?
v. Explain software design levels?
om
vi. Which of the following data structure is not linear data structure?
t.c
A. Arrays
ve
yt
B. Linked lists
s
ea
245
12.3.4.5 References
• https://www.teach-
ict.com/as_as_computing/ocr/H047/F451/312/slc_analysis/miniweb/pg4.htm
• https://www.tutorialspoint.com/software_engineering/software_design_basics.htm
• Computer Programming and Computer Systems, authored by Anthony Hassitt, Anthony
Ralston published by Academic Press, 2014
• Computer Programming: Learn It, Try It!, authored by Brad Edelman published by
Capstone Global Library Ltd, 2017
o Source code, Components of the program: Program header, declarations, main body
yt
A data structure is a specialized format for organizing and storing data. General data
structure types include the array, the file, the record, the table, the tree, and so on. Any data
structure is designed to organize data to suit a specific purpose so that it can be accessed and
worked with in appropriate ways.
246
C is called a structured programming language because to solve a large problem, C
programming language divides the problem into smaller modules called functions or
procedures each of which handles a particular responsibility.
A function is a group of statements that together perform a task. Every C program has at
least one function, which is main, and all the most trivial programs can define additional
functions.
You can divide up your code into separate functions. How you divide up your code among
different functions is up to you, but logically the division is such that each function performs
a specific task.
A function declaration tells the compiler about a function's name, return type, and
parameters. A function definition provides the actual body of the function.
The C standard library provides numerous built-in functions that your program can call. For
example, strcat() to concatenate two strings, memcpy() to copy one memory location to
another location, and many more functions.
Return Type: A function may return a value. The return_type is the data type of the value
the function returns. Some functions perform the desired operations without returning a
value. In this case, the return_type is the keyword void.
Function Name: This is the actual name of the function. The function name and the
parameter list together constitute the function signature.
Parameters: A parameter is like a placeholder. When a function is invoked, you pass a value
to the parameter. This value is referred to as actual parameter or argument. The parameter list
refers to the type, order, and number of the parameters of a function. Parameters are optional;
that is, a function may contain no parameters.
Function Body: The function body contains a collection of statements that define what the
function does.
A function declaration tells the compiler about a function name and how to call the
function. The actual body of the function can be defined separately.
247
You may encounter situations, when a block of code needs to be executed several number of
times. In general, statements are executed sequentially: The first statement in a function is
executed first, followed by the second, and so on.
Programming languages provide various control structures that allow for more complicated
execution paths.
om
t.c
ve
yt
s
ea
Source: www.tutorialspoint.com
Figure 94: Loop statement
o While loop: Repeats a statement or group of statements while a given condition is true. It
tests the condition before executing the loop body.
o For loop: Executes a sequence of statements multiple times and abbreviates the code that
manages the loop variable.
o Do...while loop: It is more like a while statement, except that it tests the condition at the
end of the loop body.
o Nested loops: You can use one or more loops inside any other while, for, or do..while
loop.
A loop becomes an infinite loop if a condition never becomes false. The ‘for’ loop is
traditionally used for this purpose. Since none of the three expressions that form the 'for' loop
are required, you can make an endless loop by leaving the conditional expression empty.
248
#include <stdio.h>
int main () {
for( ; ; ) {
return 0;
When the conditional expression is absent, it is assumed to be true. You may have an
initialization and increment expression, but C programmers more commonly use the for(;;)
construct to signify an infinite loop.
12.3.5.3 Self-Assessment
i. Explain the syntax for loop.
ii. Can a program be compiled without main() function?
iii. What is the advantage of declaring void pointers?
iv. What are command line arguments?
v. What is a variable?
om
t.c
#include<stdio.h>
ea
int x = 1;
switch(x)
default: printf("Hello");
}}
A. Hello
B. Hi
C. HelloHi
D. Compile error
vii. What is JV? Why is Java called the “Platform Independent Programming Language”?
viii. What are the features in JAVA?
ix. What is a class and give an example of class?
249
x. If, a moderately active person cuts their calorie intake by 500 calories a day, they can
typically lose about 4 pounds a month.
Write a Java and C program that lets the user enter their starting weight, then creates
and displays a table showing what their expected weight will be at the end of each
month for the next six month If they stay in this diet.
xi. Write a Java program that will calculate total of calories for every food classes
(protein, carbohydrate and fat) and then total up the calories of all the food classes.
The number of calories per gram of carbohydrate, fat and protein are 4, 7 and 9. The
program will allow user to enter the number of grams for every food class.
xii. Write a C program to compute the sum of the two given integer values. If the two
values are the same, then return triple their sum.
xiii. Which is a mechanism where one object acquires all the properties and behaviors of
the parent object?
A. Inheritance
B. Encapsulation
C. Polymorphism
D. None of the above
xiv. Java Virtual Machine is platform independent.
A. True
B. False
om
A. Bjarne Stroustrup
ve
yt
B. James A. Gosling
s
ea
C. Dennis Ritchie
D. Dr. E.F. Codd
12.3.5.5 References
• https://www.thoughtco.com/source-code-definition-958200
• http://www.vssut.ac.in/lecture_notes/lecture1424354156.pdf
• https://dzone.com/articles/15-tools-make-life-easy-java
• https://www.programiz.com/java-programming/basic-input-output
• https://www.tutorialspoint.com/cprogramming/c_functions.htm
• Java Programming 24-Hour Trainer (1st edition) authored by Yakov Fain published by
Wrox; 2011
• Computer Programming and Computer Systems authored by Anthony Hassitt, Anthony
Ralston published by Academic Press, 2014
• Computer Programming: Learn It, Try It!, authored by Brad Edelman published by
Capstone Global Library Ltd., 2017
250
12.3.6 Learning Outcome 5: Perform Program testing and debugging
Testing: Fundamentally, testing is a process to check if the system is working same as it was
s
ea
supposed to do, and not working, as it was not supposed to do. It is done by the tester to
identify the defects in the system (actual result of test case execution is not matching with
expected result).
Debugging is the activity performed by developers to fix the bug found in the system. This is
manual step-by-step unstructured and unreliable process to find and removes a specific bug
from the system.
251
om
t.c
ve
Source: https://dzone.com/articles/the-differences-between-testing-and-debugging
yt
Smoke Testing: Whenever a new build is provided by the development team then the
software testing team validates the build and ensures that no major issue exists.
Functional Testing: This type of testing ignores the internal parts and focuses only on the
output to check if it is as per the requirement or not. It is a Black-box type testing geared to
the functional requirements of an application.
Security Testing: It is a type of testing performed by a special team of testers. A system can
be penetrated by any hacking way.
Performance Testing is done to check whether the system meets the performance
requirements. Different performance and load tools are used to do this testing.
252
Read: Software testing: https://www.softwaretestinghelp.com/types-of-software-testing/
Unit testing is a smallest testable portion of system or application, which can be compiled,
liked, loaded, and executed. This kind of testing helps to test each module separately.
Source: guru99.com
Figure 96: Flow of unit testing
om
structure/design/implementation of the item being tested is not known to the tester. These
tests can be functional or non-functional, though usually functional. Test design techniques
include Equivalence partitioning, Boundary Value Analysis, Cause-Effect Graphing.
White Box Testing: a software testing method in which the tester knows the internal
structure/design/implementation of the item being tested. Test design techniques include
Control flow testing, Data flow testing, Branch testing, Path testing.
Gray Box Testing: A software testing method which is a combination of Black Box Testing
method and White Box Testing method.
Agile Testing: A method of software testing that follows the principles of agile software
development.
Ad Hoc Testing: A method of software testing without any planning and documentation.
253
12.3.6.3 Self-Assessment
i. What is Functional Testing?
ii. Describe level of software testing?
iii. What is the difference between testing and debugging?
iv. Some incorrect word sequence in a program would generate
A. Semantics error
B. Syntax error
C. Runtime error
D. Logical error
v. Examination of the program step by step is called ______________
A. Controlling
B. Tracing
C. Stepping
D. Testing
vi. The examination of changing values of variables is called stepping.
A. True
B. False
vii. ____________ creates an inferior process that runs your program.
A. run
B. exit
om
C. execute
t.c
D. e
ve
yt
s
ea
12.3.6.5 References
• http://www.softwaretestingclass.com/difference-between-testing-and-debugging/
• https://www.guru99.com/levels-of-testing.html
• http://softwaretestingfundamentals.com/software-testing-methods/
• Computer Programming and Computer Systems authored by Anthony Hassitt, Anthony
Ralston published by Academic Press, 2014
• Computer Programming: Learn It, Try It!, authored by Brad Edelman published by
Capstone Global Library Ltd., 2017
254
12.3.7 Learning Outcome 6: Perform User training and Program Maintenance
https://www.hr.com/en/communities/training_and_development/list-of-training-
methods_eacwezdm.html
255
o Virus prevention and detection
12.3.7.3 Self-Assessment
i. What is software maintenance?
ii. Maintenance consist of the following action(s)
A. Replace of component
B. Repair of component
C. Service of component
D. All of the above
iii. Software Maintenance includes
A. Error corrections
B. Enhancements of capabilities
C. Deletion of obsolete capabilities
D. All of the mentioned
om
iv. The modification of the software to match changes in the ever changing environment,
t.c
A. Corrective
s
ea
B. Adaptive
C. Perfective
D. Preventive
v. ______________ measures the ability of a regression test selection technique to
handle realistic applications.
A. Efficiency
B. Precision
C. Generality
D. Inclusiveness
12.3.7.5 References
• https://www.researchgate.net/figure/Maintenance-tools-and-techniques_tbl1_227131529
• http://ecomputernotes.com/software-engineering/tools-for-software-maintenance
• https://www.hr.com/en/communities/training_and_development/list-of-training-
methods_eacwezdm.html
• https://www.researchgate.net/figure/Maintenance-tools-and-techniques_tbl1_227131529
256
• Computer Programming and Computer Systems authored by Anthony Hassitt, Anthony
Ralston published by Academic Press, 2014
• Computer Programming: Learn It, Try It!, authored by Brad Edelman published by
Capstone Global Library Ltd., 2017
om
t.c
ve
yt
s
ea
257