Design Program Logic 1
Design Program Logic 1
LESSON OBJECTIVE:
1. Identify Computer Programming.
2. Provide a set of debugging exercises in which the student examines a set of
pseudocode algorithms and identifies logical errors.
3. Perform programming exercises
VALUES INTEGRATION:
Integrity witnesses of faith, upholds our Claretian principle and lives a moral and dignified
life.
Excellence strives for perfection and holiness, pursues academic excellence in achieving
holistic transformation.
EXPLORE and EXPLAIN: Hardware, types of software, how Computers stores Data and
how Computer works
I. DEFINE THE FOLLOWING COMPONENTS OF COMPUTER SYSTEM.
A. Hardware- _________________________________________________________________________________
a) The central processing unit (CPU)__________________________________________________________
b) Main memory__________________________________________________________________________
c) Secondary storage devices_________________________________________________________________
d) Input devices___________________________________________________________________________
e) Output devices__________________________________________________________________________
B. software-___________________________________________________________________________________
C. Data-______________________________________________________________________________________
D. Prossecing-_________________________________________________________________________________
II. MATCHING TYPE: WRITE THE CORRECT COMPONENTS ON THE SIDE OF THE
GIVEN IMAGE TELL WETHER IF IT IS INPUT DEVICES, OUTPUT DEVICES, OR
STORAGE DEVICES
Computers can do such a wide variety of things because they can be programmed. This means
that computers are not designed to do just one job, but to do any job that their programs tell them
to do. A program is a set of instructions that a computer follows to perform a task. For example,
shows screens from two commonly used programs: Microsoft Word and PowerPoint.
Hardware
CONCEPT: The physical devices that a computer is made of are referred to as the computer’s
hardware. Most computer systems are made of similar hardware devices.
The CPU
When a computer is performing the tasks that a program tells it to do, we say that the computer is
running or executing the program. The central processing unit, or CPU, is the part of a computer
that actually runs programs. (The CPU is often referred to as the processor.) The CPU is the
most important component in a computer because without it, the computer could not run
software.
Today, CPUs are small chips known as microprocessors. Figure 1-4 shows a photo of a lab
technician holding a modern-day microprocessor. In addition to being much smaller than the old
electro-mechanical CPUs in early computers, microprocessors are also much more powerful.
Main Memory
You can think of main memory as the computer’s work area. This is where the computer stores a
program while the program is running, as well as the data that the program is working with. For
example, suppose you are using a word processing program to write an essay for one of your
classes. While you do this, both the word processing program and the essay are stored in main
memory.
Main memory is commonly known as random-access memory, or RAM. It is called this because
the CPU is able to quickly access data stored at any random location in RAM. RAM is usually a
volatile type of memory that is used only for temporary storage while a program is running.
When the computer is turned off, the contents of RAM are erased. Inside your computer, RAM is
stored in chips, similar to the
ones shown in Figure 1-5.
The most common type of secondary storage device is the disk drive. A traditional disk drive
stores data by magnetically encoding it onto a circular disk. Solid state drives, which store data
in solid-state memory, are increasingly becoming popular. A solid state
drive has no moving parts, and operates faster than a traditional disk drive. Most computers have
some sort of secondary storage device, either a traditional disk drive or a solid state drive,
mounted inside their case. External disk drives, which connect to one of the computer’s
communication ports, are also available. External disk drives can be used to create backup copies
of important data or to move data to another computer. In addition to external disk drives, many
types of devices have been created for copying data, and for moving it to other computers.
Universal Serial Bus drives, or USB drives, are small devices that plug into the computer’s USB
port, and appear to the system as a disk drive. These drives do not actually contain a disk,
however. They store data in a special type of memory known as flash memory. USB drives,
which are also known as memory sticks and flash drives, are inexpensive, reliable, and small
enough to be carried in your pocket. Optical devices such as the CD (compact disc) and the DVD
(digital versatile disc) are also used for data storage. Data is not recorded magnetically on an
optical disc, but is encoded as a series of pits on the disc surface. CD and DVD drives use a laser
to detect the pits and thus read the encoded data. Optical discs hold large amounts of data, and
because recordable CD and DVD drives are now commonplace, they are good mediums for
creating backup copies of data.
Input Devices
Input is any data the computer collects from people and from other devices. The component that
collects the data and sends it to the computer is called an input device. Common input devices
are the keyboard, mouse, touchscreen, scanner, microphone, and digital camera. Disk drives and
optical drives can also be considered input devices because programs and data are retrieved from
them and loaded into the computer’s memory.
Output Devices
Output is any data the computer produces for people or for other devices. It might be a sales
report, a list of names, or a graphic image. The data is sent to an output device, which formats
and presents it. Common output devices are video displays and printers. Disk drives and CD
recorders can also be considered output devices because the system sends data to them in order
to be saved.
Storing Numbers
A bit can be used in a very limited way to represent numbers. Depending on whether the bit is
turned on or off, it can represent one of two different values. In computer systems, a bit that is
turned off represents the number 0 and a bit that is turned on represents the number 1. This
corresponds perfectly to the binary numbering system. In the binary numbering system (or
binary, as it is usually called) all numeric values are written as sequences of 0s and 1s. Here is an
example of a number that is written in binary: 10011101 The position of each digit in a binary
number has a value assigned to it. Starting with the rightmost digit and moving left, the position
values are 20, 21, 22, 23, and so forth, as shown in Figure 1-8. Figure 1-9 shows the same
diagram with the position values calculated. Starting with the rightmost digit and moving left, the
position values are 1, 2, 4, 8, and so forth.
To determine the value of a binary number you simply add up the position values of all the 1s. For example, in the
binary number 10011101, the position values of the 1s are 1, 4, 8, 16, and 128. This is shown in Figure 1-10. The
sum of all of these position values is 157. So, the value of the binary number 10011101 is 157.
Figure 1-11 shows how you can picture the number 157
stored in a byte of memory. Each 1 is represented by a bit in
the on position, and each 0 is represented by a bit in the off
position.
When all of the bits in a byte are set to 0 (turned off), then the value of the byte is 0. When all of the bits
in a byte are set to 1 (turned on), then the byte holds the largest value that can be stored in it. The largest
value that can be stored in a byte is 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 = 255. This limit exists because
there are only eight bits in a byte. What if you need to store a number larger than 255? The answer is
simple: use more than one byte. For example, suppose we put two bytes together. That gives us 16 bits.
The position values of those 16 bits would be 20, 21, 22, 23, and so forth, up through 215. As shown
in Figure 1-12, the maximum value that can be stored in two bytes is 65,535. If you need to store a
number larger than this, then more bytes are necessary.
Storing Characters
Any piece of data that is stored in a computer’s memory must be stored as a binary number. That
includes characters, such as letters and punctuation marks. When a character is stored in
memory, it is first converted to a numeric code. The numeric code is
then stored in memory as a binary number. Over the years, different coding schemes have been
developed to represent characters in computer memory. Historically, the most important of these
coding schemes is ASCII, which stands for the American Standard Code for Information
Interchange. ASCII is a set of 128 numeric codes that represent the English letters, various
punctuation marks, and other characters. For example, the ASCII code for the uppercase letter A
is 65. When you type an uppercase A on your computer keyboard, the number 65 is stored in
memory (as a binary number, of course).
When a CPU executes the instructions in a program, it is engaged in a process that is known as
the fetch-decode-execute cycle. This cycle, which consists of three steps, is repeated for each
instruction in the program. The steps are:
1. Fetch A program is a long sequence of machine language instructions. The first step of
the cycle is to fetch, or read, the next instruction from memory into the CPU.
2. Decode A machine language instruction is a binary number that represents a command
that tells the CPU to perform an operation. In this step the CPU decodes the instruction
that was just fetched from memory, to determine which operation it should perform.
3. Execute The last step in the cycle is to execute, or perform, the operation.
A compiler is a
program that translates
a high-level language
program into a
separate machine
language program.
The machine
language program can
then be executed any
time it is needed.
programmer types a program’s code into a text editor and then saves the code in a file on the
computer’s disk. Next, the programmer uses a compiler to translate the code into a machine
language program, or an interpreter to translate and execute the code. If the code contains a
syntax error, however, it cannot be translated. A syntax error is a mistake such as a misspelled
Types of Software
CONCEPT: Programs generally fall into one of two categories: system software or application
software. System software is the set of programs that control or enhance the operation of a
computer. Application software makes a computer useful for everyday tasks.
System Software
The programs that control and manage the basic operations of a computer are generally referred
to as system software. System software typically includes the following types of programs:
Utility Programs. A utility program performs a specialized task that enhances the computer’s
operation or safeguards data. Examples of utility programs are virus scanners, file compression
programs, and data backup programs.
Software Development Tools. Software development tools are the programs that programmers
use to create, modify, and test software. Assemblers, compilers, and interpreters are examples of
programs that fall into this category
Application Software
Programs that make a computer useful for everyday tasks are known as application software.
These are the programs that people normally spend most of their time running on their
computers. Microsoft Word, a word processing program, and Microsoft PowerPoint, a
presentation program. Some other examples of application software are spreadsheet programs,
email programs, Web browsers, and game programs.
NAME:____________________________________________DATE: ____________________
GRADE and STRAND: _______________________________ OUTPUT NO: __________
EVALUATE:
Short Answer
_____________________________________________________________________________________________
5. What type of software controls the internal operations of the computer’s hardware?
______________________________________________________________________________