Sie sind auf Seite 1von 71

1

COMPETENCY BASED LEARNING MATERIAL

Computer Systems Institute


F. Imperial St. Kapantawan, Legazpi City

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

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 1

Revision # ____

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

E-Mail: csilegazpi@yahoo.com

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, dont 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.

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 2

Revision # ____

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.

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 3

Revision # ____

MODULE CONTENT Unit of Competency Module Apply Programming Skills in a Second Language 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
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 4

ICT313331

Revision # ____

Upon completion of this module you must be able to:

Apply basic language syntax and layout. Code using standard algorithms Debug code Document Activities Test Code

LEARNING OUTCOME #1: SELECT THE PROGRAM LOGIC DESIGN APPROACH CONTENTS: 1. Semantics and Syntax 2. Elements of Programming 3. 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. 2. 3. Workplace Equipment Computer set with Dev C++ compiler installed Learning materials

ASSESSMENT METHOD:

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 5

Revision # ____

1.Written test 2.Practical test 3.Oral questioning

Learning Experiences Learning Outcome 1 APPLY PROGRAMMING SKILLS IN A SECOND LANGUAGE Learning Activities Special Instructions 1. Read Semantics and Syntax (1.1-1) Perform all activities required by the module 2. 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 Answer Self-Check 1.1-2 & perform Job (1.1-2) 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
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 6

ICT313331

Revision # ____

7 8. 9.

Perform Job Sheet 1.1-2d

Read Elements of programming (1.1-3) Answer Self-Check for 1.1-3

10.

11. 12. 13. 14.

Perform Job Sheet 1.1-3a Perform Job Sheet 1.1-3a Perform Job Sheet 1.1-3c Perform Job Sheet 1.1-3d

Approach the trainer to check the work done 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 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. Approach the trainer to check the work done Approach the trainer to check the work done Approach the trainer to check the work done 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.

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 7

Revision # ____

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

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 8

Revision # ____

A program skeleton may be utilized as a template that reflects syntax and structures commonly used in a wide class of problems. Header File Declaration Constant Variable Declaration Function Prototype Global Variable Declaration and link list main(){ Local variable declaration Statement/body } Functions Header File

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
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 9

ICT313331

Revision # ____

10

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

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).
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 10

ICT313331

Revision # ____

11

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 { 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(){ 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
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

or

void main(){ Statement; }

Page: 11

ICT313331

Revision # ____

12

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;

Self-Check 1.1-1 Instruction: Write the letter of the correct answer on your answer sheet. 1. a. A ____________ may be utilized as a template that reflects syntax Variable b. Programming c. Program skeleton d. Program
Document No. Issued by:

and structures commonly used in a wide class of problems.

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Page: 12

Revision # ____

13

2. file. a. Variable
3.

In C, a _____ is a set of functions contained within a single "archive" b. function prototype c. Library d. file header

_____________ 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 ___________ is a variable that is accessible in every scope. a. local variable b. library c. global variable d. constant variable 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

6.

7.

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 __________ 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

10.

Answer Key Self-Check 1.1-1

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 13

Revision # ____

14

1. D 2. C 3. B 4. A 5. D 6. C 7. B 8. A 9. E 10. B

INFORMATION SHEET 1.1-2 Elements of Programming


Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 14

ICT313331

Revision # ____

15

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

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 15

Revision # ____

16

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 break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while

2 values in C
1. 2.

Numeric value these are the number values 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 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.

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 16

Revision # ____

17

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 int 2. Floating-point float 3. 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; char letter; Arithmetic Expression

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 17

Revision # ____

18

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 I II III IV Type Unary Associativit y Right to left Operator Negate Plus Multiply Divide Remainder Add Subtract Equals Symbol + * / % + = Example -14 +4 3*3 10/5 4%2 2+3 10-9 A=10

Multiplicative Left to right Additive Assignment Left to right Right to left

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 floatingpoint 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

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 18

Revision # ____

19

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


Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 19

ICT313331

Revision # ____

20

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 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 c d i f g DATA TYPES char int int float or double float or double SAMPLE %c, A %d, 123 %i, 345 %f, 123.45 %g, 123.98 A 123 345 123.450000 123.45 OUTPUT

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 %4i, 123 %04i, 123 %8.2f, 12.345 %.2f, 1234.567 %1.2f, 1234.23 %5.1, 12.3678 Output Examples:
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 20

Output *123 0123 ***12.34 1234.56 1234.23 12.4

ICT313331

Revision # ____

21

1). printf(HELLO WORLD!); 2). int x = 1; 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.
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 21

ICT313331

Revision # ____

22

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(). 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: );
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 22

ICT313331

Revision # ____

23

scanf(%i, &y); ans = x + y; printf(The sum of %i + %i is: %i, x, y, ans); } Output Enter a number: 5 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. Conditions outcome is either true or false. Operator symbol < > <= >= == != Ex. 1. x = 45; y = 40; y==x x<=y x!=y -> the value of variable x is equal to 45 -> the value of variable y is equal to 40 -> is y equal to x? -> is x less than or equal to y? -> is x not equal to y? 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

Logical Operators:

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 23

Revision # ____

24

Operator Symbol || && ! RULES: OR Operator True || True = True True || False = True False || True = True False || False = False

Operator function/Meaning OR AND Logical Not AND Operator True && True = True True && False = False False && True = False False && False = False

Self-Check 1.1-2 Instruction: Matching type. Write the letter of the correct answer on your answer sheet. 1. Input 2. Less than 3. Prompts 4. Relational operator 5. Greater than or equal to 6. Arithmetic Expression 7. Declaration 8. AND Operator 9. printf() 10. Floating-point 11. Whole numbers 12. Numeric 13. Character value 14. ! 15. = Anything that can be simplified into a single value, such as formulas. b. Real numbers c. Assignment operator d. The function used to produced output e. Integer f. >= g. Consists of a letter or any other character surrounded by single quote h. data entry i. These are the number values j. 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
a.

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 24

Revision # ____

25

some kind of relation between two entities. o. Logical not

Answer Key Self-Check 1.1-2 1. h 2. l 3. j 4. n 5. f 6. a 7. m 8. k 9. d 10. b 11. e 12. i 13. g 14. o 15. c

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 25

Revision # ____

26

JOB SHEET 1.1-2a Title: 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 button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Inside the main function, Select and use the function used to display output
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 26

ICT313331

Revision # ____

27

(your output should be your name) w/ appropriate syntax 8. Press F5 to compile & run the program Note: If in case theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Job Sheet 1.1-2a Trainees Name: ___________________________________ Date: __________________ CRITERIA Did the trainee found and click start button? Did the trainee found and click all programs? Did the trainee found and click bloodshed? Did the trainee found and click Dev C++ Compiler? Did the trainee choose and use a valid header file w/ appropriate syntax?
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Yes

No

1. 2. 3. 4. 5.

Page: 27

ICT313331

Revision # ____

28

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?

JOB SHEET 1.1-2b Title: 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
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 28

ICT313331

Revision # ____

29

1. Click start button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Choose a valid variable name. 8. Declare a local variable with integer data type 9. Assign a whole number to the variable declared in procedure no. 7 with an appropriate syntax 10. Select a conversion code corresponding to the variables data type 11. 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 theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Job Sheet 1.1-2b Trainees Name: ___________________________________ Date: __________________ CRITERIA 1. Did the trainee found and click start button? 2. Did the trainee found and click all programs?
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Yes

No

Page: 29

ICT313331

Revision # ____

30

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 variables 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?

JOB SHEET 1.1-2c Title: Use a variable as a storage location of input & display it Performance Objective: The trainee/student should be able to use the required variable as the storage location of the users input for 1 hour. Supplies/Materials: Bond Paper Ball pen
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 30

ICT313331

Revision # ____

31

Equipment: Computer Steps/Procedures: On your pc 1. Click start button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Choose a valid variable name. 8. Declare a local variable with a character data type 9. Use the printf() function to display Enter a letter: 10. Use scanf() function to fetch users input w/ the appropriate string control. 11. Use printf() function to display the users input w/ the appropriate conversion code. 12. Press F5 to compile and run the program Note: If in case theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Job Sheet 1.1-2c Trainees Name: ___________________________________ Date: __________________

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 31

Revision # ____

32

CRITERIA Did the trainee found and click start button? Did the trainee found and click all programs? Did the trainee found and click bloodshed? Did the trainee found and click Dev C++ Compiler? 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 users input w/ the appropriate string control? 11. Did the trainee use printf() function to display the users input w/ the appropriate conversion code? 12. Did the trainee successfully compile & run the program? 1. 2. 3. 4. 5.

Yes

No

JOB SHEET 1.1-2d Title: Using expression to calculate users input and display the result Performance Objective: The trainee/student should be able to use mathematical operator in calculating the
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 32

ICT313331

Revision # ____

33

required users input for 1 hour. Supplies/Materials: Bond Paper Ball pen Equipment: Computer Steps/Procedures: On your pc 1. Click start button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Choose three valid variable names. 8. Declare the selected variable names with an integer data type 9. Use the printf() function to display Enter a number1 : 10. Use scanf() function to fetch users 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 users 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 variables 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 theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Job Sheet 1.1-2d


Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 33

ICT313331

Revision # ____

34

Trainees Name: _________________________________ Date: __________________ CRITERIA 1. 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 users 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 users 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 variables 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? Yes No

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 34

Revision # ____

35

INFORMATION SHEET 1.1-3 Program Control Structure Learning Objective: Identify and apply the operators that can be use in creating condition. Identify and apply the three control structures. 3. Apply calculation based on loops.
1. 2.

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 < > <= >= == != Ex.
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Less than Greater than Less than or equal to Greater than or equal to Equal to Not equal to

Page: 35

ICT313331

Revision # ____

36

6<10 10>2 5<=10 10>=10 0!=1 A==B Logical Operators || && ! Ex. 6<10 || 10>5 34!=10 && X==5 OR AND Logical Not

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

Example: #include<stdio.h> main(){ int number; printf(Enter a number: ); scanf(%i, &number); printf(You entered %i, number); } Selection - under selection structure, we have two kinds of statements that we can use: If & else statement Syntax: Single if the body of if statement will be executed only if the conditions.
2.

Syntax:

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 36

Revision # ____

37

if(condition){ statement/body; } 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); } getch(); }

If & else the body of if will be executed if the conditions 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{
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 37

ICT313331

Revision # ____

38

printf(You entered a value less than five); } getch(); } If, else if & else if the conditions outcome of if statement is true, its body will be executed but if not it will test the condition of else if 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 statement Syntax: switch(basis){ case 1: statement; break; case 2: statement; break; case n: statement:
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 38

ICT313331

Revision # ____

39

break; default: statement; break; } Example: #include<stdio.h> #include<conio.h> main(){ int x; printf(Enter a number from 1 - 3: ); 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){
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 39

ICT313331

Revision # ____

40

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: 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; }
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 40

ICT313331

Revision # ____

41

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

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 41

Revision # ____

42

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

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 42

Revision # ____

43

Answer key Self-Check 1.1-3 1. 2. 3. 4. 5. A B C A B

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 43

Revision # ____

44

JOB SHEET 1.1-3a Title: 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 button 2. Select and click all programs. 3. Select and click bloodshed
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 44

ICT313331

Revision # ____

45

4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Declare a valid variable with an integer data type 8. Use a relational operator to form a condition 9. Use a pretest loop to display hello world three times 10. 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 theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Job Sheet 1.1-3a Trainees Name: _________________________________ Date: __________________ CRITERIA Did the trainee found and click start button? Did the trainee found and click all programs? Did the trainee found and click bloodshed? Did the trainee found and click Dev C++ Compiler? Did the trainee choose and use a valid header file w/ appropriate syntax?
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Yes

No

1. 2. 3. 4. 5.

Page: 45

ICT313331

Revision # ____

46

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 times 10. 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-3b Title: 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
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 46

ICT313331

Revision # ____

47

1. 2. 3. 4. 5. 6. 7. 8.

Click start button Select and click all programs. Select and click bloodshed Select and click Dev C++ Choose and use a valid header file with appropriate syntax Use the main function with appropriate syntax Declare a valid variable with an integer data type Use a relational operator to form a condition 9. Use a post-test loop to display hello world three times 10. 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 theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Job Sheet 1.1-3b Trainees Name: _________________________________ Date: __________________ CRITERIA Did the trainee found and click start button? Did the trainee found and click all programs? Did the trainee found and click bloodshed?
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Yes

No

1. 2. 3.

Page: 47

ICT313331

Revision # ____

48

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 times 10. 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-3c Title: 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
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 48

ICT313331

Revision # ____

49

Equipment: Computer Steps/Procedures: On your pc 1. Click start button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Declare a valid variable with an integer data type 8. Use a relational operator to form a condition 9. Use a counter-controlled loop to display hello world three times 10. 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 theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Job Sheet 1.1-3c Trainees Name: _________________________________ Date: __________________

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 49

Revision # ____

50

CRITERIA 1. 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 times 10. 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?

Yes

No

JOB SHEET 1.1-3d Title: Applying expression in calculation within the loop Performance Objective: The trainee/student should be able to use an expression to calculate the required
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 50

ICT313331

Revision # ____

51

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 button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Declare a valid & required variable with an integer data type 8. 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 theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist


Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 51

ICT313331

Revision # ____

52

Job Sheet 1.1-3d Trainees Name: _________________________________ Date: __________________ CRITERIA 1. 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? Yes No

Plan NOTE: *Critical Aspects of Competency Prepared by: Checked by: Date: Date:

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 52

Revision # ____

53

ASSESSMENT TOOLS Written Test Programming NC IV Apply Programming Skills as a Second Language Type of Assessment Tool: Written Name:____________________________ Date:_____________________________ Title: Basic language syntax rules and best practices are observed. Test I: Multiple Choice Direction: Write the letter of the correct answer on your answer sheet. 1. a. 2. A ____________ may be utilized as a template that reflects syntax and structures Variable b. Programming c. Program skeleton d. Program In C, a _____ is a set of functions contained within a single "archive" file. Competency Standard: Unit of Competency:

commonly used in a wide class of problems.

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

File Header b. Function c. Variable d. Statement ___________ is a variable which is accessible only from the function or block in local variable b. global variable c. header d. function The _________ is where a program starts the execution.

which it is declared. c.
5.

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.
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by: Page: 53

ICT313331

Revision # ____

54

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. 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 Type Instruction: Matching type. Write the letter of the correct answer on your answer sheet. Input Less than Prompts Relational operator Greater than or equal to Arithmetic Expression Declaration AND Operator printf() Floating-point Whole numbers Numeric Character value ! = a. Anything that can be simplified into a single value, such as formulas. b. Real numbers c. Assignment operator d. The function used to produced output e. Integer f. >= g. Consists of a letter or any other character surrounded by single quote h. data entry i. These are the number values j. 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

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 54

Revision # ____

55

Answer Key Test I: Multiple Choice 1. 2. 3. 4. 5. 6. 7. 8. 9. D C B A D C B A E

10. B Test II: Matching Type 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. h l j n f a m k d b e i g


Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 55

ICT313331

Revision # ____

56

14. o 15. c

Observation & Questioning Programming NC IV Apply Programming Skills as a Second Language Type 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 users input for 1 hour. Supplies/Materials: Bond Paper Ball pen Equipment: Computer Steps/Procedures: On your pc 1. Click start button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Choose three valid variable names. 8. Declare the selected variable names with an integer data type 9. Use the printf() function to display Enter a number1 : 10. Use scanf() function to fetch users 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 users 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 variables value into the
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Competency Standard: Unit of Competency:

Page: 56

ICT313331

Revision # ____

57

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 theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist Performance Criteria Checklist Trainees Name: _______________________________ Date: __________________ CRITERIA 1. 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 users 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 users 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 variables 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? Yes No

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 57

Revision # ____

58

Observation & Questioning Programming NC IV Apply Programming Skills as a Second Language Type 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 button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Declare a valid & required variable with an integer data type
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Competency Standard: Unit of Competency:

Page: 58

ICT313331

Revision # ____

59

8. 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 theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Trainees Name: _______________________________ Date: __________________ CRITERIA 1. 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?
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Yes

No

Page: 59

ICT313331

Revision # ____

60

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?

Demonstration & Questioning Programming NC IV Apply Programming Skills as a Second Language Type 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 Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Competency Standard: Unit of Competency:

Page: 60

ICT313331

Revision # ____

61

Computer Steps/Procedures: On your pc 1. Click start button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Choose and use a valid header file with appropriate syntax 6. Use the main function with appropriate syntax 7. Declare a valid & required variable with an integer data type 8. 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 theres an error detected, debug the code. Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Trainees Name: _______________________________ Date: __________________ CRITERIA 1. 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
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Yes

No

Page: 61

ICT313331

Revision # ____

62

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?

Demonstration & Questioning Programming NC IV Apply Programming Skills as a Second Language Type of Assessment Tool: Demonstration & Questioning Name:____________________________ Date:_____________________________ Title: Application or programs developed are tested and meets systems and/or user
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Competency Standard: Unit of Competency:

Page: 62

ICT313331

Revision # ____

63

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 button 2. Select and click all programs. 3. Select and click bloodshed 4. Select and click Dev C++ 5. Open you source code 6. Run your program 7. Test your program for errors 8. Explain the source codes Assessment Method: Performance Criteria Checklist

Performance Criteria Checklist Trainees Name: _______________________________ Date: __________________ CRITERIA


Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Yes
Document No. Issued by:

No
Page: 63

ICT313331

Revision # ____

64

1. 2. 3. 4. 5. 6. 7. 8.

Did the trainee found and click start button? Did the trainee found and click all programs? Did the trainee found and click bloodshed? Did the trainee found and click Dev C++ Compiler? Did the trainee open his/her own source code? Did the trainee successfully run his/her program? Did the trainee tests the program for errors? Did the trainee explain the source code?

Competency

Inventory of Tools PrintNon-print materials Materials BASIC


Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Tools

Equipments

Computer Systems Institute

Document No. Issued by:

Page: 64

ICT313331

Revision # ____

65

1. Utilize specialized communication skills 1.1. Apply communication CBLM Presentation strategies 1.2. Represent the CBLM organization in internal and external forums 2. Develop teams and individuals 2.1. Determine development CBLM needs 2.2. Foster individual and organizational growth 2.3. Monitor and evaluate workplace learning CBLM CBLM Presentation

Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond

Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector

Presentation Presentation Presentation

2.4. Development team CBLM Presentation commitment and cooperation 3. Apply problem solving techniques in the workplace 3.1. Analyze the problem CBLM Presentation 3.2. Identify individual and organizational growth 3.3. Determine possible solution 3.4. Prepare communication or documentation report 3.5. Present recommendation to appropriate personnel 3.6. Implement solution CBLM CBLM CBLM CBLM CBLM Presentation Presentation Presentation Presentation Presentation

Collect, analyze and organize information 4.1. Study information CBLM Presentation requirements
4.

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 65

Revision # ____

66

4.2. Process data 4.3. Analyse, interpret and organize information gathered 4.4. Present findings/recommendatio ns 5. Plan and organize work 5.1. Set work objectives 5.2. Plan and schedule work objectives 5.3. Implement and monitor plans/activities 5.4. Review and evaluate work plans and activities

CBLM CBLM CBLM

Presentation Presentation Presentation

Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon

Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector

CBLM CBLM CBLM CBLM

Presentation Presentation Presentation Presentation

6. Promote environmental protection 6.1. Study guidelines for CBLM environmental concerns 1. Apply Quality Standards 1.1. Assess quality of received materials 1.2. Assess own work 1.3. Engage in quality standards

Presentation

COMMON CBLM CBLM CBLM Presentation Presentation Presentation Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector
Page: 66

2. Operate a Personal Computer 2.1. Start and shut down the CBLM computer 2.2. Arrange and customize desktop display/window
Computer Systems Institute

Presentation Presentation

CBLM

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Revision # ____

67

settings 2.3. Work with files and folders(directories) 2.4. Work with user application programs 2.5. Print information

CBLM CBLM CBLM

Presentation Presentation Presentation

Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon

Computer & Projector Computer & Projector Computer & Projector

CORE
1. Design Program logic 1.1. Select the program logic design approach

CBLM CBLM CBLM

Presentation Presentation Presentation

Computer & ProjectorGB Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector
Page: 67

1.2. Document the program logic or design 1.3. Validate the design

2. Apply program development approach 2.1. Determine and select CBLM Presentation appropriate program development approach 2.2. Apply the selected CBLM Presentation development approach

Apply object-oriented program language skills 3.1. Apply basic CBLM Presentation language syntax and layout 3.2. Apply basic CBLM Presentation OOP principles in the target language 3.3. Debug code CBLM Presentation
3.

3.4. Document activities 3.5. Test Code


Computer Systems Institute

CBLM CBLM

Presentation Presentation

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Revision # ____

68

Bond Apply programming skills in a second language 4.1. Apply basic CBLM Presentation language syntax and layout 4.2. Code using CBLM Presentation standard algorithm
4.

4.3.

Debug code

CBLM CBLM CBLM

Presentation Presentation Presentation

4.4. Document activities 4.5. Test Code

Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond Ballpen Coupon Bond

Computer & Projector Computer & Projector Computer & Projector Computer & Projector Computer & Projector

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 68

Revision # ____

69

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, graphemelike 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.

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 69

Revision # ____

70

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. 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 computers memory that stores 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.
Computer Systems Institute Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo Document No. Issued by:

Page: 70

ICT313331

Revision # ____

71

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

Computer Systems Institute

ICT313331

Date Developed: February 15, 2012 Developed by: Jeffrey A. Esmundo

Document No. Issued by:

Page: 71

Revision # ____

Das könnte Ihnen auch gefallen