96
COMPETENCY BASED LEARNING MATERIAL Sector: ICT Qualification: Computer Programming NC IV Unit of Competency: APPLY PROGRAMMING SKILLS IN A SECOND LANGUAGE ICT313331 Computer Systems Institute Date Developed: February 15, 2012 Document No. Issued by: Page: 1 Developed by: Jeffrey A. Esmundo Revision # ____ 1 Computer Systems Institute F. Imperial St. Kapantawan, Legazpi City

CBLM Appy Programming in a Second Language

Embed Size (px)

Citation preview

Page 1: CBLM Appy Programming in a Second Language

COMPETENCY BASED LEARNING MATERIAL

Sector:ICT

Qualification:Computer Programming NC IV

Unit of Competency:APPLY PROGRAMMING SKILLS IN A SECOND LANGUAGE

Module Title:APPLYING PROGRAMMING SKILLS IN A SECOND LANGUAGE

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

1Developed by:Jeffrey A. Esmundo Revision # ____

1

Computer Systems Institute

F. Imperial St. Kapantawan, Legazpi City

Page 2: CBLM Appy Programming in a Second Language

COMPUTER SYSTEMS INSTITUTECSI-Legazpi

F. Imperial St., Kapantawan, Legazpi City Tel. No. (052) 481-1534

E-Mail: [email protected] Website: www.csileg.com

How to use this Competency-Based Learning Material

Welcome to the APPLY PROGRAMMING SKILLS IN A SECOND LANGUAGE. This module contains training materials and activities for you to complete.

The unit of competency "APPLY PROGRAMMING SKILLS IN A SECOND LANGUAGE" contains the knowledge, skills and attitudes required for a Computer Programming. It is one of the core competencies at National Certificate IV (NC IV) level.

You are required to go through a series of learning activities in order to complete each learning outcomes of the module. In each learning outcome there are Information Sheets and Resource Sheets (Reference Materials for further reading to help you better understand the required activities. Follow these activities on your own and answer the self-check at the end of each learning outcome. You may remove a blank answer sheet at the end of each module (or get one from your facilitator/trainer) to write your answers for each self-check. If you have questions, don’t hesitate to ask your facilitator for assistance.

Recognition of Prior Learning (RPL)

You may already have some or most of the knowledge and skills covered in this learner's guide because you have:

been working for some time already completed training in this area.

If you can demonstrate to your trainer that you are competent in a particular outcome, you don't have to do the same training again.

Talk to your trainer about having them formally recognized. If you have a qualification or Certificate of Competence from previous training, show it to you r trainer. If the skills you acquired are still current and relevant to the unit/s of competency they may become part of the evidence you can present for RPL. If you are not sure about the currency of your skills, discuss this with your trainer.

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

2Developed by:Jeffrey A. Esmundo Revision # ____

2

Page 3: CBLM Appy Programming in a Second Language

After completing this module ask your trainer to assess your competency. Result of your assessment will be recorded in your competency profile. All the learning activities are designed for you to complete at your own pace.

Inside this learner's guide you will find the activities for you to complete and at the back are the relevant information sheets for each learning outcome. Each learning outcome may have more than one learning activities.

At the back of this learner's guide is a Learner Diary. Use this diary to record important dates, jobs undertaken and other workplace events that will assist you in providing further details to your trainer or an assessor. A Record of Achievement is also provided for your trainer to complete once you complete the module.

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

3Developed by:Jeffrey A. Esmundo Revision # ____

3

Page 4: CBLM Appy Programming in a Second Language

MODULE CONTENT

Unit of Competency Apply Programming Skills in a Second Language

Module Applying Programming Skills in a Second Language

MODULE DESCRIPTOR:

Computer programming is a field that has to do with the analytical creation of source code that can be used to configure computer systems. Computer programmers may choose to function in a broad range of programming functions, or specialize in some aspect of development, support, or maintenance of computers for the home or workplace. Programmers provide the basis for the creation and ongoing function of the systems that many people rely upon for all sorts of information exchange, both business related and for entertainment purposes.

The computer programmer often focuses on the development of software that allows people to perform a broad range of functions. All online functions that are utilized in the home and office owe their origins to a programmer or group of programmers. Computer operating systems, office suites, word processing programs, and even Internet dialing software all exist because of the work of programmers.

In this course you will learn how to form a simple C program and expose to C language step by step. Additionally, you will learn more about the “fundamentals of C language”.

NOMINAL DURATION: 42 Hours

LEARNING OUTCOMES

Upon completion of this module you must be able to:

Apply basic language syntax and layout. Code using standard algorithms

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

4Developed by:Jeffrey A. Esmundo Revision # ____

4

Page 5: CBLM Appy Programming in a Second Language

Debug code Document Activities Test Code

LEARNING OUTCOME #1: SELECT THE PROGRAM LOGIC DESIGN APPROACH

CONTENTS:

1. Semantics and Syntax2. Elements of Programming3. Program Control Structure

ASSESSMENT CRITERIA

1. Observed basic language syntax rules and best practice based on the standard of specific programming language.

2. Used language data types, operators and expressions based on the standard of specific programming language.

3. Used appropriate language syntax for sequence, selection and iteration constructs based on the standard of specific programming language.

CONDITION:

Trainee must be provided with the following:

1.Workplace2.Equipment

Computer set with Dev C++ compiler installed3.Learning materials

ASSESSMENT METHOD:

1.Written test2.Practical test3.Oral questioning

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

5Developed by:Jeffrey A. Esmundo Revision # ____

5

Page 6: CBLM Appy Programming in a Second Language

Learning Experiences

Learning Outcome 1

APPLY PROGRAMMING SKILLS IN A SECOND LANGUAGELearning Activities Special Instructions

1. Read Semantics and Syntax (1.1-1) Perform all activities required by the module2. Answer Self-Check for 1.1-1 Compare answers with the answer key.

You are required to get all answers correct. If not, read the information sheets again to answer all questions correctly.

3. Read Elements of programming (1.1-2) Answer Self-Check 1.1-2 & perform Job Sheet 1.1-2a, Job Sheet 1.1-2b, Job Sheet 1.1-2c, and Job Sheet 1.1-2d after reading Information Sheet 1.1-2

4. Answer Self-Check for 1.1-2 Compare answers with the answer key. You are required to get all answers correct. If not, read the information sheets again to answer all questions correctly.

5. Perform Job Sheet 1.1-2a Approach the trainer to check the work done

6. Perform Job Sheet 1.1-2b Approach the trainer to check the work done

7. Perform Job Sheet 1.1-2c Approach the trainer to check the work done

8. Perform Job Sheet 1.1-2d Approach the trainer to check the work done

9. Read Elements of programming (1.1-3) Answer Self-Check 1.1-3 & perform Job Sheet 1.1-3a, Job Sheet 1.1-3b, Job Sheet 1.1-3c, and Job Sheet 1.1-3d after reading Information Sheet 1.1-3

10. Answer Self-Check for 1.1-3 Compare answers with the answer key. You are required to get all answers correct. If not, read the information sheets again to answer all questions correctly.

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

6Developed by:Jeffrey A. Esmundo Revision # ____

6

Page 7: CBLM Appy Programming in a Second Language

11. Perform Job Sheet 1.1-3a Approach the trainer to check the work done

12. Perform Job Sheet 1.1-3a Approach the trainer to check the work done

13. Perform Job Sheet 1.1-3c Approach the trainer to check the work done

14. Perform Job Sheet 1.1-3d Approach the trainer to check the work done

INFORMATION SHEET 1.1-1“Semantic and Syntax”

Learning Objective:

After reading this INFORMATION SHEET, YOU MUST be able to identify and understand C Language, its origin, and the skeleton of a C Program.

Please refer to Semantic and Syntax.

Semantic and Syntax

What is C Language?

C is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.

Although C was designed for implementing system software, it is also widely used for developing portable application software.

C is one of the most popular programming languages and there are very few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++, which began as an extension to C.

History of C

The milestones in C's development as a language are listed below:

UNIX developed c. 1969 -- DEC PDP-7 Assembly Language

BCPL -- a user friendly OS providing powerful development tools developed from BCPL. Assembler tedious long and error prone.

A new language ``B'' a second attempt. c. 1970.

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

7Developed by:Jeffrey A. Esmundo Revision # ____

7

Page 8: CBLM Appy Programming in a Second Language

A totally new language ``C'' a successor to ``B''. c. 1971

By 1973 UNIX OS almost totally written in ``C''.

Characteristics of C

The following are the C’s characteristics that define the language and also have lead to its popularity as a programming language.

Small size

Extensive use of function calls

Loose typing -- unlike PASCAL

Structured language

Low level (BitWise) programming readily available

Pointer implementation - extensive use of pointers for memory, array, structures and functions.

C has now become a widely used professional language for various reasons.

It has high-level constructs.

It can handle low-level activities.

It produces efficient programs.

It can be compiled on a variety of computers.

A program skeleton may be utilized as a template that reflects syntax and structures commonly used in a wide class of problems.

Header File DeclarationConstant Variable DeclarationFunction PrototypeGlobal Variable Declaration and link listmain(){ Local variable declaration Statement/body }Functions…

Header File

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

8Developed by:Jeffrey A. Esmundo Revision # ____

8

Page 9: CBLM Appy Programming in a Second Language

Declaration is used to announce the existence of the element to the compiler; this is important in many strongly-typed languages (such as C) that require variables and their types to be specified with a declaration before use.

The C programming language uses libraries as its primary method of extension. In C, a library is a set of functions contained within a single "archive" file. Each library typically has a header file, which contains the prototypes of the functions contained within the library that may be used by a program, and declarations of special data types and macro symbols used with these functions. In order for a program to use a library, it must include the library's header file, and the library must be linked with the program, which in many cases requires compiler flags (e.g., -lm, shorthand for "math library").

Some programming languages (most notably C, C++, and Objective-C) use header files. These files allow programmers to separate certain elements of a program's source code into reusable files. Header files commonly contain forward declarations of classes, subroutines, variables, and other identifiers. Programmers who wish to declare standardized identifiers in more than one source file can place such identifiers in a single header file, which other code can then include whenever the header contents are required. This is to keep the interface in the header separate from the implementation. The C standard library and C++ standard library traditionally declare their standard functions in header files.

Ex.

#include<stdio.h>#include<conio.h>#include<iostrem.h>

Constant Variable

A constant variable is an identifier whose associated value cannot typically be altered by the program during its execution (though in some cases this can be circumvented, e.g. using self-modifying code). Many programming languages make an explicit syntactic distinction between constant and variable symbols.

Although a constant's value is specified only once, a constant may be referenced many times in a program. Using a constant instead of specifying a value multiple times in the program can not only simplify code maintenance, but it can also supply a meaningful name for it and consolidate such constant bindings to a standard code location (for example, at the beginning).

Ex.

#define PI 3.1416

#define zero 0

#define one 1

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

9Developed by:Jeffrey A. Esmundo Revision # ____

9

Page 10: CBLM Appy Programming in a Second Language

Function

A function (also called procedure, subroutine, routine, method, or subprogram) is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code.

Function Prototype is a declaration of a function that omits the function body but does specify the function's name, arity, argument types and return type. While a function definition specifies what a function does, a function prototype can be thought of as specifying its interface.

Ex.

int fac(int no);

void sam(int x);

Global Variable

A global variable is a variable that is accessible in every scope (unless shadowed). Interaction mechanisms with global variables are called global environment (see also global state) mechanisms. The global environment paradigm is contrasted with the local environment paradigm, where all variables are local with no shared memory (and therefore all interactions can be reconducted to message passing).

They are usually considered bad practice precisely because of their non-locality: a global variable can potentially be modified from anywhere (unless they reside in protected memory or are otherwise rendered read-only), and any part of the program may depend on it.[1] A global variable therefore has an unlimited potential for creating mutual dependencies, and adding mutual dependencies increases complexity. See action at a distance. However, in a few cases, global variables can be suitable for use. For example, they can be used to avoid having to pass frequently-used variables continuously throughout several functions.

Global variables are used extensively to pass information between sections of code that do not share a caller/callee relation like concurrent threads and signal handlers. Languages (including C) where each file defines an implicit namespace eliminate most of the problems seen with languages with a global namespace though some problems may persist without proper encapsulation. Without proper locking (such as with a mutex), code using global variables will not be thread-safe except for read only values in protected memory.

Ex.

struct account {

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

10Developed by:Jeffrey A. Esmundo Revision # ____

10

Page 11: CBLM Appy Programming in a Second Language

int account_number; char *first_name; char *last_name; float balance;};

main() Function

The main function is where a program starts execution. It is responsible for the high-level organization of the program's functionality, and typically has access to the command arguments given to the program when it was executed.

Ex. Int main(){ void main(){ Statement; or Statement; } }

Local Variable

A local variable is a variable that is given local scope. Such a variable is accessible only from the function or block in which it is declared. In programming languages with only two levels of visibility, local variables are contrasted with global variables, on the other hand, many ALGOL-derived languages allow any number of levels of nested functions with private variables, functions, constants and types hidden within them.

In most languages, local variables are automatic variables stored on the call stack directly. This means that when a recursive function calls itself, local variables in each instance of the function are given separate memory address space. Hence variables of this scope can be declared, written to, and read, without any risk of side-effects to processes outside of the block in which they are declared.

Ex. Int x; Char y; Float z;

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

11Developed by:Jeffrey A. Esmundo Revision # ____

11

Page 12: CBLM Appy Programming in a Second Language

Self-Check 1.1-1

Instruction: Write the letter of the correct answer on your answer sheet.

1. A ____________ may be utilized as a template that reflects syntax and structures

commonly used in a wide class of problems.

a. Variable b. Programming c. Program skeleton d. Program

2. In C, a _____ is a set of functions contained within a single "archive" file.

a. Variable b. function prototype c. Library d. file header

3. _____________ is a portion of code within a larger program that performs a

specific task and is relatively independent of the remaining code.

a. File Header b. Function c. Variable d. Statement

4. ___________ is a variable which is accessible only from the function or block in

which it is declared.

a. local variable b. global variable c. header d. function

5. The _________ is where a program starts the execution.

a. function b. local variable c. global variable d. main function

6. ___________ is a variable that is accessible in every scope.

a. local variable b. library c. global variable d. constant variable

7. A ____________ is an identifier whose associated value cannot typically be

altered by the program during its execution.

a. global variable b. constant variable c. local variable d. function

8. __________ is an example of a basic file header that can be used in most of C

Language compilers.

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

12Developed by:Jeffrey A. Esmundo Revision # ____

12

Page 13: CBLM Appy Programming in a Second Language

a. #include<stdio.h> b.#includeme<stdnio.s> c. #include<stxvt.a>

9. Header files commonly contain forward declarations of ____________.

a. classes b. variables c. subroutines d. identifiers e. all a to d

10. __________ is a declaration of a function that omits the function body but does

specify the function's name, arity, argument types and return type.

a. function b. function prototype c. header file d. variable

Answer Key

Self-Check 1.1-1

1. D

2. C

3. B

4. A

5. D

6. C

7. B

8. A

9. E

10.B

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

13Developed by:Jeffrey A. Esmundo Revision # ____

13

Page 14: CBLM Appy Programming in a Second Language

INFORMATION SHEET 1.1-2“Elements of Programming”

Learning Objective:

After reading this information sheet the trainee must identify, understand and apply all basic elements of programming.

Basic elements of programming:

Variables: These will how data is represented. It can range from something very simple, such as the age of a person, to something very complex, such as a record of university students holding their names, ages, addresses, what courses they have taken, and the marks obtained.

Loops: This will allow us to carry out execution of a group of commands a certain number of times.

Conditionals: This will specify execution of a group of statements depending on whether or not some condition is satisfied.

Input/Output: This will allow interaction of the program with external entities. This might be as simple as printing something out to the terminal screen, or capturing some text the user types on the keyboard, or it can involve reading and/or writing to files.

Operators: Programming languages typically support a set of operators: operations which differ from the language's functions in calling syntax and/or argument passing mode. Common examples that differ by syntax are mathematical arithmetic operations, e.g. ">" for "greater than", with names often outside the language's set of identifiers for functions, and called with a syntax different from the language's syntax for calling functions. Common examples that differ by argument passing mode are boolean operations, e.g. a short-circuiting

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

14Developed by:Jeffrey A. Esmundo Revision # ____

14

Page 15: CBLM Appy Programming in a Second Language

conjunction that only evaluates later arguments if earlier ones are not false, in a language with strict call-by-value functions.

Subroutines and functions: This will allow you to put oft-used snippets of code into one location which can then be used over and over again.

Variables represent some segment of memory location in computer. Different values placed in the storage depend on the value type. Variable should be declared prior to storage of any values.

To write a program, we must select names for variables or identifiers to store data and to give name in a high-level language. It must satisfy the following rules:

It must start with letters A-Z or a-z or an underscore character It must consist of only letters A-Z or a-z, digits 0-9 and underscore character It must not be a keyword C is case-sensitive, i.e. Value and value are not the same Must begin with non-digit character, i.e. 2nd chance is invalid

Reserved words:

auto double int structbreak else long switchcase enum register typedefchar extern return unionconst float short unsignedcontinue for signed voiddefault goto sizeof volatiledo if static while

2 values in C

1. Numeric value – these are the number values2. Character Value – consists of a letter or any other character surrounded by

single quote.

Data type is some reserved words used to specify a value. Different storage space would be allocated depends on data type.

Integral Data Type

Integral data types allow only integral or whole numbers with no decimal points. Integral data type can be signed or unsigned. The signed integral data type means that

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

15Developed by:Jeffrey A. Esmundo Revision # ____

15

Page 16: CBLM Appy Programming in a Second Language

the value may be either positive or negative. Generally, we do not need to specify whether a variable is signed because that is the default. The unsigned data type means the number may only be positive.

Integral data type may also be either short or long, whereby it tells the computer the size of the integral number. In most of the cases, short is 16bits and long is 32bits.

Floating-point Data Type

Real numbers, those numbers with decimal points, are stored a floating-point data types. For floating-point values, the computer stores mantissa and the exponent. The memory space allocated to the number is fixed, depending on the data type we declare, and is divided between mantissa and exponent.

There are three different floating-point data types: float, double, and long double. These data types are differ from each other in terms of the size. Generally, a float is 32bits, a double is 64bits, and a long double is 80bits. Unlike integral data-types, floating-point data types always allow positive or negative values, and so cannot have signed or unsigned.

Basic Data Types in C:

1. Integer – int2. Floating-point – float3. Character – char

Declaration – is the process of reserving memory allocation on your computer.

Declaration

Whenever we use a value or a variable, we will declare it and its data type. Variables must be explicitly declared before they are used. Each declaration statement in C must end with a semicolon. There are various way of declaring a variables, and the following are some examples:

Syntax:

Data_type Variable_name;

Examples:

int number;int NetPay;float real;float Rno;

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

16Developed by:Jeffrey A. Esmundo Revision # ____

16

Page 17: CBLM Appy Programming in a Second Language

char letter;

Arithmetic Expression

In c arithmetic expression is anything that can be simplified into a single value, such as formulas. An arithmetic expression consists of values and or variables connected by arithmetic operators, which tell the computer how to combine the values.

Arithmetic Operators in precedence

Level Type Associativity Operator Symbol ExampleI Unary Right to left Negate - -14

Plus + +4II Multiplicative Left to right Multiply * 3*3

Divide / 10/5Remainder % 4%2

III Additive Left to right Add + 2+3Subtract - 10-9

IV Assignment Right to left Equals = A=10

Integer Arithmetic

C performs its arithmetic to the data-types on which it is currently operating. If the data-types in a particular operation are integer then the result will also be integer. When dividing an integer the result will be an integer – a truncated version of what a floating-point division would yield. The result of expression 3/2 is 1. Not 1.5. Since both 3 and 2 are integers, an integer calculation will be done, producing an integer result. There is not a round-off but a truncation; the result is not 2 but 1.

The remainder (or modulus) operator - % symbol, is valid only with positive integers. The result of is the remainder after dividing the value before the operator by the value after the operator. The result of an expression 5 % 3 is 2 because 5 divided by 3 is 1 with the remainder of 2. The following are more examples of remainder operation in C.

Example:

13 % 3 = 1;

1 % 5 = 1;

1 % 3 = 1;

8 % 3 = 2;

Assignment

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

17Developed by:Jeffrey A. Esmundo Revision # ____

17

Page 18: CBLM Appy Programming in a Second Language

As mentioned earlier, a variable identifies spaces in main memory. These spaces are variable because they can contain various and changeable values. Putting a value into one of these spaces is known as assignment. We usually refer to assigning a value to a variable, but technically, we are writing a value into the memory space identified by the variable.

Sometime, we must also make assignment as part of our program. For example, we wish to store the results of calculation in variable, but all of them follow this fundamental of rule:

A variable may have only one at a time

We may assign many different values to a variable, but each time we do, we write to the memory space reserved for that variable. The standard assignment operator is the equal sign (=). The following are some valid assignment statements.

Example:

X = 17;

X = (y+4)/2;

Total = GrossPay + OvertimeAmount;

Building Simple C program

Output

Output in C displays messages and values on screen. The printf() function is used to produced output. When use the printf() function to display something appropriate conversion code should be included depends on the type of values to be displayed. The size modifier enables a programmer to format the output for variable.

Example:

#include<stdio.h>

main(){

printf(“hello world!”);

}

Conversion Codes

Conversion codes in C are used to reserve space in the output for some other values to print – the value of a variable or expression, and to show how those values

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

18Developed by:Jeffrey A. Esmundo Revision # ____

18

Page 19: CBLM Appy Programming in a Second Language

should be converted to characters and printed. All conversion codes begin with a % sign symbol and with a type specifier. A list of conversion codes for printf() is found in Table 1-4.

Table 1-4: Data Type Specifiers for printf()

SPECIFIER DATA TYPES SAMPLE OUTPUT

c char “%c”, ‘A’ A

d int “%d”, 123 123

i int “%i”, 345 345

f float or double “%f”, 123.45 123.450000

g float or double “%g”, 123.98 123.45

Size Modifiers

Size modifier normally appears before the type specifier. We may set the minimum width of a print field by putting a number before the type specifier, if one exists. The format of the size modifier with width and precision is as below.

%[width][precission][size]specifier

Table 1-5: Size Modifiers

Statement Output

“%4i”, 123 *123

“%04i”, 123 0123

“%8.2f”, 12.345 ***12.34

“%.2f”, 1234.567 1234.56

“%1.2f”, 1234.23 1234.23

“%5.1”, 12.3678 12.4

Output Examples:

1). printf(“HELLO WORLD!”);

2). int x = 1;

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

19Developed by:Jeffrey A. Esmundo Revision # ____

19

Page 20: CBLM Appy Programming in a Second Language

printf(“the value of x is %i”, x);

3). float y = 5.4;

printf(“the value of y is %f”, y);

Input

The input in C enables the user to enter values for e.g. data entry. The function enables programmer to prompt for data entry during program execution. Appropriate conversion codes should be specified in order to display the required value. Consider the following example:

scanf(“control_string”, [ampersand][variable]);

or

scanf(“%f”, &x);

The scanf() function takes input characters and then divide them into sets of characters to convert to appropriate data types for the locations. The ampersands (&) in front of the variable is the locations in main memory – the memory addresses of the variable.

Conversion Codes

When the scanf(); function executes, it matches the character in the input stream with the characters in the control string. A single conversion code in the control string will match input characters following the steps below:

1. Leading white space characters (spaces, tabs, and newlines) are skipped (except for type specifier C). A previous scanf() will leave a newline in the input stream.

2. Subsequent characters will be takenfor conversion and assignment up to the first character that is appropriate for the data type.

Prompts

The printf() before the scanf() is known as prompt. The printf() exist to display something on the screen to tell the person at the keyboard what to type.

Flushing the Input Stream

If the person at the keyboard is not careful to give responses that fit the control string in the scanf(), there is a chance that extra characters will be left in the input stream waiting to be converted by the next scanf().

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

20Developed by:Jeffrey A. Esmundo Revision # ____

20

Page 21: CBLM Appy Programming in a Second Language

Sample Programs:

Program 1-1:

#include<stdio.h>void main(){

int i;long l;float f;double d;printf(“Enter a values for an int and a long: ”);scanf(“%i %li”, &I, &l);printf(“Your int is %i and long is %li\n\n”, i,l);

printf(“Now, enter values for float and a double: ”);scanf(“%f %f”, &f, &d);printf(“Your float is %f and double is %f\n\n”, f,d);

}

Output:

Enter value for an int and a long: 524 79735

Your int is 524 and long is 79735

Now, enter values for float and a double: 12.345 12.34567890123

Your float is 12.345000 and double is 12.345 12.34567890123

Program 1-2:

#include<stdio.h>void main(){

int x, y, ans;printf(“Enter a number: “);scanf(“%i”, &x);printf(“Enter another number: ”);scanf(“%i”, &y);ans = x + y;printf(“The sum of %i + %i is: %i”, x, y, ans);}

Output

Enter a number: 5

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

21Developed by:Jeffrey A. Esmundo Revision # ____

21

Page 22: CBLM Appy Programming in a Second Language

Enter another number: 10

The sum of 5 + 10 is: 15

Relational Operators

Relational operator  is a programming language construct or operator that tests or defines some kind of relation between two entities. These include numerical equality (e.g., 5 = 5) and inequalities (e.g., 4 ≥ 3). In programming languages that include a distinct boolean data type in their type system, like Java, these operators return true or false, depending on whether the conditional relationship between the two operands holds or not. In other languages such as C, relational operators return the integers 0 or 1. Relational operators are used in conditions. Condition’s outcome is either true or false.

Operator symbol Operator function/Meaning< Is less than to> Is greater than to

<= Is less than or equal to>= Is greater than or equal to== Is equal to!= Not equal to

Ex.

1. x = 45; -> the value of variable x is equal to 45y = 40; -> the value of variable y is equal to 40y==x -> is y equal to x?x<=y -> is x less than or equal to y?x!=y -> is x not equal to y?

Logical Operators:

Operator Symbol Operator function/Meaning|| OR

&& AND! Logical Not

RULES:

OR Operator AND OperatorTrue || True = TrueTrue || False = TrueFalse || True = True

True && True = TrueTrue && False = FalseFalse && True = False

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

22Developed by:Jeffrey A. Esmundo Revision # ____

22

Page 23: CBLM Appy Programming in a Second Language

False || False = False False && False = False

Self-Check 1.1-2

Instruction: Matching type. Write the letter of the correct answer on your answer sheet.

1. Input2. Less than3. Prompts4. Relational operator5. Greater than or equal to6. Arithmetic Expression7. Declaration8. AND Operator9. printf()10.Floating-point11.Whole numbers12.Numeric13.Character value14. !15.=

a. Anything that can be simplified into a single value, such as formulas.

b. Real numbersc. Assignment operatord. The function used to produced outpute. Integerf. >=g. Consists of a letter or any other

character surrounded by single quoteh. data entry i. These are the number valuesj. The printf() exist to display something

on the screen to tell the person at the keyboard what to type.

k. &&l. <m. The process of reserving memory

allocation on your computer.n. An operator that tests or defines some

kind of relation between two entities.o. Logical not

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

23Developed by:Jeffrey A. Esmundo Revision # ____

23

Page 24: CBLM Appy Programming in a Second Language

Answer KeySelf-Check 1.1-2

1. h2. l3. j4. n5. f6. a7. m8. k9. d10. b11.e12. i13.g14.o15.c

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

24Developed by:Jeffrey A. Esmundo Revision # ____

24

Page 25: CBLM Appy Programming in a Second Language

JOB SHEET 1.1-2aTitle: Apply output in programming.Performance Objective: The trainee/student should be able to apply output in programming for 30 minutes. Supplies/Materials:

Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Inside the main function, Select and use the function used to display output

(your output should be your name) w/ appropriate syntax8. Press F5 to compile & run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

Performance Criteria Checklist

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

25Developed by:Jeffrey A. Esmundo Revision # ____

25

Page 26: CBLM Appy Programming in a Second Language

Performance Criteria ChecklistJob Sheet 1.1-2a

Trainee’s Name: ___________________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee choose and use the appropriate output function w/

appropriate syntax?8. Did the trainee successfully compile and run the program?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

26Developed by:Jeffrey A. Esmundo Revision # ____

26

Page 27: CBLM Appy Programming in a Second Language

JOB SHEET 1.1-2bTitle: Declare variable and display its value.Performance Objective: The trainee/student should be able to declare the required variable and display its value for 1 hour. Supplies/Materials:

Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Choose a valid variable name.8. Declare a local variable with integer data type9. Assign a whole number to the variable declared in procedure no. 7 with an

appropriate syntax10.Select a conversion code corresponding to the variable’s data type11.Use the conversion code to display the value of the variable with an appropriate

syntax.12.Press F5 to compile and run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

Performance Criteria Checklist

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

27Developed by:Jeffrey A. Esmundo Revision # ____

27

Page 28: CBLM Appy Programming in a Second Language

Performance Criteria ChecklistJob Sheet 1.1-2b

Trainee’s Name: ___________________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee choose a valid variable name?8. Did the trainee declare a local variable with integer data type? 9. Did the trainee assign a whole number to the variable declared in

procedure no. 7 with an appropriate syntax?10.Did the trainee select a conversion code corresponding to the

variable’s data type?11.Did the trainee use the conversion code to display the value of the

variable with an appropriate syntax?12.Did the trainee successfully compile & run the program?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

28Developed by:Jeffrey A. Esmundo Revision # ____

28

Page 29: CBLM Appy Programming in a Second Language

JOB SHEET 1.1-2cTitle: Use a variable as a storage location of input & display itPerformance Objective: The trainee/student should be able to use the required variable as the storage location of the user’s input for 1 hour. Supplies/Materials:

Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Choose a valid variable name.8. Declare a local variable with a character data type9. Use the printf() function to display “Enter a letter: ”10.Use scanf() function to fetch user’s input w/ the appropriate string control.11.Use printf() function to display the user’s input w/ the appropriate conversion

code. 12.Press F5 to compile and run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

Performance Criteria Checklist

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

29Developed by:Jeffrey A. Esmundo Revision # ____

29

Page 30: CBLM Appy Programming in a Second Language

Performance Criteria ChecklistJob Sheet 1.1-2c

Trainee’s Name: ___________________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee choose a valid variable name?8. Did the trainee declare a local variable with integer data type? 9. Did the trainee use printf() function to display “Enter a letter: ”?10.Did the trainee use scanf() function to fetch user’s input w/ the

appropriate string control?11.Did the trainee use printf() function to display the user’s input w/

the appropriate conversion code?12.Did the trainee successfully compile & run the program?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

30Developed by:Jeffrey A. Esmundo Revision # ____

30

Page 31: CBLM Appy Programming in a Second Language

JOB SHEET 1.1-2dTitle: Using expression to calculate user’s input and display the resultPerformance Objective: The trainee/student should be able to use mathematical operator in calculating the required user’s input for 1 hour. Supplies/Materials:

Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Choose three valid variable names.8. Declare the selected variable names with an integer data type9. Use the printf() function to display “Enter a number1 : ”10.Use scanf() function to fetch user’s input w/ the appropriate string control to

store the input to the first variable.11.Use the printf() function to display “Enter a number2 : ”12.Use scanf() function to fetch user’s input w/ the appropriate string control to

store the input to the second variable.13.Use an expression that will assign the sum of the two variable’s value into the

third variable.14.Use printf() function to display the value of the third variable w/ the appropriate

conversion code. 15.Press F5 to compile and run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

Performance Criteria Checklist

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

31Developed by:Jeffrey A. Esmundo Revision # ____

31

Page 32: CBLM Appy Programming in a Second Language

Performance Criteria ChecklistJob Sheet 1.1-2d

Trainee’s Name: _________________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee choose three valid variable names?8. Did the trainee declare the selected variable names with an

integer data type? 9. Did the trainee use printf() function to display “Enter a letter1: ”?10.Did the trainee use scanf() function to fetch user’s input w/ the

appropriate string control to store the input to the first variable?11. Did the trainee use the printf() function to display “Enter a

number2 : ”?12. Did the trainee use scanf() function to fetch user’s input w/ the

appropriate string control to store the input to the second variable?

13.Did the trainee use an expression that will assign the sum of the two variable’s value into the third variable?

14.Did the trainee use printf() function to display the value of the third variable w/ the appropriate conversion code

15.Press F5 to compile and run the program?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

32Developed by:Jeffrey A. Esmundo Revision # ____

32

Page 33: CBLM Appy Programming in a Second Language

INFORMATION SHEET 1.1-3“Program Control Structure”

Learning Objective:

1. Identify and apply the operators that can be use in creating condition.2. Identify and apply the three control structures.3. Apply calculation based on loops.

Structured Programming

The technique of structured programming simplifies the programming process by using only three types of programming patterns, called control structures, to build programs.

The Three Control Structures or program constructs:

Sequence – The instructions are executed in a serial manner, one after another. Selection – It provides a decision point that enables the program to choose one

between two or more pathways. Iteration – Repeats a set of instructions a number of times based on the condition

stated.

Condition

A condition enables the program to perform certain task base on the outcome of evaluation. The statements would not be in any sequence whereby some statements might be not executed. Execution is normally base on the outcome of conditions – true or false. A condition contains one or more comparisons that relate one to another.

Relational and Equality Operators

< Less than> Greater than<= Less than or equal to>= Greater than or equal to== Equal to!= Not equal to

Ex. 6<10

10>2

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

33Developed by:Jeffrey A. Esmundo Revision # ____

33

Page 34: CBLM Appy Programming in a Second Language

5<=1010>=100!=1

A==B

Logical Operators

|| OR&& AND! Logical Not

Ex.6<10 || 10>534!=10 && X==5

1. Sequence – You have encounter already this kind of program constructs from the previous information.

Example:

#include<stdio.h>main(){ int number; printf(“Enter a number: ”); scanf(“%i”, &number); printf(“You entered %i”, number);}

2. Selection - under selection structure, we have two kinds of statements that we can use:

If & else statementSyntax:

Single if – the body of if statement will be executed only if the condition’s.

Syntax:

if(condition){ statement/body; }

Example:

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

34Developed by:Jeffrey A. Esmundo Revision # ____

34

Page 35: CBLM Appy Programming in a Second Language

#include<stdio.h>#include<conio.h>main(){

int x; printf(“Enter number: ”); scanf(“%i”, &x); if(number>=5){ printf(“You entered a value greater than four”); } getch(); }

If & else – the body of “if” will be executed if the condition’s outcome is true, if false, the body of “else” statement will be executed.

Syntax:

if(condition){ body/statement; }Else{ Body/statement; }

Example:

#include<stdio.h>#include<conio.h>main(){

int x; printf(“Enter number: ”); scanf(“%i”, &x); if(number>=5){ printf(“You entered a value greater than four”); }

else{ printf(“You entered a value less than five”); } getch(); }

If, else if & else – if the condition’s outcome of “if” statement is true, its body will be executed but if not it will test the condition of “else if”

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

35Developed by:Jeffrey A. Esmundo Revision # ____

35

Page 36: CBLM Appy Programming in a Second Language

statement, if it is true it will be executed and if not it will execute the body of “else” statement.

Example:#include<stdio.h>#include<conio.h>main(){

int x; printf(“Enter number from 1 - 3: ”); scanf(“%i”, &x); if(number==1){ printf(“You entered one”); }

else if(number==2){ printf(“You entered two”);

} else if(number==3){

printf(“You entered three”); }

else{ printf(“Invalid Input!”); }

getch(); }

Switch case statementSyntax:

switch(basis){ case 1: statement; break; case 2: statement; break; case n: statement: break; default: statement; break; }

Example:#include<stdio.h>#include<conio.h>main(){

int x; printf(“Enter a number from 1 - 3: ”);

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

36Developed by:Jeffrey A. Esmundo Revision # ____

36

Page 37: CBLM Appy Programming in a Second Language

scanf(“%i”, &x); switch(x){ case 1: printf(“you entered one”); break; case 2: printf(“you entered two”); break;

case 3: printf(“you entered three”); break; default: printf(“invalid input”); break; } getch(); }

3. Iteration Pre-test Loop - while loop is a control flow statement that allows code to be

executed repeatedly based on a given boolean condition. The while loop can be thought of as a repeating if statement.The while construct consists of a block of code and a condition. The condition is evaluated, and if the condition is true, the code within the block is executed. This repeats until the condition becomes false. Because while loop checks the condition before the block is executed.

Syntax:

while(condition){ statement; }

Example:#include<stdio.h>#include<conio.h>main(){ int x=1; while(x<=5){ printf(“%i ”,x); x=x+1; } getch(); }

Post-test Loop - is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. He do while construct consists of a block of code and a condition. First, the code within the block is executed, and then the condition is evaluated. If the condition is true the code within the block is executed again. This repeats until the condition becomes false. Because do while loops check the condition after the block is executed.

Syntax:

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

37Developed by:Jeffrey A. Esmundo Revision # ____

37

Page 38: CBLM Appy Programming in a Second Language

do{ statement; } while(condition);

Example:#include<stdio.h>#include<conio.h>main(){ int x=1; do { printf(“%i ”,x); x=x+1; } while(x<=5); getch(); }

Counter-controlled Loop syntax – is a programming statement which allows code to be repeatedly executed. Unlike many other kinds of loops, such as the while loop, the for loop is often distinguished by an explicit loop counter or loop variable. This allows the body of the for loop (the code that is being repeatedly executed) to know about the sequencing of each iteration. For loops are also typically used when the number of iterations is known before entering the loop. For loops are shorthand way to make loops when the number of iterations is known, as a for loop can be written as a while loop.

Syntax: for(initialization;condition;counter){ statement; }

Example:#include<stdio.h>#include<conio.h>main(){ int x; for(x=1;x<=5;x++) { printf(“%i ”,x); } getch(); }

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

38Developed by:Jeffrey A. Esmundo Revision # ____

38

Page 39: CBLM Appy Programming in a Second Language

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

39Developed by:Jeffrey A. Esmundo Revision # ____

39

Page 40: CBLM Appy Programming in a Second Language

Self-Check 1.1-3

Instruction: Write the letter of the correct answer on your answer sheet.

1. It provides a decision point that enables the program to choose one between two or more pathways.a. Selection b. Iteration c. Sequence d. Loop

2. It enables the program to perform certain task base on the outcome of evaluation.a. Loop b. Condition c. Sequence d. Expression

3. Repeats a set of instructions a number of times based on the condition stated.a. Sequence b. Selection c. Iteration d. Loop

4. The instructions are executed in a serial manner, one after another.a. Sequence b. Selection c. Condition d. Iteration

5. The technique of structured programming simplifies the programming process by using only three types of programming patterns called _________.a. Condition b. Control Structures c. Loop d. Database

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

40Developed by:Jeffrey A. Esmundo Revision # ____

40

Page 41: CBLM Appy Programming in a Second Language

Answer keySelf-Check 1.1-3

1. A2. B3. C4. A5. B

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

41Developed by:Jeffrey A. Esmundo Revision # ____

41

Page 42: CBLM Appy Programming in a Second Language

JOB SHEET 1.1-3aTitle: Applying pre-test loop in programming to display statement repeatedly.Performance Objective: The trainee/student should be able to use a pre-test loop to display a statement to the required number of times for 30 minutes.Supplies/Materials:

Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Declare a valid variable with an integer data type8. Use a relational operator to form a condition 9. Use a pretest loop to display “hello world” three times10.Use mathematical operators to form an expression that will increment the

value of the variable every time it loops.11.Press F5 to compile & run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

Performance Criteria Checklist

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

42Developed by:Jeffrey A. Esmundo Revision # ____

42

Page 43: CBLM Appy Programming in a Second Language

Performance Criteria ChecklistJob Sheet 1.1-3a

Trainee’s Name: _________________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee declare three valid variables w/ appropriate data

types?8. Did the trainee relational operators to form a condition? 9. Did the trainee use a pre-test loop to display “hello world” three

times10. Did the trainee use mathematical operators to form an

expression that will increment the value of the variable every time it loops?

11. Did the trainee successfully compile and run the program?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

43Developed by:Jeffrey A. Esmundo Revision # ____

43

Page 44: CBLM Appy Programming in a Second Language

JOB SHEET 1.1-3bTitle: Applying post-test loop in programming to display statement repeatedly.Performance Objective: The trainee/student should be able to use a post-test loop to display a statement to the required number of times for 30 minutes.Supplies/Materials:

Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Declare a valid variable with an integer data type8. Use a relational operator to form a condition 9. Use a post-test loop to display “hello world” three times10.Use mathematical operators to form an expression that will increment the value

of the variable every time it loops.11.Press F5 to compile & run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

Performance Criteria Checklist

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

44Developed by:Jeffrey A. Esmundo Revision # ____

44

Page 45: CBLM Appy Programming in a Second Language

Performance Criteria ChecklistJob Sheet 1.1-3b

Trainee’s Name: _________________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee declare three valid variables w/ appropriate data

types?8. Did the trainee relational operators to form a condition? 9. Did the trainee use a post-test loop to display “hello world” three

times10. Did the trainee use mathematical operators to form an

expression that will increment the value of the variable every time it loops?

11. Did the trainee successfully compile and run the program?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

45Developed by:Jeffrey A. Esmundo Revision # ____

45

Page 46: CBLM Appy Programming in a Second Language

JOB SHEET 1.1-3cTitle: Applying counter-controlled loop in programming to display statement repeatedly.Performance Objective: The trainee/student should be able to use a counter-controlled loop to display a statement to the required number of times for 30 minutes.Supplies/Materials:

Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Declare a valid variable with an integer data type8. Use a relational operator to form a condition 9. Use a counter-controlled loop to display “hello world” three times10.Use mathematical operators to form an expression that will increment the value

of the variable every time it loops.11.Press F5 to compile & run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

Performance Criteria Checklist

Performance Criteria Checklist

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

46Developed by:Jeffrey A. Esmundo Revision # ____

46

Page 47: CBLM Appy Programming in a Second Language

Job Sheet 1.1-3c

Trainee’s Name: _________________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee declare three valid variables w/ appropriate data

types?8. Did the trainee relational operators to form a condition? 9. Did the trainee use a counter-controlled loop to display “hello

world” three times10. Did the trainee use mathematical operators to form an

expression that will increment the value of the variable every time it loops?

11. Did the trainee successfully compile and run the program?

JOB SHEET 1.1-3d

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

47Developed by:Jeffrey A. Esmundo Revision # ____

47

Page 48: CBLM Appy Programming in a Second Language

Title: Applying expression in calculation within the loopPerformance Objective: The trainee/student should be able to use an expression to calculate the required result within the loop for 1 hour and 30 minutes.Supplies/Materials:

Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Declare a valid & required variable with an integer data type8. Use a relational operator to form a condition 9. Decide and use which loop to be used(Nested Loop)10.Use mathematical operators to form an expression that will calculate the product

of the variable every time it loops.11.Use printf() function w/ appropriate conversion code to display the result every

time it loops that will form a multiplication table.12.Use any selection statement to align the output identify and create next line.13.Press F5 to compile & run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

Performance Criteria Checklist

Performance Criteria ChecklistJob Sheet 1.1-3d

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

48Developed by:Jeffrey A. Esmundo Revision # ____

48

Page 49: CBLM Appy Programming in a Second Language

Trainee’s Name: _________________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee declare a valid & required variable with an integer

data type?8. Did the trainee use a relational operator to form a condition? 9. Did the trainee decide and use which loop to be used(Nested

Loop)10. Did the trainee use mathematical operators to form an

expression that will calculate the product of the variable every time it loops?

11. Did the trainee use printf() function w/ appropriate conversion code to display the result every time it loops that will form a multiplication table?

14. Did the trainee use any selection statement to align the output identify and create next line.

12. Did the trainee successfully compile & run the program?

Plan

NOTE: *Critical Aspects of Competency

Prepared by: Date:

Checked by: Date:

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

49Developed by:Jeffrey A. Esmundo Revision # ____

49

Page 50: CBLM Appy Programming in a Second Language

ASSESSMENT TOOLS

Written Test

Competency Standard: Programming NC IVUnit of Competency: Apply Programming Skills as a Second

LanguageType of Assessment Tool: Written

Name:____________________________ Date:_____________________________

Title: Basic language syntax rules and best practices are observed.Test I: Multiple ChoiceDirection: Write the letter of the correct answer on your answer sheet.

1. A ____________ may be utilized as a template that reflects syntax and structures

commonly used in a wide class of problems.

a. Variable b. Programming c. Program skeleton d. Program

2. In C, a _____ is a set of functions contained within a single "archive" file.

a. Variable b. function prototype c. Library d. file header

3. _____________ is a portion of code within a larger program that performs a

specific task and is relatively independent of the remaining code.

b. File Header b. Function c. Variable d. Statement

4. ___________ is a variable which is accessible only from the function or block in

which it is declared.

c. local variable b. global variable c. header d. function

5. The _________ is where a program starts the execution.

a. function b. local variable c. global variable d. main function

6. ___________ is a variable that is accessible in every scope.

a. local variable b. library c. global variable d. constant variable

7. A ____________ is an identifier whose associated value cannot typically be

altered by the program during its execution.

a. global variable b. constant variable c. local variable d. function

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

50Developed by:Jeffrey A. Esmundo Revision # ____

50

Page 51: CBLM Appy Programming in a Second Language

8. __________ is an example of a basic file header that can be used in most of C

Language compilers.

a. #include<stdio.h> b.#includeme<stdnio.s> c. #include<stxvt.a>

9. Header files commonly contain forward declarations of ____________.

a. classes b. variables c. subroutines d. identifiers e. all a to d

10. __________ is a declaration of a function that omits the function body but does

specify the function's name, arity, argument types and return type.

a. function b. function prototype c. header file d. variable

Test II: Matching TypeInstruction: Matching type. Write the letter of the correct answer on your answer sheet.

1. Input2. Less than3. Prompts4. Relational operator5. Greater than or equal to6. Arithmetic Expression7. Declaration8. AND Operator9. printf()10. Floating-point11. Whole numbers12. Numeric13. Character value14. !15. =

a. Anything that can be simplified into a single value, such as formulas.

b. Real numbersc. Assignment operatord. The function used to produced outpute. Integerf. >=g. Consists of a letter or any other

character surrounded by single quoteh. data entry i. These are the number valuesj. The printf() exist to display something

on the screen to tell the person at the keyboard what to type.

k. &&l. <m. The process of reserving memory

allocation on your computer.n. An operator that tests or defines some

kind of relation between two entities.o. Logical not

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

51Developed by:Jeffrey A. Esmundo Revision # ____

51

Page 52: CBLM Appy Programming in a Second Language

Answer Key

Test I: Multiple Choice

1. D

2. C

3. B

4. A

5. D

6. C

7. B

8. A

9. E

10. B

Test II: Matching Type

1. h2. l3. j4. n5. f6. a7. m8. k9. d10. b11. e12. i13. g14. o15. c

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

52Developed by:Jeffrey A. Esmundo Revision # ____

52

Page 53: CBLM Appy Programming in a Second Language

Observation & Questioning

Competency Standard: Programming NC IVUnit of Competency: Apply Programming Skills as a Second

LanguageType of Assessment Tool: Observation & Questioning

Name:____________________________ Date:_____________________________

Title: Language data-types, operators and expressions are used.Performance Objective:

The trainee/student should be able to use mathematical operator in calculating the required user’s input for 1 hour.

Supplies/Materials: Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Choose three valid variable names.8. Declare the selected variable names with an integer data type9. Use the printf() function to display “Enter a number1 : ”10. Use scanf() function to fetch user’s input w/ the appropriate string control to

store the input to the first variable.11. Use the printf() function to display “Enter a number2 : ”12. Use scanf() function to fetch user’s input w/ the appropriate string control to

store the input to the second variable.13. Use an expression that will assign the sum of the two variable’s value into the

third variable.14. Use printf() function to display the value of the third variable w/ the appropriate

conversion code. 15. Press F5 to compile and run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

53Developed by:Jeffrey A. Esmundo Revision # ____

53

Page 54: CBLM Appy Programming in a Second Language

Performance Criteria Checklist

Performance Criteria Checklist

Trainee’s Name: _______________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee choose three valid variable names?8. Did the trainee declare the selected variable names with an integer data

type? 9. Did the trainee use printf() function to display “Enter a letter1: ”?10.Did the trainee use scanf() function to fetch user’s input w/ the

appropriate string control to store the input to the first variable?11.Did the trainee use the printf() function to display “Enter a number2 : ”?12.Did the trainee use scanf() function to fetch user’s input w/ the

appropriate string control to store the input to the second variable?13.Did the trainee use an expression that will assign the sum of the two

variable’s value into the third variable?14.Did the trainee use printf() function to display the value of the third

variable w/ the appropriate conversion code15.Press F5 to compile and run the program?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

54Developed by:Jeffrey A. Esmundo Revision # ____

54

Page 55: CBLM Appy Programming in a Second Language

Observation & Questioning

Competency Standard: Programming NC IVUnit of Competency: Apply Programming Skills as a Second

LanguageType of Assessment Tool: Observation & Questioning

Name:____________________________ Date:_____________________________

Title: The appropriate language syntax for sequence, selection and iteration constructs is used.

Performance Objective: The trainee/student should be able to apply the three control structures and use an expression to calculate the required result within the loop for 1 hour and 30 minutes.

Supplies/Materials: Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Declare a valid & required variable with an integer data type8. Use a relational operator to form a condition 9. Decide and use which loop to be used(Nested Loop)10.Use mathematical operators to form an expression that will calculate the product of

the variable every time it loops.11.Use printf() function w/ appropriate conversion code to display the result every time

it loops that will form a multiplication table.12.Use any selection statement to align the output identify and create next line.13.Press F5 to compile & run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

Performance Criteria Checklist

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

55Developed by:Jeffrey A. Esmundo Revision # ____

55

Page 56: CBLM Appy Programming in a Second Language

Performance Criteria Checklist

Trainee’s Name: _______________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee declare a valid & required variable with an integer

data type?8. Did the trainee use a relational operator to form a condition? 9. Did the trainee decide and use which loop to be used(Nested Loop)10.Did the trainee use mathematical operators to form an expression

that will calculate the product of the variable every time it loops?11.Did the trainee use printf() function w/ appropriate conversion code

to display the result every time it loops that will form a multiplication table?

12.Did the trainee use any selection statement to align the output identify and create next line.

13.Did the trainee successfully compile & run the program?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

56Developed by:Jeffrey A. Esmundo Revision # ____

56

Page 57: CBLM Appy Programming in a Second Language

Demonstration & Questioning

Competency Standard: Programming NC IVUnit of Competency: Apply Programming Skills as a Second

LanguageType of Assessment Tool: Demonstration & Questioning

Name:____________________________ Date:_____________________________

Title: Application program are designed and built in accordance with systems and programming requirements and standards

Performance Objective: The trainee/student should be able to apply the three control structures and use an expression to calculate the required result within the loop for 1 hour and 30 minutes.

Supplies/Materials: Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Choose and use a valid header file with appropriate syntax6. Use the main function with appropriate syntax7. Declare a valid & required variable with an integer data type8. Use a relational operator to form a condition 9. Decide and use which loop to be used(Nested Loop)10.Use mathematical operators to form an expression that will calculate the product

of the variable every time it loops.11.Use printf() function w/ appropriate conversion code to display the result every

time it loops that will form a multiplication table.12.Use any selection statement to align the output identify and create next line.13.Press F5 to compile & run the program

Note: If in case there’s an error detected, debug the code.

Assessment Method:

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

57Developed by:Jeffrey A. Esmundo Revision # ____

57

Page 58: CBLM Appy Programming in a Second Language

Performance Criteria Checklist

Performance Criteria Checklist

Trainee’s Name: _______________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee choose and use a valid header file w/ appropriate

syntax?6. Did the trainee use the main function with appropriate syntax? 7. Did the trainee declare a valid & required variable with an integer

data type?8. Did the trainee use a relational operator to form a condition? 9. Did the trainee decide and use which loop to be used(Nested

Loop)10. Did the trainee use mathematical operators to form an

expression that will calculate the product of the variable every time it loops?

11. Did the trainee use printf() function w/ appropriate conversion code to display the result every time it loops that will form a multiplication table?

12. Did the trainee use any selection statement to align the output identify and create next line.

13. Did the trainee successfully compile & run the program?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

58Developed by:Jeffrey A. Esmundo Revision # ____

58

Page 59: CBLM Appy Programming in a Second Language

Demonstration & Questioning

Competency Standard: Programming NC IVUnit of Competency: Apply Programming Skills as a Second

LanguageType of Assessment Tool: Demonstration & Questioning

Name:____________________________ Date:_____________________________

Title: Application or programs developed are tested and meets systems and/or user specification

Performance Objective: The trainee/student should be able to apply the three control structures and use an expression to calculate the required result within the loop for 1 hour.

Supplies/Materials: Bond Paper Ball pen

Equipment: Computer

Steps/Procedures:On your pc…

1. Click start button2. Select and click all programs.3. Select and click bloodshed4. Select and click Dev C++5. Open you source code6. Run your program7. Test your program for errors8. Explain the source codes

Assessment Method:

Performance Criteria Checklist

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

59Developed by:Jeffrey A. Esmundo Revision # ____

59

Page 60: CBLM Appy Programming in a Second Language

Performance Criteria Checklist

Trainee’s Name: _______________________________ Date: __________________

CRITERIA Yes No1. Did the trainee found and click start button?2. Did the trainee found and click all programs? 3. Did the trainee found and click bloodshed?4. Did the trainee found and click Dev C++ Compiler?5. Did the trainee open his/her own source code?6. Did the trainee successfully run his/her program? 7. Did the trainee tests the program for errors?8. Did the trainee explain the source code?

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

60Developed by:Jeffrey A. Esmundo Revision # ____

60

Page 61: CBLM Appy Programming in a Second Language

Inventory of Tools

CompetencyPrint-

materialsNon-print Materials

Tools Equipments

BASIC1. Utilize specialized communication skills1.1. Apply communication

strategiesCBLM Presentation Ballpen

Coupon Bond

Computer & Projector

1.2. Represent the organization in internal and external forums

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

2. Develop teams and individuals2.1. Determine development

needsCBLM Presentation Ballpen

Coupon Bond

Computer & Projector

2.2. Foster individual and organizational growth

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

2.3. Monitor and evaluate workplace learning

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

2.4. Development team commitment and cooperation

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

3. Apply problem solving techniques in the workplace3.1. Analyze the problem CBLM Presentation Ballpen

Coupon Bond

Computer & Projector

3.2. Identify individual and organizational growth

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

3.3. Determine possible solution

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

3.4. Prepare communication or documentation report

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

3.5. Present CBLM Presentation Ballpen Computer &

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

61Developed by:Jeffrey A. Esmundo Revision # ____

61

Page 62: CBLM Appy Programming in a Second Language

recommendation to appropriate personnel

Coupon Bond

Projector

3.6. Implement solution CBLM Presentation BallpenCoupon

Bond

Computer & Projector

4. Collect, analyze and organize information4.1. Study information

requirementsCBLM Presentation Ballpen

Coupon Bond

Computer & Projector

4.2. Process data CBLM Presentation BallpenCoupon

Bond

Computer & Projector

4.3. Analyse, interpret and organize information gathered

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

4.4. Present findings/recommendations

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

5. Plan and organize work5.1. Set work objectives CBLM Presentation Ballpen

Coupon Bond

Computer & Projector

5.2. Plan and schedule work objectives

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

5.3. Implement and monitor plans/activities

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

5.4. Review and evaluate work plans and activities

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

6. Promote environmental protection6.1. Study guidelines for

environmental concernsCBLM Presentation Ballpen

Coupon Bond

Computer & Projector

COMMON1. Apply Quality Standards1.1. Assess quality of

received materialsCBLM Presentation Ballpen

Coupon Bond

Computer & Projector

1.2. Assess own work CBLM Presentation BallpenCoupon

Bond

Computer & Projector

1.3. Engage in quality standards

CBLM Presentation BallpenCoupon

Computer & Projector

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

62Developed by:Jeffrey A. Esmundo Revision # ____

62

Page 63: CBLM Appy Programming in a Second Language

Bond2. Operate a Personal Computer2.1. Start and shut down the

computerCBLM Presentation Ballpen

Coupon Bond

Computer & Projector

2.2. Arrange and customize desktop display/window settings

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

2.3. Work with files and folders(directories)

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

2.4. Work with user application programs

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

2.5. Print information CBLM Presentation BallpenCoupon

Bond

Computer & Projector

CORE1. Design Program logic1.1. Select the program logic

design approachCBLM Presentation Ballpen

Coupon Bond

Computer & ProjectorGB

1.2. Document the program logic or design

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

1.3. Validate the design CBLM Presentation BallpenCoupon

Bond

Computer & Projector

2. Apply program development approach2.1. Determine and select

appropriate program development approach

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

2.2. Apply the selected development approach

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

3. Apply object-oriented program language skills3.1. Apply basic language

syntax and layoutCBLM Presentation Ballpen

Coupon Bond

Computer & Projector

3.2. Apply basic OOP principles in the target language

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

3.3. Debug code CBLM Presentation BallpenCoupon

Bond

Computer & Projector

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

63Developed by:Jeffrey A. Esmundo Revision # ____

63

Page 64: CBLM Appy Programming in a Second Language

3.4. Document activities CBLM Presentation BallpenCoupon

Bond

Computer & Projector

3.5. Test Code CBLM Presentation BallpenCoupon

Bond

Computer & Projector

4. Apply programming skills in a second language4.1. Apply basic language

syntax and layoutCBLM Presentation Ballpen

Coupon Bond

Computer & Projector

4.2. Code using standard algorithm

CBLM Presentation BallpenCoupon

Bond

Computer & Projector

4.3. Debug code CBLM Presentation BallpenCoupon

Bond

Computer & Projector

4.4. Document activities CBLM Presentation BallpenCoupon

Bond

Computer & Projector

4.5. Test Code CBLM Presentation BallpenCoupon

Bond

Computer & Projector

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

64Developed by:Jeffrey A. Esmundo Revision # ____

64

Page 65: CBLM Appy Programming in a Second Language

Terms and Definition

Program (Computer Program) - is a sequence of instructions written to perform a specified task for a computer.

Programming language – is a language used to write instructions that can be translated into machine language and then executed by a computer.

Programming: The process of writing or creating a program.

Value - is a sequence of bits that is interpreted according to some data type.

Numeric Values - is a mathematical object used in counting and measuring.

Character - is a unit of information that roughly corresponds to a grapheme, grapheme-like unit, or symbol, such as in an alphabet or syllabify in the written form of a natural language.

Variable - is a facility for storing data

Data-types - a classification identifying one of various types of data.

Operator - refers to any function or keyword whose name is a symbol or series of symbols.

Declaration – the process of defining a method, classes, types and others on the system.

Assignment – putting a value into the variable.

Expressions – is anything that can be simplified into a single value, such as formula.

Precedence – is an expression or string of symbols intended to represent a numerical value must follow commonly accepted and unambiguous rules.

Conversion Codes: Are used to reserve space in the output for some other values to be print.

Syntax – is the proper arrangement of instruction. A programming language's surface form and it describes the possible combinations of symbols that form a syntactically correct program.

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

65Developed by:Jeffrey A. Esmundo Revision # ____

65

Page 66: CBLM Appy Programming in a Second Language

Compiler: A compiler is a computer program (or set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program.

Source Code: source code is text written in a computer programming language.

Programmer: Is someone who writes computer software/programs. It can refer to a specialist in one area of computer programming or to a generalist who writes code for many kinds of software.

Output – means display messages and values on screen and/or the processed input.

Conversion codes – are symbols used to reserve space in the output for some other values to be displayed.

Input – is the data/values entered by the user into the computer/program.

Program Construct - is a syntactically allowable part of a program that may be formed from one or more lexical tokens in accordance with the rules of a programming language.

Condition: Enables the computer program to perform certain task base on the outcome of evaluation.

Sequence – A program construct that Executes the statements in a serial manner, one after another.

Selection – A program construct that enables the program to choose one between two or more pathways based on the condition/basis stated.

Iteration – A program construct that repeats a set of instruction a number of times based on the condition stated.

Function – enables program segments to be grouped as one module.

Array – is a consecutive storage location in computer’s memory that store’s similar type of data. Is a collection of data with the same data type.

Database - consists of an organized collection of data for one or more multiple uses.

Debugging - is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected.

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

66Developed by:Jeffrey A. Esmundo Revision # ____

66

Page 67: CBLM Appy Programming in a Second Language

Binary File - s a computer file which may contain any type of data, encoded in binary form for computer storage and processing purposes; for example, computer document files containing formatted text.

Reserved words – are words with a special meaning and/or with a special function.

String: Is an array of alphanumeric characters.

References:

ICT313331

Computer Systems Institute

Date Developed: February 15, 2012

Document No.Issued by: Page:

67Developed by:Jeffrey A. Esmundo Revision # ____

67