Download as pdf or txt
Download as pdf or txt
You are on page 1of 118

COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)

INSTRUCTION & LABORATORY MANUAL

Subject: COMP 1
Descriptive Title: Computer Fundamentals & Programming
Course Description:
The subject covers the fundamentals of a computer, its components,
Windows, and Visual BASIC Programming Languages. It deals with the
understanding of computer, its history, computer hardware, computer software
and the programming concept. The subject teaches the students how to make
programs Visual BASIC Programming Language properly and efficiently.
Credits: 3 units

General Objectives:
1. To establish the basic knowledge about computer, their history and actual
use needed in society
2. To recognize the importance of computer literacy.
3. To manipulate the computer
4. To develop programming skills in Visual Basic
5. To apply basic methods and techniques in software design

Contents
PART 1. COMPUTER FUNDAMENTALS
I. Introduction to Computers
II. Electronic Data Processing Systems
III. Input Devices
IV. Output Devices
V. System and Storage Units
VI. Computer Software
PART 2. PROGRAMMING
VII. Windows Desktop Familiarization
VIII. Introduction to Visual BASIC
IX. Methods and Event Procedures
X. Basic Elements of a Visual BASIC Program
XI. Decision Structures
PART 3. LABORATORY ACTIVITIES

Page 1 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER I
INTRODUCTION TO COMPUTERS
Guide Questions:
1. Do you believe that computers make life easier and better? Explain.
2. List down separately four uses of computers in the home and business.
3. If you were given a chance to become part of the computer history, what would
you contribute? Explain why or how.
4. Do you feel any discomfort or anxiety about computers? Explain why or why not.

Outcomes:
At the end of the Chapter, the students can:
☺ understand fundamental computer concepts
☺ realize the importance of computer literacy
☺ be familiar with the history of computer
☺ find out the reason for the development of computer
☺ name the persons who dedicated their studies in the development of
computers
Pre-Test:
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. The father of modern computer a) Bill Gates b) Carlos Cabbage c)
Charles Babbage d) Howard Aiken
____2. The word for raw material that is given to a computer for processing.
a) data b) information c) list d) output
____3. Apple Company was formed by
a) Gates and Allen b) Jobs and Wozniak c) Eckert & Mauchly
d) Bardeen and Shockley
____4. In 1997, IBM Deep Blue beats ________ in a full chess match
a) Karpov b) Kasparov c) Torre d) Yuri
____5. To place data/information into files a) Classifying b) Duplicating
c) Storing d) Retrieving

1.1. Introduction
A computer is a machine that performs tasks,
such as calculations or electronic communication,
under the control of a set of instructions called a
program. Programs usually reside within the
computer and are retrieved and processed by the
computer’s electronics. The program results are stored
in or routed to output devices, such as video display
monitors or printers. Computers perform a wide variety of activities reliably,
accurately, and quickly. Technically speaking it is an automatic high speed, electronic

Page 2 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

digital device with internal storage, and is controlled by a stored program - a self-
directing digital device because its operations are performed within the system
where it measures quantities in discrete or exact numbers.
People use computers in many ways. In business, computers track inventories
with bar codes and scanners, check the credit status of customers, and transfer
funds electronically. In homes, tiny computers embedded in the electronic circuitry
of most appliances control the indoor temperature, operate home security systems,
tell the time, and turn videocassette recorders (VCRs) on and off. Computers in
automobiles regulate the flow of fuel, thereby increasing gas mileage. Computers
also entertain, creating digitized sound on stereo systems or computer-animated
features from a digitally encoded laser disc. Computer programs, or applications,
exist to aid every level of education, from programs that teach simple addition or
sentence construction to programs that teach advanced calculus. Educators use
computers to track grades and communicate with students; with computer-
controlled projection units, they can add graphics, sound, and animation to their
communications. Computers are used extensively in scientific research to solve
mathematical problems, investigate complicated data, or model systems that are
too costly or impractical to build, such as testing the air flow around the next
generation of aircraft. The military employs computers in sophisticated
communications to encode and unscramble messages, and to keep track of
personnel and supplies.

1.2. Data Processing


Computers process data into information. Data processing is the manipulation
of data which uses a set of operations to transform data to produce meaningful
information that could be used by man in planning and decision-making. It is the
analysis and organization of data by the repeated use of one or more computer
programs. Data processing is used extensively in business, engineering, and science
and to an increasing extent in nearly all areas in which computers are used.
Businesses use data processing for such tasks as payroll preparation, accounting,
record keeping, inventory control, sales analysis, and the processing of bank and
credit card account statements. Engineers and scientists use data processing for a
wide variety of applications, including the processing of seismic data for oil and
mineral exploration, the analysis of new product designs, the processing of satellite
imagery, and the analysis of data from scientific experiments.
Data Processing Cycle
1. Input INPUT PROCESS OUTPUT
2. Processing
3. Output
4. Storage
STORAGE

1.3. Milestones in Computer History

Page 3 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

As early as 500 BC, people tried to make information


processing easier with the advent of tools for counting numbers.
The study of history can help to explain what can and cannot be
reasonably expected from technological developments. How
Fig.1

various computational devices affected past societies will undoubtedly


shed some light on how computers are likely to affect our society in
the future. Here, we will study the specific events and eras in an effort
to shed light on the historical period and to better understand how Fig.2
the computer evolved. We will learn from the people who
commenced these undertakings as a result of the innovation on
society in general. The following are the outline of what has
transpired in the past concerning the development of computers.
TIMELINE
500 B.C. The abacus. (Fig1) Fig.3

1614 John Napier discovers logarithms using his “BONES”. (Fig2)


1625 The Slide Rule by William Oughtred (Fig3)
1642 Pascaline – Blaise Pascal's adding machine(Fig4)
1671 Gottfried Leibniz’ "Stepped Reckoner"(Fig5)
1822 Charles Babbage's first mechanical computer(Fig6) Fig.4
1832 1833 Augusta Ada Byron, the first programmer.
1834 Babbage's "Analytical Engine". (Fig6)
1890 Herman Hollerith’s punched cards machine was used to
record data of US Census. (Fig7)
1924 IBM( International Business Machines) was formed
1937 British mathematician Alan Turing develops the Turing Fig.5

Machine called Colossus that processed equation to


break German Codes and earned him the title “father of
computer science”. (Fig8)

1943 Harvard Professor Howard Aiken & IBM develops


Mark I (Automatic Sequence Controlled Calculator) Fig.6

(Fig9)
1945 John Von Neumann developed an electronic
computer at the IAS that uses a stored program
concept. (Fig10)
1946 John P. Eckert Jr& John W. Mauchly designs the

ENIAC. (Fig11)
1947 Invention of the Transistor by John Bardeen, Walter Brattain,
William Shockley at Bell Telephone Laboratories. (Fig12) Vacuum Tube
1951 Grace Murray Hopper invented the High level language
compiler.

Page 4 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

1951 UNIVAC-1 (UNIVersal Automatic Computer)- the first


commercially successful electronic computer(Fig13)
1954 FORTRAN(Formula Translator)
1958 Jack Kilby of Texas Instruments invents the integrated
circuit (Fig14)
1959 -1961 COBOL, ALGOL, LISP, and APL Programming
Languages Fig.7

1964 John Kemeny of Dartmouth leads the development


of the BASIC programming language. (Fig15)
1964 -1973 PL/1, LOGO, PILOT, FORTH, PASCAL, C,
Prolog Programming Languages
1965 Digital Equipment Corporation (DEC) introduces the
first mini-computer, the PDP-8. Fig.8

(Fig16)
1970 Development of UNIX , LSI chips.
(Fig17)
Fig.9
1971 First microprocessor was made, the
Intel 4004 , Dr. Ted Hoff. (Fig18)
1972 Atari founded
1974 MITS, Inc. developed the Altair, the first personal
computer. (Fig19)
1975 BASIC implemented by Bill Gates and Paul Allen

Fig.10

Fig.12
Fig.14

Fig.11 Fig.18

Fig.15 Fig.16
Fig.17
Fig.19
Fig.13

Page 5 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

1975 Bill Gates and Paul Allen form Microsoft


1976 Apple Computer Inc. founded by Steven Jobs
and Stephen Wozniak to Market Apple II
(Fig20)
1979 -1980 ADA, Modula-2 Programming Apple 1
Languages Fig.20

1984 MS-DOS was released Fig.21


by Microsoft Fig.23
1984 Hewlett-Packard
announces the first LaserJet printer for
Fig.24 Fig.22
personal computers. (Fig21)
1985 Microsoft Windows launched
1989 World Wide Web invented by Tim Berners-
Fig.25
Lee .(Fig22)
Fig.26
1994 Jim Clark and Marc Andreessen found
Netscape and launch Netscape Navigator Fig.27
1.0, a browser for the World Wide Web.
(Fig23)
1994 Linus Torvalds creates the Linux kernel (Fig24) Fig.28
1995 Microsoft Windows 95(Fig25)
1995 Sun Microsystems launches Java. (Fig26)
1997 Microsoft releases Internet Explorer 4 (Fig27)
1997 IBM's Deep Blue, the first computer to beat a reigning World Chess
Champion, Gary Kasparov, in a six-game chess match. (Fig28)
1997 Intel Pentium II released
Fig.29
1998 Microsoft Windows '98. (Fig29) Fig.30
1999 Apple Computer introduces the iMac (Fig30)
1999 Intel Pentium III released
2000 Official launch of Microsoft Windows 2000
2000 AMD releases the Athlon 1GHz.
2001 Apple released MacOS X
2001 Microsoft releases Windows XP Fig.31
2001 Release of the `X' Box - Microsoft's games console
2002 Intel released Pentium IV. (Fig31)
2002 Microsoft launches its .NET strategy. (Fig32) Fig.33
2002 Digital video cameras, DVD writers, easy-to-use video editing software,
and improvements in storage capabilities allow the average computer
user to create Hollywood-like videos with introductions, conclusions,
scenes rearranged, music, and voice-over. (Fig33)

Fig.38Page 6 of 118
Fig.34 Fig.35 Fig.36 Fig.37
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Fig.39

2003 Wireless computers and devices, such as keyboards, mouse


devices, home networks, and public Internet access points Fig.40
become commonplace. Latest operating systems include
support for both the Wi-Fi (wireless fidelity) and Bluetooth Fig.41
standards. (Fig34)
2004 Flat-panel LCD monitors overtake bulky CRT monitors (Fig35)
2004 USB Flash Drives become a cost-effective way to transport
data and information from one computer to another. (Fig36)
2004 Apple Computer introduces the sleek iMac G5. The new
computer’s display device contains the system unit. (Fig37) Fig.42

Facebook, an online social network originally


available only to college students, is founded.
Facebook eventually opens registration to all people
and immediately grows to more than 110 million
users with more than 10 billion photos, 30 million of
which are uploaded daily.
2005 The Mozilla Foundation, the creators of the free open
source Firefox browser, predicts that by the end of 2005,
it will have 10 percent of the browser market, primarily at
the expense of Microsoft’s Internet Explorer (IE) security-
plagued browser. (Fig38)
2005 Microsoft unveils Windows XP Media Center Edition 2005.
This operating system allows users to access the
routine capabilities of a Windows XP-based PC while
focusing on delivering media content such as music,
digital photography, movies, and television. (Fig39 & 40)
2005 Microsoft introduces Visual Studio 2005. The product includes
Visual Basic, Visual C#, Visual J#, Visual C++, and SQL Server.
Microsoft also releases a Visual Studio 2005 Express Edition for
hobbyists, students, and nonprofessionals.
2005 The smart phone overtakes the PDA as the personal mobile device of
choice. (Fig41)
2005 YouTube, an online community for video sharing, is founded. YouTube
includes content such as home videos, movie previews, and clips from
television shows. In November 2006, Google acquires YouTube.
The OQO handheld computer is a fully-functional Windows XP computer
with desktop capabilities. Just 4.9 inches long, 3.4 inches wide, .9 inch
thick, and weighing only 14 ounces, the OQO fills the void between the

Page 7 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

bulk and awkwardness of a notebook computer and the limited


capability of a smart phone or PDA. (Fig42)
2006 Release of Windows VISTA. (Fig43)
Intel introduces its Core 2 Duo processor family. Boasting record-
breaking performance while using less power, the family consists
of five desktop computer processors and five mobile computer
processors. The desktop processor includes 291 million
transistors, yet uses 40 percent less power than the Pentium
processor
2009 Release of Windows 7.
Intel releases the Core i5 and Core i7 line of processors. These processors
offer increased performance for some of the more
demanding tasks. Intel also enhances its Core processor
family by releasing multi-core processors, designed to
increase the number of instructions that can be processed
at a given time
2010 Apple introduces the iPad
Intel purchases McAfee
Instagram is launched.
Microsoft releases Internet Explorer 9
Google+ is made available for invite only
2012 Pinterest is made available to everyone
The deal between Facebook and Instagram for
one billion dollars is finalized
Apple iPhone 5 goes on sale
Microsoft Windows 8 and Microsoft Surface is
released
Apple introduces iOS7
Microsoft releases Windows 8.1
2014 Satya Nadella takes over as Microsoft CEO.
Sony announces it will sell PC business to Japanese investment firm
February 6, 2014.
Apple iPhone 6 goes on sale

Page 8 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Post Test.
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. The first microprocessor.
a) Athlon 64 b) Intel Pentium D c) Intel 4004 c) Intel 486
____2. In which of the following areas do you think will the use of computers not be
imperative? a) Law enforcement b) Health and Medicine c) Robots d) None of
the above.
____3. Which of the following device is the most outdated?
a) ABACUS b) APPLE PC c) ENIAC d) PASCALINE
____4. Which of the following is an input device?
a) keyboard b) mouse c) joystick d) all of the above
____5. Which of the following is not a computer.
a) Calculator b) Desktop PC c) Internet Server d) Typewriter
____6. Who was named as the “First Programmer”
a) Ada Byron b) Bill Gates c) George Boole d) George Bush
____7. The first personal computer
a) Altair b) Apple1 c) INTEL 4004 d) Pentium MMX
____8. The first laser printer was developed by
a) AMD b) Apple c) IBM d) HP
____9. The father of Computer Science
a) Alan Turing b) Bill Gates c) Blaise Pascal d) Steven Jobs
____10. Founders of Microsoft
a) Gates and Allen b) Jobs and Wozniak c) Eckert & Mauchly d) Bardeen
and Shockley

Page 9 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER II
ELECTRONIC DATA PROCESSING SYS TEMS
Guide Questions:
1. What are the elements of a computer system? List down at least 3 examples of
each.
2. Differentiate hardware from software.
3. List at least 3 characteristics that make computers indispensable. Explain why.
4. How do you think will the end-user revolution affect the computer industry?
5. Name at least 2 examples of computers according to size.

Outcomes:
At the end of the Chapter, the students can:
☺ recognize the advantages of electronic data processing systems
☺ understand the limitations and failures of computers
☺ differentiate the classifications of computers
☺ distinguish the elements of the computer system
☺ classify computers according to their use
Pre-Test:
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. A microsecond is equal to ________ of a second. a) 1/10 b) 1/1000 c) 1/10000
d) 1/1000000
____2. The physical component of EDP systems a) firmware b) hardware c) peopleware
d) software
____3. Components of third generation computers that makes the computer smaller
and faster: a) integrated circuits b) resistors c) transistors d) vacuum
tubes
____4. Which of the following is the fastest? a) mainframes b) microcomputers
c) minicomputers d) supercomputers
____5. Which of the following is a hardware? a) DOS b) Mouse c) programmer
d) Windows

2.1. Introduction
All through the different stages of civilization, man has tried to look for
ways to simplify work and to solve problems more efficiently. Many problems
involved numbers and quantities, so man started looking for easier ways to
count, and to add, subtract, multiply, and divide then invent the necessary tools
and the rest became history. After electricity powered these tools, then the
electronic data processing (EDP) system or simply the computer system was
realized. Computers exist in a wide range of sizes and power. The smallest are
embedded within the circuitry of appliances, such as televisions and
wristwatches. These computers are typically preprogrammed for a specific task,

Page 10 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

such as tuning to a particular television frequency, delivering doses of medicine,


or keeping accurate time. They generally are “hard-wired”—that is, their
programs are represented as circuits that cannot be reprogrammed.
Programmable computers vary enormously in their computational power, speed,
memory, and physical size.
2.2. Components of a Computer
1. Input devices – any hardware component that allows you to enter data and
instructions into a computer. Six widely used input devices are the keyboard,
mouse, microphone, scanner, digital camera, and PC video camera.
2. Output devices – any hardware component that conveys information to one
or more people. Three commonly used output devices are a printer, a
monitor, and speakers.
3. System Unit – usually referred to as the central processing Unit. The system
unit is a case that contains the electronic components of the computer that
are used to process data. The circuitry of the system unit usually is part of or
is connected to a circuit board called the motherboard. Two main
components on the motherboard are the processor and memory.
4. Storage Devices – storage holds data, instructions, and information for
future use. A computer keeps them on storage media. Examples are floppy
disks, ZIP disks, USB flash drives, hard disks, CD’s, DVD’s and memory cards.
5. Communication Devices – a hardware component that enables a computer
to send(transmit) and receive data, instructions, and information to and from
one or more computers. A widely used communication device is a modem.

Input
Process Output

Storage

2.3. Categories of Computers


 Personal Computer. A computer that can perform all of its input,
processing, output, and storage activities by itself. A personal computer
contains a processor, memory, and one or more input, output, and
storage devices. Two popular styles of personal computers are the PC-
compatible and the Apple. Most PC-compatible computers usually use a
Windows operating system. Apple computers use a Macintosh
operating system. Two types of personal computers are  Desktop
Computers and  Notebook Computers. A special type of notebook computer

Page 11 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

is a  Tablet PC, using a digital pen, it allows you to write or draw on the
screen and would issue instructions to the PC by simply tapping the screen.
Smaller than the laptop computers are called the mobile devices. Four popular
types of mobile devices are handheld computers, PDA’s, smart phones, and
smart watches.

Desktop
Notebook Tablet PC
 Handheld computers. Sometimes called a handtop computer, is a
computer small enough to fit in one hand. Its capable of communicating
with other handheld computers wirelessly and includes a digital pen or
stylus for input.
 PDA(Personal Digital Assistant). One of the more popular lightweight
mobile devices in use today. It provides personal organizer functions such
as a calendar, appointment book, address book, calculator, notepad,
word processing, spreadsheet, personal finance, and games. Many PDA’s
are internet-enabled, supports voice input and provides telephone
capabilities.
 Smart Phone. Offering the convenience of one-handed operation, a
smart phone is an internet-enabled telephone that usually also provides
PDA capabilities, color screens, play music, radio capable, and include
built-in cameras so you can share photographs or videos with others as
soon as you capture the image.
 Smart Watch. An internet-enabled watch. In addition to
basic timekeeping capabilities, a smart watch
automatically adjusts to time zone changes, store personal
messages, appointment reminder, wirelessly accesses
news, weather, sports and stocks.

Midrange Server
 Midrange Servers. More powerful and larger than a
workstation computer. It typically supports several hundred
and sometimes up to few thousand connected computers at
the same time. Used to store data and programs where in
most cases another server or a personal computer is used
access these stored data.

 Mainframes. A large, expensive, powerful computer that can Mainframe


handle hundreds or thousands of connected users
simultaneously. Every major corporation uses mainframes for business

Page 12 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

activities like billing of million of customers, prepare payroll for thousands of


employees, and manage thousands of items in inventory.

 Supercomputers. The fastest, most powerful computer- and the most


expensive. Capable of processing more than 100 trillion instructions in a single
second. Weighs more than 100 tons, these computers can store more than
20,000 times the data and information of an average desktop computer.
Applications requiring complex, sophisticated mathematical calculations use
supercomputers. Large scale simulations and applications in medicine,
aerospace, automotive design, online banking, weather forecasting, nuclear
energy research, and petroleum exploration use a supercomputer.

Supercomputer

 Embedded Computers. A special-purpose computer that functions as a


component in a larger product. They are everywhere – at home, in your car,
and at work. It could be found in the ff.: Consumer Electronics( mobile and
digital telephones, digital televisions, cameras, video recorders, came consoles,
DVD players and recorders, answering machines, etc..), Home Automation
Devices and Appliances( thermostats, sprinkling systems, security monitoring
system, microwave ovens, washing machines, etc..), Automobiles ( Antilock
brakes, engine control modules, airbag controller, cruise control, etc..), Process
Controllers and Robotics(remote monitoring systems, power monitors,
machine controllers, medical devices, etc..), Computer Devices and Office
Machines(keyboards, printers, faxes, copiers, etc.)

2.4. Advantages of Using Computers


1. Speed. By now it is human nature to be resentful if service is not fast. But it is
“computer nature that provides that fast service. The speed of a computer
also makes the machine ideal for processing large amounts of data, as in
accounting systems and scientific application. A medium-scale computer, for
example can perform 500,000 additions in a second; that is, one every two-
millionths of a second. Speed of operation of a computer is thus measured in
microseconds or even in nanoseconds.
2. Accuracy. With the computer program narrowly defined, computers are
extremely reliable or even considered 100% accurate. Of course, you might
not think this from the way stories about “computer mistakes”, but in reality,

Page 13 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

the mistakes were not the fault of the computers themselves. It is true that
there are sometimes equipment failures, but most errors supposedly made
by the computers are “human errors”.
3. Automatic Operation. A computer can carry out a sequence of many data
processing operations without human intervention. The various operations
are executed automatically by way of a stored computer program.
4. Decision Making Capability. A computer can perform certain decision
instructions automatically. It can determine whether a certain statement is
true or false, or could even determine the course of action out of alternatives
included in the computer program.
5. Compact Storage. Computer systems are able to store tremendous amounts
of data, which can be retrieved quickly and efficiently.
6. Communications. Most computers today can communicate with other
computers, often wirelessly. Computers with this capability can share any of
the four information processing cycle operations – input, process, output,
and storage- with another computer or user.

2.5 Disadvantages of Using Computers


1. Violation of Privacy. There are instances that confidential and personal
records stored in a computer is not properly protected. Some individuals
have found their privacy violated and identities stolen.
2. Impact on Labor Force. With hundred of thousand of new computer jobs
offers, skills of millions of employees have been replaced by computers. A
separate impact on the labor force is that some companies are outsourcing
jobs to foreign countries instead of keeping their homeland labor force
employed.
3. Health Risk. Prolonged or improper computer use can lead to injuries or
disorder of the hands, wrists, elbows, eyes, neck, and back.
4. Impact on Environment. Computer manufacturing processes and computer
waste are depleting natural resources and polluting the environment. When
computers are discarded in landfills, they release toxic materials and
potentially dangerous levels of lead, mercury, and flame retardants.
2.6. Computer Limitations and Failures
COMPUTER LIMITATIONS
1. Dependent on programs and/or instructions
2. Cannot derive meanings from objects
3. Cannot by itself generate information
4. Cannot correct wrong instructions
COMPUTER FAILURES
1. Input errors
2. Errors in instructing a computer
3. The communication gap

Page 14 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

4. Improper Controls
5. Lack of standard
6. Lack of adequate manufacturer support
2.7. Elements of Computer System
1. Hardware. These are equipment involved in the function of a computer.
Computer hardware consists of the components that can be physically
handled. The function of these components is typically divided into four main
categories: input, processing, output, and storage. Components in these
categories connect to microprocessors, specifically, the computer's central
processing unit (CPU), the electronic circuitry that provides the computational
ability and control of the computer. Although microprocessors are still
technically considered to be hardware, portions of their function are also
associated with computer software.
2. Software. These are set of instructions a computer uses to manipulate data,
such as a word-processing program or a video game, also computer
instructions that cause the hardware—the machines—to do work. Software as
a whole can be divided into a number of categories based on the types of work
done by programs. These programs are usually stored and transferred via the
computer's hardware to and from the CPU. Software also governs how the
hardware is utilized; for example, how information is retrieved from a storage
device.
3. People. The term “peopleware” represents the personnel involved in the
function of the computer. Computer professionals are referred to as those
persons involved in system analysis, maintenance, production, programming,
and the like. Computer users that utilize an existing computer using a program
are termed as end-users.

Page 15 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Post-Test.
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. The cause/s of computer anxiety: a) age b) communication gap c) improper
controls
d) all of the above
____2. In electronic data processing, a computer is considered to be _____ accurate.
a) 20% b) 50% c) 75% d) 100%
____3. A PDA is a _______: a) Microcomputer b) Minicomputer c) Mainframe d)
Supercomputer
____4. GIGO means _______ a) Go-In, Go-Out b) Garbage-In, Garbage-Out c) Go-
Input, Go-Output d) Get-In, Get-Out
____5. In electronic data processing, _____ are the physical elements. a) Firmware
b) Hardware c) Peopleware d) Software
____6. Which is not a computer classification? a) maxicomputer b)
microcomputer c) minicomputer c) mainframe
____7. Which is not a computer limitation? a) Dependent on programs and/or
instructions
b) Cannot by itself generate information c) Cannot correct wrong
instructions d) none of the above
____8. How many Hz are there in 2.6 GHz? a) 2.6 b) 2,600 c) 2,600,000
d) 2,600,000,000
____9. Which of the following is not an advantage of a computer?
a) accuracy b) compact storage c) sensitive d) speed
____10. The computer to which a user’s computer connects to access the Internet:
a) server b) supercomputer c) notebook d) PDA

Page 16 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER III
INPUT DEVICES
Guide Questions:
1. What is Input?
2. How do pointing devices work?
3. What are various types of scanners and reading devices, and how do they work?
4. List down the benefits of source data automation devices.
5. What are biometric devices?

Outcomes:
At the end of the Chapter, the students can:
☺ define input
☺ differentiate the common computer input devices and peripherals
☺ list down the characteristics of a keyboard
☺ summarize how various pointing device work, and
☺ discuss various scanners and reading devices and how they work.

Pre-Test:
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. Which of the following is not an input device a) mouse b) OMR c) RAM
d) Scanner
____2. Which of the following is not a source data automation device?
a) MICR b) OCR c) OMR d) touch screen
____3. A series of instructions that tells a computer what to do and how to do it is
called a ____. a. program b. command c. user response d. processor
____4. Pressing the ____ key displays the Windows Start menu. a. APPLICATION b.
NUM LOCK c. WINDOWS d. ALT
____5. The process of transferring copies of the images from the digital camera to the
computers' hard disk is called ____. a. fetching b. uploading c. pulling
d. downloading

3.1. Introduction
Input is any data and instruction entered into the memory of the computer.
Data as input is a collection of unprocessed text, numbers, images, audio, and
video. An input device is any hardware component that allows users to enter
data and instruction from the user to the computer. Input in this category
includes bar codes, speech that enters the computer through a microphone and
data entered by means of a device that converts motion to on-screen action.

Page 17 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

3.2. Computer Keyboard


It is a keypad device with buttons or keys that a user presses
to enter data characters and commands into a computer.
Keyboards emerged from the combination of typewriter and
computer-terminal technology. The most common English-language key pattern
for keyboards is called QWERTY, after the layout of the first six letters in the top
row of its keys (from left to right). In the late 1860s, American
inventor and printer Christopher Sholes created the QWERTY
keyboard layout by separating commonly used letters so that typists
would type slower and not jam their mechanical typewriters. Not all
keyboards are the same. A fast-food store for example, uses Mouse
keyboards whose keys represent items such as Large Fries, or a Big ball
Mac.
3.3. Pointing Devices
A pointing device is an input device that allows a user to control a
pointer on the screen. Trackball

0 Mouse – A pointing device that fits under the palm of your hand
comfortably. The mouse is the most widely used pointing device on
desktop computer. The rolling movement causes a corresponding
movement of the pointer on the screen. Moving the mouse and then stick Touchpad
clicking it at the desired location on the screen allows you to
reposition the pointer, or the cursor. The process of
communicating with the computer by clicking on the objects on
the desktop is referred to as graphical user interfacing. Light pen
Types of mouse
1. Mechanical mouse - has a rubber ball on its underside.
2. Optical mouse – uses a device that emits and sense light to
detect the mouse’s movement. Some uses optical
sensors, others use a laser.
0 Trackball – an upside-down mechanical mouse where you roll
the ball directly with your hand. Often built in on portable
computers when there is no flat surface to roll the traditional
mouse. A variation of this theme is the track pad, with
your finger as the pointer.
0 Touchpad – a small, flat, rectangular pointing device
that is sensitive to pressure and motion. To move the
pointer using a touchpad, slide your fingertip across the
surface of the pad.
0 Pointing Stick – a pressure-sensitive pointing device
shaped like a pencil eraser that is positioned between keys on a keyboard. To
move the pointer, you push the pointing stick with a finger, the pointer on the
screen moves in the direction you push the pointing stick.

Page 18 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

0 Light Pen – a handheld input device that can detect the presence of light.
Some light pens requires a specially designed monitors while others work with
a standard monitor. To select objects on the screen, a user presses the light
pen against the surface of the screen or points the light pen at the screen and
then presses a button on the pen.
0 Touch Screen and Touch Sensitive Pads – a touch-sensitive
display device. Users can interact with these devices by
touching areas of the screen. The edges of a touch screen emit
horizontal and vertical beams of light that crisscross the
screen. When a finger touches the screen, the interrupted
light beams can pinpoint the location selected on the screen.

0 Pen Input – mobile users often enter data and instructions with a pen-type
device. With pen input, users write, draw, and tap on a flat surface to enter
input. The surface may be a monitor, a screen, or a special type of paper. Two
devices for pen input are the stylus and digital pen. A stylus is a small metal or
plastic device that uses pressure instead of ink. A digital pen is slightly larger
than a stylus, some are pressure-sensitive; others have built-in digital cameras.

stylus

digital pen

digitizer

Digitizer– An image whether a drawing or a photo- can be scanned by a


digitizer which converts the image into digital data that the computer can
accept and represent on the screen. A digitizing tablet lets you create
your own images. This device includes a digital pen that can be used to
draw or trace images, which are converted to digital data that can be
processed by the computer.
3.4. Voice Input
As an alternative to using a
keyboard to enter data and
instructions, some users talk to their
computer and watch the spoken
words appear on the screen as they
talk.

0 Voice Input – the process of entering


input by speaking into a microphone. Voice Input
Speech Recognition is a computers capability

Page 19 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

to accepts the spoken word through a microphone and converts it into binary
code(0s and 1s) that can be understood by the computer. Typical users are the
disabled, those with “busy hands” or hands too dirty for the keyboard, and
those with no access to a keyboard.
0 Audio Input. Voice input is part of a larger category of input
called audio input. Audio input is the process of entering any
sound into the computer such as speech, music, and sound
effects. Users enter sound into a computer via devices such
as microphones, tape players, CD/DVD players, or radios, DV Camera
each of which plugs in a port on the sound card.
3.5. Video Input
The process of capturing full-motion images and storing them on a
computer’s storage medium such as hard disk or DVD.

0 Digital Video (DV) Camera. Captures and records video digital signals. Most DV
cameras can capture still frames, as well as motion.
0 PC Video Camera – a type of digital video camera that enables a
home or small business user to capture video and still images, send e-
mail messages with video attachments, add live images to instant
messages, broadcast live images over the Internet, and make video telephone
calls.
Web Cam – any video camera that displays its output on a web page. A Web
cam attracts web site visitors by showing images that change regularly.
Video Conferencing – A video conference is a meeting between two or more
geographically separated people who use a network or the internet to
transmit audio and video data. To participate in a video conference, you
need a video conferencing software along with a microphone, speakers,
and video camera attached to a computer.

Page 20 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

3.6. Scanners And Reading Devices


Some input devices save users time by eliminating
manual data entry. With these devices, users do not type,
speak, or write into the computer.
Source Data Automation – the use of special equipment Flatbed Scanner
to collect data at the source, as a by-product of the
activity that generates the data, and sends it directly
to the computer. The following are examples:
OPTICAL SCANNERS
0 Scanner – converts text, drawing or picture into a Sheet Fed Scanner
computer. Optical recognition system use a light beam to scan
input data and convert it to electrical signals, which are sent to
the computer for processing.
 Flatbed scanner – typically scans one sheet at a time. Can be
used to scan bound documents, such as pages from books and
other bulky items. Handheld Scanner

 Sheet-fed scanner –motorized rollers feed the sheet across the


scanning head. Smaller in size compared to a flatbed scanner, it
could fit neatly between the keyboard and the monitor.
 Handheld scanner – an inexpensive, handy and portable option for
scanning but is difficult to use since a good scan can only be
attained when the user moves the scanner in a straight line at a
fixed rate.
ABCDEFGHIJKLMN
 Drum scanner- a very expensive type of scanners used by OPQRSTUVWXYZ12
34567890!@#$%^
publishing companies used to scan large size photographs,
&*()_+<>,.?:”
slides, negatives and single page documents.
OCR-A typeface

OPTICAL READERS
An optical reader is a device that uses a light source to read characters,
marks, and codes and then converts them into digital data that a
computer can process.
Wand Reader
0 Optical Mark Recognition(OMR) – a technology that reads
hand-drawn marks such as small circles or rectangles. RFID tags

OMR devices are sometimes called mark sensing device,


because a it senses marks on a piece of paper like test
questionnaires or blackened areas.
0 Optical Character Recognition (OCR) – OCR devices uses a
light source to read special characters and convert them
to electrical signals to be sent to the central processing
unit. The characters-letters, numbers, and special
characters – can be read by both humans and machines.
They are often found on sales tags on store Magnetic stripe
Magstripe reader

Page 21 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

merchandize. A standard typeface for optical characters, called OCR-A, was


established by the American National Standard Institute. A wand reader is a
popular input device for reading OCR-A.
0 RFID Reader – Radio frequency identification is a technology that uses radio
signals to communicate with a tag containing a memory chip and an antenna
placed in or attached to an object, animal or person. RFID reader mounted in
a stationary object such as doorway reads information on the tag via radio
waves.
0 Magnetic Stripe Card Reader. Often called magstripe reader, reads the
magnetic stripe on the back of credit cards, bank cards, and other similar
cards.
0 Magnetic-Ink Character Recognition – MICR involves a machine to read
characters made up of magnetized particles. The most common example of
magnetic characters is the array of numbers found across the bottom of a
personal check. These characters are embedded on the check by using a
MICR Inscriber.

MICR Reader

0 Bar Code Reader – Also called a bar code scanner. Each product on Bar Code

the store shelf has its own unique number, which is part of the
Universal Product Code(UPC). This code number is represented on
the product label by a pattern of vertical
marks, or bars, called the bar code. These
zebra stripes can be sensed and read by a bar
code reader, a photoelectric device that reads 2D Bar Code

the code by means of reflected light. Bar Code Readers


3.7. Digital Cameras

Allows users to take pictures and store the


photographed image digitally. Digital cameras typically
allow users to review, and sometimes edit, images while
they are in the camera. Some digital cameras can connect
to or communicate wirelessly with a printer, computer or
Digital Camera
television, allowing users to print or view images directly

Page 22 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

from the camera. Often users prefer to download, or


transfer a copy of the images from the digital camera to the
computer’s hard disk using a USB port or a FireWire port.
3.8. Biometric Input
Biometrics is the technology of authenticating a person’s identify by
verifying a person’s characteristics. A biometric identifier physiological or
behavioral characteristics, examples are fingerprints, hand geometry,
facial features, voice, signatures and eye pattern. Biometric devices vary
from different recognition systems used today. The most widely used
biometric scanner is a fingerprint scanner.

Face Recognition System. Captures a live face image and


compares it with a stored image to determine if the person is a
legitimate user.

Hand Geometry System. Measures the shape and size of a person’s hand.

Voice Verification System. Compares a person’s live speech


with their stored voice pattern.

Signature Verification System. Recognizes the shape of your handwritten


signature, as well as measures the pressure exerted and the motion used to
write the signature. It uses a specialized pen and tablet.

Iris Recognition System. A camera is used to read pattern in the iris of the eye.
This type of recognition system are quite expensive and are used by
government security organizations, the military, and financial institutions that
deal with highly sensitive data.

Page 23 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Post-Test
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. A bar code reader is an example of: a) processing device b) input device
c) storage device d) output device
____2. A(n) ____ is a key that switches between two letter case states each time a user
presses the key. a. function key b. toggle key c. Shift key d. ALT key
____3. The technology that involves reading typewritten, computer-printed, or hand
printed characters from ordinary documents and translating the images into a
form the computer can process is called ____. a. OCR b. MICR c. UPC
d. OMR
____4. An input device that translates the motion of a ball rolled on a flat surface to the
screen is a: a) bar code reader b) keyboard c) mouse c) wand reader
____5. The ____ mouse operation will display a shortcut menu. a. click b. right-click
c. double-click d. triple-click
____6. To transfer recorded images to a hard disk or CD or DVD, users connect DV
cameras directly to a USB port or a ____ port on the system unit. a. FireWire
b. serial c. parallel d. SCSI
____7. High security areas use ____. a. fingerprint scanners b. hair recognition
systems c. iris recognition systems d. signature verification systems
____8. A mouse with a rubber or metal ball on its underside is called a(n) ____.
a. optical mouse b. mechanical mouse c. trackball d. cordless mouse
____9. Tablet PCs use a pressure-sensitive ____. a. digital pen b. trackball c.
touchpad d. pointing stick
____10. ____ scanners are very expensive and are often used in the publishing
industry. a. Flatbed b. Drum c. Pen or handheld d. Sheet-fed

Page 24 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER IV
OUTPUT DEVICES
Guide Questions:
1. What are the four categories of Output?
2. What are LCD monitors, LCD screens, Plasma monitors and HDTVs?
3. What are the advantages of non-impact printers? What are the advantages of
impact printers?
4. What are softcopy outputs?
5. Imagine that you are buying a personal computer. What output device would
you choose and why?

Outcomes:
At the end of the Chapter, the students can:
☺ describe the four categories of output
☺ explain the relationship of graphic chips and monitors
☺ differentiate between a non-impact printer and an impact printer
☺ recognize the terminologies used in identifying computer monitor
specifications
☺ describe various ways to print

Pre-Test:
Multiple Choice. Write the capital letter of your answer on the space provided.
_____1. Individually illuminated dots on a cathode ray tube or a liquid crystal
display device: a) bit b) digit c) pixel d) resolution
_____2. Speakers and ____ are two commonly used audio output devices.
a. woofers b. microphones c. headsets d. monitors
_____3. Laser printers use a powdered ink called ____. a. wax b. toner c. dye d.
pigment
_____4. ___ printing devices transmit output to a printer via radio waves. a.
Infrared b. Laser c. Bluetooth d. Large-format
_____5. Any hardware component that conveys information
to one or more people is considered a(n) ____
device. a. output b. storage c. communications
d. input
4.1. Introduction
Output is data that has been processed into a Plasma Monitors
useful form. A computer generates several types of
output depending on the hardware and software being
used and the requirements of the user. A user
encounters four basic categories of output: text,
graphics, audio, and video. Output hardware consists of
external devices that transfer information from the
LCD Monitors

Page 25 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

computer's CPU to the computer user. A video display, or screen,


converts information generated by the computer into visual
information..
4.2. Display Devices
0 Flat Panel Displays
 LCD Monitors and Screens. Also called a flat panel HDTV

monitors that have gained popularity by reducing the footprint the


monitor takes up, displays visual information on a
flatter and smaller screen than a CRT-based video
monitor and consumes less electricity. A liquid
crystal display uses a liquid compound to present
information on a display device.

 Plasma monitors - the "hang on the wall"


monitors that vary in size from 34" to 61". These CRT Monitors
monitors are 3" to 5" deep and most are set up to take regular video as
well as computer sources. It uses a gas plasma
technology, which sandwiches a layer of gas between
two glass plates. Plasma monitors offer larger screen
sizes and higher display quality than LCD monitors but
are more expensive. Data Projector

 Televisions and HDTVs - Home users sometimes


use their television as a display device.
Connecting a computer to an analog television
requires a converter that translates the digital
signal from the computer to an analog signal
Rear Projection Screens
that the television can display. HDTV (High-
definition television) is the most advance form
of digital television, working with digital
broadcast signals, transmitting digital sound,
supporting wide screens, and provides a high
resolution of up to
1920 x 1080 pixels.
Smart Boards

0 CRT (Cathode Ray Tube) Monitors. The standard television


like monitor most computers have used for the past decade
consists of an electron tube, or evacuated glass container,
having at one end a cathode, or negative electrode, and a
device called an electron gun that projects a beam of
electrons against a luminescent screen at the opposite end of Impact Printer
the tube. CRT screens use a technology called raster scanning, a process of
sweeping electron beams across the back of the screen. A computer display

Page 26 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

screen used for graphics is divided into dots which can be illuminated
individually on the screen called pixel. The resolution of the screen-its clarity-
is directly related to the number of pixels on the screen: The more pixels, the
higher the resolution.
Color Screen Standards
CGA(color graphics adapter) –320 X 200 pixels
EGA(enhanced graphics adapter) –640 X 350 pixels
VGA(video graphics adapter) –640 X 480 pixels
SVGA(super VGA) –800 X 600 pixels or
1024 X 768 pixels

0 Data Projectors – a device that takes the text and images displaying on a
computer screen and project them on a larges screen so an audience can see
the image clearly. Used for displaying computer images (data) as well as video
from a VCR, VHS, VCD, DVD player, Computer, or a Video Camera. There are 2
types of smaller, lower cost projectors, the LCD(Liquid Crystal Display) and the
DLP(Digital Light Processing) projectors.
0 Rear projection screens - used in higher lighting conditions since the projector
is behind the screen usually in a small room or large closet along with any
other associated equipment. Rear projection screens also are used in higher
lighting conditions since the projector does not have to "fight the light". Rear
screens can also be integrated into a housing much like large screen televisions
used in a home.
0 SMART Boards are Interactive whiteboards. SMART Boards get hooked up to a
computer and the computer saves the information written on the board.
SMART Boards when used with a multimedia projector allows the user to
control the computer and all of its programs by simply touching the board.
SMART Boards also allow for users to write and annotate on top of any
application even the web.

4.3. Printers
An output device that produces text and graphics on a physical medium
such as paper or transparency film. Printed information, called hard copy,
exists physically and is a more permanent form of output than presented on a
display device(softcopy).
0 Impact Printers – uses some sort of physical contact with the paper to produce
Impact Printer
an image, by physically striking the paper, ribbon, and hammer
Photo Printer
or tiny wire pins together
 Line Printers. A high speed impact printer that prints an
entire line at a time. Mainframes, midrange servers, or
network applications, such as manufacturing, distribution, Line Printer
or shipping, often use line printers. It typically use 11x17 inches
continuous-form paper.

Page 27 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

0 Non-Impact Printer – places an image on a page without


physically touching the page, which prints by means of
photographic, heat, laser, or ink spray. Printer resolution is
measures by the number of dots per inch(dpi ) a printer can
print.
Inkjet Printer
 Inkjet Printers. A type of non-impact printer that forms
characters and graphics by spraying tiny drops of liquid
ink onto a piece of paper.
 Photo Printers. A color printer that produces photo-lab-
quality pictures.
 Laser Printer. A high-speed, high-quality non-impact
printer that prints text and graphics in high resolutions,
usually 1200 dpi for black and white and up to 2400 dpi for
color printer. Operating in a manner similar to a copy
machine, a laser printer creates images using a laser
beam and powder ink, called toner. Laser Printer
 Thermal Printer. Generates images by pushing electrically
heated pins against heat sensitive paper. Two special type
of thermal printer are the thermal wax transfer printer
and dye-sublimation or sometimes called a digital photo
printer.
Thermal Printer
 Mobile Printers. Small, lightweight, battery powered
printer that allows a mobile user to print from a notebook
computer, Tablet PC, PDA, or smart phone while
traveling.
Mobile Printer
 Label and postage printer. A small printer that prints on an
adhesive-type materials that can be placed on envelopes,
packages, floppy disks, CD’s, DVD’s. file folders, photographs
Label and
and toys. Postage Printer
 Plotters and large format printer. Sophisticated
printers used to produce high quality drawings
such as blue-prints, maps, and circuit diagrams.
Using ink-jet printer technology, but on a much
larger scale, a large-format printer creates a
Large-format Printer
photo-realistic-quality color prints. Graphic artists
use this high-cost, high performance printers for
signs, posters, and other professional quality displays.

Page 28 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

4.4. Speakers and Headsets


An audio device is a component of a computer that produces music, speech, or
other sounds, such as beeps. Two commonly used audio devices are speakers
and headsets.

Speakers

Headsets

4.5. Other Output Devices


 Fax Machine and Fax Modems. A fax machine is a device that codes and
encodes document so they can be transmitted over telephone lines. The
term fax refers to a document that you send or receive via a fax machine.
Many computers include fax capability by using a fax modem. Fax modem
is a modem that allows you to send (and sometimes receive) electronic
documents as faxes.
 Multifunction Peripheral. A single device that look like a copy machine
but provides the functionality of a printer, scanner, copy machine, and
perhaps a fax machine.

Fax Machine

Multifunction Peripheral

Page 29 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Post-Test
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. Given the same computer time, which of the following output device consumes
the least power? a) CRT Monitors b) LCD Monitors c) Plasma Monitors d)
Smart Boards
____2. Which of the following can store the most data?
a) 3.5” floppy disk b) cassette tape c) hard disk d) optical disk
____3. Which of the screen standard has the highest resolution?
a) CGA b) EGA c) SVGA d) VGA
____4. The core of a CRT monitor is a(n) ____. a. LCD monitor b. high-definition
television c. active-matrix monitor d. cathode-ray tube
____5. A single device that looks like a copy machine but provides the functionality of a
printer, scanner, copy machine, and perhaps a fax machine is called a ____. a.
total printer b. subwoofer c. multifunction peripheral d. master printer
____6. A(n) ____ boosts low bass sounds. a. subwoofer b. headset c. microphone
d. internal speaker
____7. Sophisticated printers used to produce high-quality drawings such as blueprints,
maps, and circuit diagrams are called ____. a. laser printers b. plotters c.
thermal printers d. line printers
____8. ____ devices display information in one color on a different color background.
a. Unichrome b. Monochrome c. Color d. LCD
____9. LCD monitors are also called ____. a. plotters b. flat panel monitors c. HDTV
(high-definition television) monitors d. gas plasma displays
____10. Print Orientation where the shorter side of the paper is on the sides. A)
portrait b) landscape

Page 30 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER V
SYSTEM AND STORAGE UNITS
Guide Questions:
1. Describe the Central Processing Unit.
2. What are the components of a processor, and how do they complete a machine
cycle?
3. What is the unit of the speed of computer processor?
4. What are the various type of memory?
5. What is a bit?
6. Imagine that you are buying a personal computer. What specification of the
processor and its hard disk would you choose and why?

Outcomes:
At the end of the Chapter, the students can:
☺ identify the parts of the system unit
☺ differentiate various personal computer processors on the market today
☺ differentiate storage device and storage media
☺ recognize the terminologies used in identifying computer storage
specifications.
☺ describe the characteristics of optical discs.
Pre-Test:
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. ____ loses its contents when the computers power is turned off. a. ROM
b. Flash memory c. Nonvolatile memory d. Volatile memory
____2. The case of the system unit is sometimes called the ____. a. processor
b. chassis c. motherboard d. control unit
____3. The number system that has just two unique digits, 0 and 1, is called the ____.
a. digital system b. bit system c. analog system d. binary system
____4. The new ____ processor integrates the functions of a processor, memory, and
video card on a single chip. a. microprocessor b. power processor c. system
on a chip d. multimedia processor
____5. Optical discs used in personal computers are ____ inches in diameter. a. 3.5
b. 4.75 c. 5 d. 8

5.1. Introduction
The system unit is a case that contains electronic components of the computer
used to process data. System units are available in a variety of shapes and sizes. The
case of the system unit, sometimes called the chassis, is made of metal or plastic
and protects the internal electronic components from damage. The storage unit
holds data, instructions, and information for future use. Every computer uses
storage to hold system software and application software. A storage medium, also

Page 31 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

called secondary storage, is the physical material on which a computer keeps data,
instructions and information.

System Unit

The System Unit


THE MOTHERBOARD
Sometimes called the system board, is the main circuit board of the system unit.
Many electronic components attach to the motherboard; others are built into it.

Expansion slots for


Adapter Cards inserted Processor slot
here

Memory modules are


inserted here

Motherboard

Page 32 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CENTRAL PROCESSING UNIT


The CPU is the brain of the computer. It is a microscopic
circuitry that serves as the main information processor in a
computer. A CPU is generally a single microprocessor made
from a wafer of semi-conducting material, usually silicon, with
millions of electrical components on its surface. A silicon chip is
smaller than a thumbtack.

The figure shows examples of an


integrated circuit: at the center is a F-100
microprocessor, only 0.6 cm square and is small
enough to pass through the eye of a needle.

Parts of the CPU Processors

 Control Unit. Controls, supervises and


directs the operation of the computer. The
CPU’s control unit coordinates and times the Microprocessors
CPU’s functions, and it uses the program counter to locate and retrieve the
next instruction from memory. Like an orchestra leader, the control unit
does not execute the instructions itself; rather it directs other parts of the
system to do so.
 Arithmetic / Logic Unit(ALU). Has special circuitry for performing
processing operation which performs calculations and comparisons. The
ALU performs specific operations such as addition, multiplication, and
conditional tests on the data entered in the computer for processing.
 Registers. A small, high-speed storage locations that temporarily hold data
and instruction. Registers are part of the processor, but not part of the
memory or permanent storage device. Register functions include storing
the location from where an instruction was fetched, storing an instruction
while the control unit decodes it, storing data while the ALU computes it,
and storing the results of a calculation.
 System Clock. The processor relies on this quartz crystal circuit that
controls the timing of all computer operations. The system clock generates
regular electronic pulses or ticks that set the operating pace of components
of the system unit. The pace of the system clock is called the clock speed.
Current personal computers have clocks speed in gigahertz range(hertz is
one cycle per second). The system clock is one of the factors that influence
a computer’s speed. The faster the clock speed, the more instruction the
computer can execute.

Leading processor chip manufacturers:

Page 33 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Intel – Xeon MP, Itanium, Pentium D, Pentium 4 w/HT, Pentium 4,


Pentium III, Celeron, Pentium II, Pentium Pro, 80486, 80386, 80286,
Core Dou, Pentium M
AMD- Opteron, Athlom MP, Sempron, Athlon 64, Athlon, Duron, AMD
K6III, AMD K6-2, AMD K6
Motorola / IBM – PowerPC G5, G4, G3, G2, G1, 68040, 68030, 68020
Transmeta – Efficeon, Crusoe
PRIMARY MEMORY OR STORAGE UNIT
Storage capacity determines the amount of information that can
be held within the computer memory at a particular time. Memory
ROM Chip
consists of electronic components on one or more chips on
the motherboard that store instructions waiting to be
executed by the processor, data needed by those
instructions, and the results of processed data. . RAM
Types of Memory are:
Volatile memory – When the computer’s power is turned off, volatile
memory loses its contents. Ex. RAM
Nonvolatile memory – Does not lose its content when power is removed
from the computer. Ex. ROM, flash memory, CMOS.
 Read Only Memory. Semiconductor-based memory that contains
instructions or data that can be read but not modified. ROM is non-volatile
– its contents do not disappear when the power is turned off. Ex. ROM
chips for printer contain data for font.
 Random Access Memory. The computer’s temporary storage
compartment; generally understood to refer to volatile memory, which can
be written as well as read. It holds the instructions and data for whatever
programs we happen to be using. Measured as an amount of data or in
bytes – nowadays are usually in Megabytes, the more RAM your computer
has, the more powerful the programs you can run. RAM is usually volatile –
that is, the data is lost once the power is shut off.
 Cache. A type of memory that helps speed the processes of the computer
because it stores frequently used instructions and data. Most computers
today have two types of memory cache, L1 cache and L2 cache.
 Flash Memory. A type of non-volatile memory that can be erased
electronically and rewritten. Used in most computers because it holds their
start-up instructions by allowing the computer to easily update its
contents.
 CMOS (Complimentary metal-oxide semiconductor). CMOS technology
uses battery power to retain information even when the power to the
computer is off. It can keep calendar, date, and time even when the
computer is off.

Page 34 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Storage Terms:
BIT – smallest unit of information
BYTE – a collection of bits
WORD – collection of bytes
1 Byte = 8 bits of binary nos.
Term Approx. # of bytes Exact # of bytes Approx. # of
pages of text
Kilobyte(KB) 1 thousand 210 or 1,024 ½
Megabyte(MB) 1 million 220 or 1,048,576 500
Gigabyte(GB) 1 billion 230 or 1,073,741,824
Terabyte(TB) 1 trillion 240 or 1,099,511,627,776
Petabyte(PB) 1 quadrillion 250
Exabyte(EB) 1 quintillion 260
Zettabyte(ZB) 1 sextillion 270
Yottabyte(YB) 1 septillion 280

SECONDARY OR AUXILIARY STORAGE/ MEMORY UNIT


Alternative storage unit to augment the storage capabilities of the
computer. Secondary storage is necessary because memory, or primary memory,
can be used only temporarily, that is, your programs and data will disappear
from memory when you turn your computer off. However, you probably want to
store the data you have used or the information you have derived from
processing, and that is why secondary storage, or auxiliary storage, is needed.
Often referred to as external storage units. Examples are the following:
 Magnetic Disk. Uses magnetic particles to store items such
Sliding
as data, instructions, and information on the disk’s Plastic
surface.
 Floppy disks. Write protect tab

 ZIP disks 3 ½ Floppy Disk

External Hard Disk


Portable Hard Disk
ZIP Disk in ZIP Drive
Hard Disks
Tape
 Hard disk Removable Hard Disk
PC Card

 Optical Disks. Type of storage media that consists of a


flat, round, portable disc made of metal, plastic, and lacquer that is written

Page 35 of 118

Optical Disks
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

by a laser. Optical discs used in personal computer are 4.75 inches in


diameter. Mini discs have a diameter of 3 inches or less.

Disc Format Read Write Erase Capacity


 CD-ROM Y N N 650 MB to 1 GB
 CD-R Y Y N 650 MB to 1 GB
 CD-RW Y Y Y 650 MB to 1 GB
 DVD-ROM Y N N 4.7 GB to 17 GB
 DVD-R, DVD+R Y Y N 4.7 GB to 17 GB
 DVD-RW, DVD+RW Y Y Y 4.7 GB to 17 GB
 DVD-RAM Y Y Y 4.7 GB to 17 GB
 BD-ROM Y N N 25 GB to 128 GB
 BD-R, BD+R Y Y N 25 GB to 128 GB
 BD-RW, BD+RW Y Y Y 25 GB to 128 GB
 BD-RAM Y Y Y 25 GB to 128 GB

 Magnetic/Cassette
Tape. Magnetic coated
ribbon of plastic capable
of storing large amounts
Compact Flash Memory Stick
SmartMedia Secure Digital xD Picture Card
of data and information at a low cost. A tape cartridge is a
small, rectangular, plastic housing for tape.
 PC Cards. A thin, credit card-sized device that adds memory, USB Flash Drive
storage, sound, fax/modem, network, and other capabilities
to mobile computers
 Flash Memory Cards. A removable flash
memory device that allows user to transfer
data and information conveniently from mobile
devices like PDAs, smart phones, digital microfilm
cameras and digital music players to desktop computers.
 USB Flash Drives. Sometimes called a pen drive, is a flash Microfilm reader
memory device that plugs in a USB port on a computer or portable device.
 Microfilm and Microfiche. Store microscopic images of documents on roll or
sheet film. Microfilm is a 100 to 215 foot roll of film. Microfiche is a small
sheet of film, usually about 4 inches by 6 inches. A computer output
microfilm recorder is the device that records the images on the film.
 Solid State Drive (SSD) is a storage device
that typically uses flash memory to store
data, instructions, and information. With
available form factors of 3.5 inches,2.5
inches, and 1.8 inches, SSDs are used in all
types of computers including servers,

Page 36 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

desktop computers, and mobile computers and devices such as portable


media players and digital video cameras. Storage capacities of current SSDs
range from 16 GB to 256 GB and more.

Post-Test
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. 1 byte = _____ bits: a) 0 b) 8 c) 80 d) 1024
____2. An example of storage unit: a) CPU b) Scanner c) spreadsheet d) DVD
____3. Another name for memory is: a) Secondary storage b) Primary storage
c) disk storage d) tape storage
____4. The CD-ROM is an example of: a) software b) hardware c) a program d) an
output unit
____5. The unit that transform data into information:
a) CPU b) disk drive c) bar code reader d) wand reader
____6. Which of the following can store the most data?
a) 3.5” floppy disk b) cassette tape c) hard disk d) optical disk
____7. PC Cards commonly are used in ____. a. midrange servers b. notebook
computers c. mainframe computers d. supercomputers
____8. A ____ is an erasable multisession disc you can write on multiple times. a. CD-
ROM b. CD-R c. CD-RW d. DVD-ROM
____9. Storage media are sometimes referred to as ____. a. primary storage b.
storage drives c. secondary storage d. RAM
____10. Devices such as a keyboard and mouse usually attach to ____ on the
system unit by a connector on a cable. a. processors b. ports c. adapter cards
d. drive bays

Page 37 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER VI
INTERNET AND COMPUTER SOFTWARE
Guide Questions:
1. When people call software user-friendly, what do they mean?
2. Name at least three things a computer program should be able to do.
3. Why is writing instructions for a computer more difficult than writing
instructions for a person?
4. Is e-mail important on your part as student? Discuss your answers in detail.
5. What is the main reason for having an operating system?
6. Is Internet important to you? Explain why or why not.

Outcomes:
At the end of the Chapter, the students can:
☺ understand the internet and its use
☺ identify programs installed in the computer
☺ categorize the different computer software installed in a computer
☺ explain ways software is distributed
☺ identify the key features of widely used home, personal, and educational
programs, and
☺ understand the anatomy of an e-mail address

Pre-Test:
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. One is not a system software: a) Defragmenter b) DOS c) FIXDISK d) Solitaire
____2. An application software used to create graphs and charts
a) Computer Aided Design b) Database c) Spreadsheet d) Word Processor
____3. A software that converts high-level language programs to machine language:
a) compiler b) debugger c) scanner d) translator
____4. As of 2004, the world’s #1 software company is: a) Intel b) Microsoft c)
Oracle d) Sun
____5. In the internet, .com means: a) company b) commerce c) commercial d)
command
6.1. Introduction
One of the major reasons business, home, and other users purchase
computers is for Internet access. The Internet is a widely used research tool,
providing society with access to global information and instant communications.
Further, access to the Internet can occur anytime from a computer anywhere: at
home, at work, at school, in a restaurant, on an airplane, and at a park. The
Internet, also called the Net, is a worldwide collection of networks that links
millions of businesses, government agencies, educational institutions, and
individuals. Each of the networks on the Internet provides resources that add to

Page 38 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

the abundance of goods, services, and information accessible via the Internet.
Today, more than one billion home and business users around the world access a
variety of services on the Internet, some of which are shown in Figure 2-1. The
World Wide Web, or simply the Web, and e-mail are two of the more widely
used Internet services. Other services include chat rooms, instant messaging,
and VoIP (Voice over Internet Protocol). To enhance your understanding of these
Internet services, the chapter begins by discussing the history of the Internet and
how the Internet works and then explains each of these services.
With the proper software, a computer is a valuable tool. Software is a set
of instructions a computer uses to manipulate data, such as a word-processing
program or a video game. These programs are usually stored and transferred via
the computer's hardware to and from the CPU. Software also governs how the
hardware is utilized; for example, how information is retrieved from a storage
device. There are two basic types of software: system software and application
software. Once a computer has system software, application software can be
added. Application software allows you to apply the computer to solve a specific
problem or perform a specific task.
6.2. The Internet
It is a computer-based global information system. The Internet is composed
of many interconnected computer networks. Each network may link tens,
hundreds, or even thousands of computers, enabling them to share information
with one another and to share computational resources such as powerful
supercomputers and databases of information using a protocol or
communication rules called TCP/IP (Transmission Control Protocol/Internet
Protocol). The Internet has made it possible for people all over the world to
effectively and inexpensively communicate with one another. Unlike traditional
broadcasting media, such as radio and television, the Internet does not have a
centralized distribution system. Instead, an individual who has Internet access
can communicate directly with anyone else on the Internet, make information
available to others, find information provided by others, or sell products with a
minimum overhead cost.
The Internet is not a place nor a company nor a computer program.
Rather, the Internet is a free-for-all of people, businesses and organizations who
have linked their computers together by cables, telephone lines, and satellites.
Current estimates place that the Internet has about 30, 000 networks, and 7
million hosts. One and all these people contribute in making the Net a
repository of data, programs, utilities and information for everybody on
everything and any topic under the sun. As the Internet grows, people have
created many different ways to use it to share information to the world. The
World Wide Web is an important part of the Internet. The Web has received so
much attention that in the minds of some, it has become synonymous with the
Internet. However, it is important to note that the Web is not the Internet, but
merely a resource that is available via the Internet.

Page 39 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

6.3 Navigating the Web


Using a software called a browser (ex. are Internet Explorer, Mozilla
Firefox, or Netscape Navigator), a user can use the mouse to point and click on
screen icons to explore the World Wide Web (WWW). Each different location on
the web is called a web site. A home page is the first page of a web site. Each
page of information on the Web is assigned a URL (Uniform Resource Locator)
that includes the domain name of the computer on which the page is located
(ex. http://www.msn.com, http://www.inq7.net, http://www.google.com etc.).
Short, easy-to-remember URL or commonly called domain names are also in
short supply. Many domain names that use the simple format
http://www.[word].com, where [word] is a common noun or verb, are already in
use. Currently, only a few endings are allowed, such as .com, .org, and .net. In
the near future, additional endings will be allowed, such as .biz and .info. This
will greatly expand the number of possible URLs.

To go to a specific page
Standard URL format: http://www.domain_name.domain name
Example 1: http://www.yahoo.com
Example 2: http://www.wit.edu.ph
Meaning:
http – HyperText Transport Protocol
- identifies the Web site as one on the WWW using HTML.
:// - alerts the browser that the next words will be the actual URL,
which is broken up by periods (.) each referred to as dot.
www - identifies the site as part of the World Wide Web
yahoo or wit - this is the domain name – a unique name that must be
registered with the company called Network Solution.
com/edu - this is the top-level domain name – com for commercial, edu
for education
ph - geographic zone name for Philippines
6.4 The World Wide Web
Although many people use the terms World Wide Web and Internet
interchangeably, the World Wide Web actually is a service of the Internet. While the
Internet was developed in the late 1960s, the World Wide Web emerged in the early
1990s. Since then, it has grown phenomenally to become one of the more widely
used Internet services. The World Wide Web (WWW), or Web, consists of a
worldwide collection of electronic documents. Each electronic document on the
Web is called a Web page, which can contain text, graphics, animation, audio, and
video. Additionally, Web pages usually have built-in connections to other
documents.

6.5 E-Mail

Page 40 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

E-mail (short for electronic mail ) is the transmission of messages and files via a
computer network. E-mail was one of the original services on the Internet, enabling
scientists and researchers working on government-sponsored projects to
communicate with colleagues at other locations. Today, e-mail is a primary
communications method for both personal and business use. You use an e-mail
program to create, send, receive, forward, store, print, and delete e-mail messages.
Outlook and Windows Live Mail are two popular desktop e-mail programs; Gmail
and Windows Live Hotmail are two popular free e-mail Web applications.

6.6 Instant Messaging


Internet communications service that notifies you when one or more people are
online and then allows you to exchange messages or files or join a private chat room
with them. Real time means that you and the people with whom you are conversing
are online at the same time. Some IM services support voice and video
conversations. Many IM services also can alert you to information such as calendar
appointments, stock quotes, weather, or sports scores. They also allow you to send
photos or other documents to a recipient, listen to streaming music, and play games
with another online party. For IM to work, both parties must be online at the same
time. Also, the receiver of a message must be willing to accept messages.

6.7 Chat Rooms


A chat is a real-time typed conversation that takes place on a computer. A chat
room is a location on an Internet server that permits users to chat with each other.
Anyone in the chat room can participate in the conversation, which usually is specific
to a particular topic. As you type on your keyboard, a line of characters and symbols
is displayed on the computer screen. Others connected to the same chat room
server also see what you have typed. Some chat rooms support voice chats and
video chats, in which people hear or see each other as they chat.

6.8 Netiquette
Netiquette, which is short for Internet etiquette, is the code of acceptable behaviors
users should follow while on the Internet; that is, it is the conduct expected of
individuals while online. Netiquette includes rules for all aspects of the Internet,
including the World Wide Web, e-mail, instant messaging, chat rooms, FTP, and
newsgroups and message boards. The following outlines some of the rules of
netiquette.

Netiquette
1. In e-mail, chat rooms, and newsgroups: • Keep messages brief. Use proper
grammar, spelling, and punctuation.
• Be careful when using sarcasm and humor, as it might be misinterpreted.
• Be polite. Avoid offensive language.
• Read the message before you send it.

Page 41 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

• Use meaningful subject lines.


• Avoid sending or posting flames, which are abusive or insulting messages. Do
not participate in flame wars, which are exchanges of flames.
• Avoid sending spam, which is the Internet’s version of junk mail. Spam is an
unsolicited e-mail message or newsgroup posting sent to many recipients or
newsgroups at once.
• Do not use all capital letters, which is the equivalent of SHOUTING!
• Use emoticons to express emotion. Popular emoticons include
:) Smile :| Indifference :o Surprised
:( Frown :\ Undecided
• Use abbreviations and acronyms for phrases:
btw by the way
imho in my humble opinion
fyi for your information
ttfn ta ta for now
fwiw for what it’s worth
tyvm thank you very much
• Clearly identify a spoiler, which is a message that reveals a solution to a game or
ending to a movie or program.
2. Read the FAQ (frequently asked questions), if one exists. Many newsgroups and
Web pages have an FAQ.
3. Do not assume material is accurate or up-to-date. Be forgiving of other’s mistakes.
4. Never read someone’s private e-mail.

Classification of Software
6.9. SYSTEM SOFTWARE
Set of programs prepared by the manufacturer to facilitate operation of
the computer by the user. System software handles such essential, but often
invisible, chores as maintaining disk files and managing the screen, whereas
application software performs word processing, database management, and the
like. It serves as an interface between the user, the application software, and the
computer hardware.
 Operating Systems Program. A program which has the ultimate control of
all operations of the system, it manages and control the activities of a
computer. It is the most important piece of software in a computer system,
without it, the computer cannot function.
Functions of an Operating System
1. Allocating and assigning system resources.
2. Scheduling operations
3. Monitoring system activities
Categories of Operating Systems
 Stand-alone Operating Systems.
 Disk Operating System, DOS –(Microsoft)
Page 42 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

 Windows (Microsoft)
 Windows 8
 Windows 7
 Windows VISTA
 Windows XP Home Edition
 Windows XP Professional
 Windows XP Media Center Edition
 Windows XP Tablet PC Edition
 Windows XP 64-bit Edition
 Windows 2000 Professional
 Windows Millennium Edition
 Windows 98
 Windows 95
 Windows 3.x
 Mac OS X (Apple)
 UNIX
 Linux
 Network Operating Systems.
 Netware(Novell)
 Windows Server 2003(Microsoft)
 UNIX
 Linux
 Solaris(Sun Microsystem)
 Embedded Operating Systems
 Windows CE
 Windows Mobile
 Palm OS
 Symbian OS

 Language Processor . In order for a computer to understand the data being


conveyed to it, the data must be expressed in binary digits. Language
processors are programs that translates high level language(source
program) to executable machine language (object program). There are
three basic kinds of language translators: assemblers, compilers, and
interpreters. Assemblers translate programs written in assembly language.
Compilers translate programs written in high-level languages. Interpreters
translate source code into machine language one line at a time, executing
each translated statement before proceeding to the next.
 Utilities. These are generalized programs, which allows the user routinary
in data processing system, such as file-to-file conversion, sort/merge
operations, file compression, as well as other important “housekeeping”
functions.

Page 43 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Ex. FORMAT, DISKCOPY, SORT, PC Tools, Anti-Virus, Scanner, Defragmenter,


Compression Agent, etc.
6.10. APPLICATION SOFTWARE
Programs designed to make users more productive and/or assist them with
personal tasks. The following are the use of application software:
to make business activities more efficient
to assist with graphics and multimedia projects
to support home, personal, and educational tasks
to facilitate communications
Available forms of Application Software:
o Packaged Software. Mass-produced, copyrighted retail software that meets
the needs of variety of users, often called as “CANNED” programs
Basic Application Software Packages:

Word Processing software. Ex. Word(Microsoft), StarOffice Writer(Sun),
Word Perfect(Corel)

Spreadsheet software. Ex. Excel(Microsoft), StarOffice Calc(Sun), Quattro
Pro(Corel)

Database software. Ex. Access(Microsoft), StarOffice Base(Sun),
Paradox(Corel), Visual FoxPro(Microsoft), Oracle(Oracle), MySQL(MySQL
AB)

Communication software. Ex. Internet Explorer(Microsoft),
Firefox(Mozilla), Yahoo Messenger(Yahoo)

Graphics, presentation, desktop publishing, and Multimedia software. Ex.
PowerPoint(Microsoft), StarOffice Impress(Sun), Presentations(Corel),
Photoshop(Adobe), Fireworks,Flash(Macromedia)

Computer Aided Design software. Ex. AutoCAD(Autodesk), Chief
Architect(Quality Plans), Visio(Microsoft)

o Custom Software. Performs functions specific to a business or industry. In


case a company cannot find a package software that meets its requirement,
it hires programmers to develop tailor-made custom software.
o Open Source Software. A type of software provided for use, modification,
and redistribution. It can usually be downloaded from the web at no cost.
o Shareware. A copyrighted software that is distributed at no cost for a trial
period. To use a shareware program beyond that period, you send payment
to the program developer.
o Freeware. Copyrighted software provided at no cost by an individual or a
company that retains all rights to the software.
o Public-domain Software. A type of software donated for public use and has
no copyright restrictions. Anyone can copy or distribute public-domain
software to others at no cost.

Page 44 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

6.11. CREATING SOFTWARE


In the early days of computing, program instructions had to be physically wired
into the computer. Changing the instructions meant rewiring the computer! Today,
creating software-programming- is much easier. Although computers appear to be
amazingly intelligent machines, they cannot yet think on their own. Computers still
rely on human beings to give them directions. These directions are called programs,
and the people who write the programs are called programmers. The instructions
that make up systems software and application software are written(“coded”) by
programmers, using a programming language- a special kind of language that allows
a programmer to tell the computer what to do in a way that the computer can
understand. Once it is properly provided with a valid program, the computer
becomes self-operational, that is; it requires no human intervention during
processing. Developing a successful program may involve some amount of
rethinking on reworking earlier prepared steps. Documentation is a vital step that
must be a continuing one. It must be concise, complete and accurate.

6.12. PROGRAMMING CYCLE


1. Defining the Problem.
 A clear statement of what the program is supposed to accomplish.
 A list of the inputs to the data necessary to produce the outputs.
 An analysis of the data manipulation and a plan for the user interface to
the program.
2. Planning the Solution.
 Determining the sequence of processing steps within individual
programs.
 Designing an algorithm, a flowchart and a user interface.
 Selection of appropriate programming language.
3. Coding the Solution.
 Translation of the steps illustrated on the flowchart to the actual program
of a specific programming language.
4. Testing & debugging
 Checking that a program does what you planned it to do. This step
includes desk-checking, a step where programmers sit down and
mentally trace, or check, the logic of the program to ensure that it is
error-free and workable.
 Debugging is the process of correcting programming error.
5. Documentation
2 Types of Documentation
1. User Documentation – written detailed description or non-technical
terms which tells the user what the program does, how to respond to the
various requests for user interaction and how to interpret output.

Page 45 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

2. Technical Documentation – in technical terms, are written detailed


description addresses to programmers who may be called on latter to
correct bugs and to modify the program.
Defining the Problem.

Documentation Planning the Solution.


PROGRAMMING CYCLE

Testing & debugging Coding the Solution

Programming Cycle

Algorithms. A list of instructions for carrying out a process. It is a procedure for


solving a problem in terms of the actions to be executed, and the order in which
these actions are to be executed.
Flowchart. Diagrams representing the logical sequence in which a combination
of steps or operation is to be performed. It is a graphical representation of an
algorithm or of a portion of an algorithm.

Post-Test
Multiple Choice. Write the capital letter of your answer on the space provided.
______1.Geographical zone name of Philippines in the Internet is: a) .fi b) .fil c)
.ph d) .ps
______2.Making illegal copies of copyrighted software is called:
a) software piracy b) browsing c) collaboration d) electronic distribution
______3.Raw data is processed by the computer into:
a) number sheets b) paragraphs c) updates d) information
______4.Software used to access the Internet: a) browser b) web c) server
d) e-mail
______5.Step-by-step instructions that directs the computer:
a) hardware b) CPU’s c) documents d) programs
______6.The CPU is an example of: a) software b) hardware c) a program d) an
output unit
______7.The only language the computer can understand: a) Assembly Language
b) English Language c) High-Level Language d) Machine Language
______8.The underlying software: a) application b) operating system c)
groupware d) shareware
______9.When preparing an office memo, use a ___ software:
a) CAD b) Database c) Desktop Publishing d) Word Processing
______10. Which of the following is not an operating system?
a) DOS b) Linux Kernel c) MS Word 2000 d) Windows 95

Page 46 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER VII
WINDOWS DESKTOP FAMILIARIZATION
Guide Questions:
1. List down at least 5 special keys found on the keyboard and explain their uses.
2. What do you think is the main reason why mouse was conceived? Explain your
answer.
3. Awareness, Knowledge and Interaction are the three components of computer
literacy. Discuss why these three should be present in you.

Outcomes:
At the end of the Chapter, the students can:
☺ recognize the parts and usage of the mouse and computer keyboard
☺ use the Windows Operating System
☺ identify the elements of the Windows Desktop and its components
☺ identify the elements of a window
☺ use the accessories programs in Windows
Pre-Test:
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. Pictorial representation of files and programs in a GUI programs
a) buttons b) forms c) icon d) menu
____2. Who developed the QWERTY keyboard? a) Christopher Sholes b) Howard Aiken
c) James Qwerty d) Walter Brattain
____3. A standard equipment included by IBM and Apple to computer design for
graphic user interface. a) disk drives b) keyboard c) mouse d) optical disk
____4. A type of icon that represents area for stored files such as documents, graphics
and programs. a) document b) folder c) original d) program
____5. A window displayed by the computer used to solicit response from the user.
a) dialog box b) menu bar c) program d) splash screen
7.1. INTRODUCTION
Familiarization is one vital issue one must consider in mastering computer
utilization. Exposure to the computer environment necessitates the user’s
acquaintance with the computer. With the advent of GUI(Graphic User Interface),
where the screen display is in the format that enables the user to choose
commands, start programs, and see lists of files and other options by pointing to
pictorial representations (icons) and lists of menu items on the screen by using the
GUI device called mouse, computer interaction has been trouble-free as a result of
its user-friendly environment. Most personal computers (PCs) include a keyboard
because it is easy to use and efficient for everyday tasks such as word processing. A
mouse is another input devices that help the user point, select, and move objects on
a video display monitor. The proper use of the computer keyboard and mouse is
discussed in this chapter.

Page 47 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

7.2. COMPUTER KEYBOARD


It is a keypad device with buttons or keys that a user presses to enter data
characters and commands into a computer. Keyboards emerged from the
combination of typewriter and computer-terminal technology. The most common
English-language key pattern for keyboards is called QWERTY, after the layout of the
first six letters in the top row of its keys (from left to right). In the late 1860s,
American inventor and printer Christopher Sholes created the QWERTY keyboard
layout by separating commonly used letters so that typists would type slower and
not jam their mechanical typewriters.
Computer keyboards copied the QWERTY key layout and have followed the
precedent set by typewriter manufacturers in keeping with this convention. Modern
keyboards connect with the computer CPU by cable or by infrared transmitter.
When a key on the keyboard is pressed, a numeric code is sent to the keyboard’s
driver software and to the computer’s operating system software. The driver
translates this data into a specialized command that the computer’s CPU and
application programs understand. In this way, users may enter text, commands,
numbers, or other data. The term character is generally reserved for letters,
numbers, and punctuation, but may also include control codes, graphical symbols,
mathematical symbols, and graphic images.
A B C D E
Parts of the Keyboard
A. Alphanumeric
Keypad
B. Function Keys
C. Cursor Keys
D. Numeric Keypad
E. Status Lights Fig.16. Keyboard and its Parts
F. Special Keys

7.3. MOUSE
A common pointing device was
LEFT BUTTON
popularized by its inclusion as
standard equipment with the Apple RIGHT BUTTON
Macintosh and IBM computers. The MOUSE
basic features of a mouse are a casing
MOUSE PAD
with a flat bottom, designed to be
gripped by one hand; one or more buttons at the Mouse and its parts
top; a multidirectional detection device (usually a ball) at
the bottom; and a cable connecting the mouse to the computer. By moving the
mouse on a surface (such as a desk), the user typically controls an on-screen cursor.
A mouse is a relative pointing device because there are no defined limits to the
mouse's movement and because its placement on a surface does not map directly to

Page 48 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

a specific screen location. To select items or choose commands on the screen, the
user presses one of the mouse's buttons, producing a “mouse click”.
Parts of a Mouse
A. Left button
B. Right button
Mouse Operations
A. Point - moving the mouse around the mouse pad and the
positioning of the mouse pointer on the text, programs or
icons on the monitor .
B. Click of left click - the quick press and release of the left mouse button.
C. Right click - the quick press and release of the right mouse button.
D. Double Click - The quick press and release of the left mouse button twice
in rapid succession.
E. Drag - to press and hold the left mouse button at the same time
moving the mouse around the mouse pad.
7.4. WINDOWS OPERATING SYSTEM
Personal computer operating system sold by Microsoft Corporation allows
users to enter commands with a point-and-click device, such as a mouse, instead of
a keyboard. An operating system is a set of programs that controls the basic
functions of a computer. The Windows operating system provides users with a
graphical user interface (GUI), which allows them to manipulate small pictures,
called icons, on the computer screen to issue commands. Windows is the most
widely used operating system in the world. It is an extension of and replacement for
Microsoft’s Disk Operating System (MS-DOS).
Versions released by Microsoft( as of 2014)
Icons
1. Windows 3.11
Desktop
2. Windows 95
3. Windows 98 Mouse Pointer

4. Windows CE Start
5. Windows 2000
Taskbar
6. Windows ME
7. Windows NT Clock

8. Windows XP
9. Windows Vista
Windows Desktop
10. Windows 7
11. Windows 8

7.5. WINDOWS DESKTOP


The desktop is the overall view of your computer and work area. The desktop
covers the entire screen and is somewhat analogous to the top of a conventional

Page 49 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

desk. Items on your desktop can be moved, thrown away, or placed in folders to
work with later. The desktop can be arranged to contain the items that you use
most frequently. For example, if you work on a weekly report, that document can
be accessed easily if you place it directly in your desktop.
 Icons. Symbols or pictures that represent items stored on your computer.
Sample icons include folders (directories or groups), documents,
programs, and even computer hardware.
Folder icons Document icons Program icons Original icons

 Folder icons. Used to keep related documents or programs together.


Sometimes you can have folders within folders.
 Document icons. Represent the files that you create using software.
Generally document icons resemble the program icon that created
the file. For example, an MS-Word document has part of the same
logo as the MS-Word program in which it was created.
 Program icons. Represent the executable programs (usually software)
available in your computer. For example, Word,
PowerPoint, Photoshop, Excel, and Dreamweaver.
 Original icons. Displayed when you first access your
Windows desktop are My Computer, Network
Neighborhood, Recycle Bin, Internet Explorer, and the
Inbox.
 My Computer. This icon opens to reveal all of the drives you have on
your computer. You can use this feature to open each drive’s contents
and find out what folders and files you have.
 Recycle Bin. This is where you toss things you no longer want on you
system, such as old files. When you’re ready to remove items, empty the
recycle bin and confirm the deletion.
 Taskbar. The Taskbar, located at the bottom of your screen, contains the
Start button. When you open a program, document or any other window,
a button appears on the Taskbar.

Taskbar
 Start button. This button is used to open the start menu, which provides
you with access to applications or documents, Help, the Find feature, and
the Control Panel settings.
 Clock. A clock displays on the right of your Taskbar. If you hold your
mouse pointer over clock, the current date displays.

Page 50 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

7.6. WINDOWS ELEMENTS


 Windows. A window is a construct that displays
your program or document when it is opened.
You can have several windows opened on your
desktop at the same time and you can reposition
and resize them. Generally Windows remembers
the size and location of your windows when they
are closed. When you open the window again, it Program window
displays in the same location and size that it was
when you last closed it. There are three major
window types: program, document, and folder.

Program windows. Program windows are
those that contain a program that you are
running such as Word, Photoshop, or
Netscape Navigator.

Document windows. Document windows
open within a program window. For Document
example, within Microsoft Excel, you can window
have several documents open at the same
time.

Folder windows. A folder window displays the
contents of a folder, including the contents of
the folder display program icons, document
icons, or other folder icons.

Parts of a window
Folder window
Since all windows have essentially the same parts,
Types of Windows
once you learn to work with one window you are able to
work with all windows. If you use Windows or the
Macintosh operating system, you should be familiar with the basic concepts of a
window.
 Title Bar. The title bar is at the top of the window; it displays the
document, program, or folder name, along with the name of the
application that is open (in program windows only). The title bar also tells
you which window is “active.” The title bar of the active window on your
desktop is blue; all other windows will have gray title bars. Even though
you may have more than one window open on your desktop, you can only
work with one at a time. The one you are working with is the “active”
window. You can make a window “active” by clicking any place on the
window.
 Window buttons. The title bar also displays three small buttons on the
right of the title bar, which change the display of the window; the
minimize, maximize, and close buttons.

Page 51 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Minimize button
When you click the Minimize button (on the left), the window
disappears and is represented by a button on the Taskbar. When a
window is minimized, you display it again by clicking the window
button on the Taskbar.
Maximize button
When you click the Maximize button (in the center), the window
is enlarged to take up the entire Desktop if it is a program or
folder window. When you maximize a document icon, the window
takes up the entire application window.
Restore button
When you maximize a window, the Restore button replaces the
Maximize button. The Restore button has two small boxes.
Clicking the Restore button displays the window in its previous
opened size and location.
Close button
The Close button (on the right) closes the window. Click the Close
button once to completely close the document, application, or
folder windows.

Title Bar

Window title Title Bar

Control Menu Icon

Border

Scroll Bar

Status Bar
Parts of a Window

 The Menu bar. The Menu bar appears just below the Title bar and displays
additional options when you click the menu name. The commands and
features that you access on the menu bar tell Windows and the Windows
programs what actions to carry out. A menu is a group of related
commands or instructions that tells Windows what you want to do
Elements of a Menu
Pull down menu – a menu that appears to pull-down from the
Menu bar.

Page 52 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Right-pointing Arrow – appears at the side of a command,


which indicates that if you choose the command, another
menu will appear with more menu options
Ellipsis (…) – appears after a command to indicate that Windows
needs more information in order to complete the command.
Te get that information, Windows displays a dialog box.
Check mark – indicates that a menu is currently active.
Note: Besides clicking on the menu name, you can also access
menus by holding down the Alt key and the underlined
letter in the menu’s name. For example, in most programs
the File menu can be accessed by holding down the Alt and
F keys at the same time.
 Scroll Bars & Buttons. Use the scroll bars to move around within your
document or window. Click the scroll bars located on the right and bottom
edges of the window to move up, down, left or right.
 Change window size. The window size may be altered by placing your
mouse on any window border, holding down the left mouse button, and
dragging the mouse to alter the dimensions of the window.
 Change Window placement. To change the window placement, place your
mouse on the Title Bar and click and drag to reposition the window.

7.7. WINDOWS DIALOG BOX


Is a computer's graphical user interface, a special window displayed by the
system or application to solicit a response from the user. For example, when the
user wants to print a document, the system typically displays a dialog box
containing controls that represent various options: draft printing vs. high
resolution, landscape vs. portrait mode, and so on. There are many types of dialog
box like Font dialog box, Save-as Dialog box, Insert Picture Dialog box etc.
Elements of a Dialog Box
Text box – an area in which you type text such as filename. When you click inside
a text box, the mouse pointer becomes a cursor for typing.
List boxes – Exactly what their name implies: list in a box. To select any time in a
list, click it to highlight it. If the list is a long one, scrollbars may appear.
Scroll Bars -Use them to move backward and forward in the displayed list. Click the
arrows to move up or down.
Drop-down lists – similar to list boxes, but only one item in the list is shown. To
see the rest of the list, click the drop-down arrow to the right of the list
box.
Check boxes – Tiny square boxes that turn a feature on or off. A check mark in
a check box means an option is on. You can turn on as many of these
check boxes as you want.

Page 53 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Toolbars – May appear in some of the dialog boxes you use. Toolbars have icon
buttons that act as shortcuts for performing tasks
Option buttons – Little round buttons that turn a feature on or off. A black dot
in the option button means the feature is turned on. Option buttons
usually represent a group of choices from which you can choose only
one at a time.
Command Button – carries out the command displayed on the button, such as
executing (OK) or canceling (Cancel) the option.
Tabs –represent multiple section of a dialog box. Choosing a tab changes the
option that appears in the dialog box.
Tabs
Text Box
List Box
Scroll Bar
Check boxes

Drop-down List

Command Buttons
Option Buttons
Toolbars

7.8. WINDOWS ACCESSORIES Elements of a Dialog Box

 Notepad . You can use Notepad to create or edit text files that do not require
formatting and are smaller than 64K (kilobytes). Notepad opens and saves
text in ASCII (text-only) format. To create or edit files that require formatting
or are larger than 64K, use WordPad.
 Calculator. You can use Calculator in standard view to perform simple
calculations, or in scientific view to perform advanced scientific and
statistical calculations.
 Paint. You can use Paint to work with pictures that use the bitmap (.bmp) file
format. You can paste a Paint picture into another document you've created,
or use it as your desktop background. You can even use Paint to view and
edit scanned photos.

Page 54 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Notepad Calculator Paint

Windows Accessories

7.9. SHORT-CUT KEYS IN WINDOWS


To do this Press this
Activate the menu bar in programs F10 or ALT
Carry out the corresponding command on the menu ALT + underlined
letter in menu
Close the current window or quit a program ALT+F4
Copy the selected item CTRL+C
Cut the selected item CTRL+X
Paste the selected item CTRL+V
Delete the selected item DELETE
Undo CTRL+Z
Display Help on the selected dialog box item F1
Display the current window’s system menu ALT+SPACEBAR
Display the Start menu CTRL+ESC
Switch windows ALT+TAB

Post Test.
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. A mouse is _______ device : a) Input b) Output c) Process d) Storage
____2. A windows accessories program used to draw pictures. a) Calculator
b) Notepad c) Paint d) all of the above
____3. In a dialog box, these are little round buttons that turn a feature on or off.
a) command button b) check box c) list box d) option button
____4. The latest version release of Windows operating system. a) Windows XP b)
Windows 2000 c) Windows ME d) Windows 2005
____5. The number of ENTER keys on the keyboard. a) 1 b) 2 c)3 d) 4
____6. To click is to press the ______ mouse button. a) Center b) Left c) Right
d) Scroll
____7. To display the START button. a) Click – b)press CTRL - ESC c) press 
key from keyboard d) all of the above

Page 55 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

____8. What is Windows? a) a wooden object b) computer program c) Plural of


Window c) Part of a house
____9. Which of the following is the close button? a) b) c) d)
____10. Which of the following is the recycle bin? a) b) c) d)

Page 56 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER VIII
I N T R O D U C T I O N T O V I S U A L B ASIC
Guide Questions:
1. Explain how to open a new project.
2. What is the use of the Properties window? Why should it be necessarily
displayed?
3. In your own words, describe a form. List at least ten windows elements that uses
a form.

Outcomes:
At the end of the Chapter, the students can:
☺ define RAD.
☺ describe and be familiar with the environment of Visual Basic.
☺ identify and use appropriately the different windows in Visual Basic
programming.
☺ distinguish the different functions and uses of the control buttons.

Pre-Test:
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. Developers of BASIC : a) Gates and Allen b) Jobs and Wozniak c) Kenemy and
Kurtz d) Marcos and Arroyo
____2. The process of rapidly creating an application in a graphic user interface
program: a) CAD b) IDE c) RAD d) RAM
____3. Which of the following is not an attribute that can be used to describe a human
being? a) brown eyes b) female c) talk d) thin
____4. In a procedure oriented languages, the emphasis of a program is on how to
accomplish a task. a) TRUE b) FALSE
____5. A function key to run a Visual BASIC program: a) F1 b) F2 c) F5 d) F8

8.1. INTRODUCTION
Welcome to Microsoft Visual Basic, the fastest and easiest way to create
applications for Microsoft Windows®. Whether you are an experienced
professional or brand new to Windows programming, Visual Basic provides you
with a complete set of tools to simplify rapid application development. The
"Visual" part refers to the method used to create the graphical user interface
(GUI). Rather than writing numerous lines of code to describe the appearance and
location of interface elements, you simply add prebuilt objects into place on
screen. If you've ever used a drawing program such as Paint, you already have
most of the skills necessary to create an effective user interface. Beginners can
create useful applications by learning just a few of the keywords, yet the power of

Page 57 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

the language allows professionals to accomplish anything that can be


accomplished using any other Windows programming language.
8.2. HISTORY OF VISUAL BASIC
Visual Basic evolved from BASIC (Beginner’s All-purpose Symbolic
Instruction Code). Basic was developed in the mid 1960’s by Professors John
Kemeny and Thomas Kurtz of Darmouth College as a language for writing simple
programs. BASIC’s primary purpose was to help people learn how to program.
The widespread use of BASIC with various types of computers (sometimes
called hardware platforms) led to many enhancements to the language. With the
development of Microsoft Windows graphical user interface (GUI) in the late
1980’s and the early 1990s, the natural evolution of BASIC was Visual Basic,
which was created by Microsoft Corporation in 1991.
Until Visual Basic appeared, developing Microsoft Windows-based
applications was a difficult and cumbersome process. Visual Basic greatly
simplifies Windows application development. Since 1991 six versions have been
released, with the latest- Visual Basic 6- appearing in September 1998.
8.3. WHAT IS VISUAL BASIC?
Visual Basic is a Microsoft Windows programming language. Visual Basic
programs are created in an Integrated Development Environment(IDE). The IDE
allows the programmer to create, run and debug Visual Basic programs
conveniently. IDEs allow a programmer to create working programs in a fraction
of the time that it would normally take to code programs without using IDEs. The
process of rapidly creating an application is typically referred to as Rapid
Application Development (RAD). Visual Basic is the world’s most widely used
RAD language.
In order to understand the application development process, it is helpful to
understand some of the key concepts upon which Visual Basic is built. Because
Visual Basic is a Windows development language, some familiarity with the
Windows environment is necessary. If you are
new to Windows programming, you need to be
aware of some fundamental differences
between programming for Windows versus
other environments.
In traditional or "procedural"
applications, the application itself controls
which portions of the code to execute and in
what sequence. Execution starts with the first
line of the code and follows a predefined path New Project Dialog box
through the application, calling procedures as
needed.

Page 58 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

In an event-driven application, the code doesn't follow a predetermined


path — it executes different code sections in response to events. Events can be
triggered by the user's actions, by messages from the system or other
applications, or even from the application itself. The sequence of these events
determines the sequence in which the code executes, thus the path through the
application's code differs each time the program runs.
8.4. VISUAL BASIC IDE
Visual Basic Integrated development Environment(IDE) allows the
programmer to create, run and debug Windows programs in one application
without the need to open additional programs.
When Visual Basic is loaded, the New Project dialog shown in is
displayed. The New Project dialog allows the programmer to choose what type
of Visual Basic program to create. Standard EXE, which is highlighted by default,
allows the programmer to create a standard executable. We use Standard EXE
for the majority of examples and exercises in this module.
Each type listed in the Figure describes a group of related files called a
project. Collectively, the project files form a Visual Basic program. The
programmer can use or leverage these existing project types to create powerful
Windows application in a fraction of the time it would normally take to create
the same applications in other programming languages.
After you have the New Project dialog box displayed, you have several
choices as to the type of program you want to create. (The Learning and
Standard Editions of Visual Basic do not display all the following types of
programs in the New Project dialog box.)

Standard EXE: Creates a stand-alone program that you can copy, give away, or
sell to others. Examples of stand-alone programs are Microsoft Word, Lotus 1-2-
3, and Netscape Navigator. Stand-alone programs have an EXE file extension.
To choose one of these options from the New Project dialog box, just
click on the option you want and click on OK.
If you choose File->New Project (or press Ctrl+N), Visual Basic displays a
New Project dialog box that does not contain the Existing or Recent tabs.
Creating ActiveX, DHTML, IIS, and Data Project files is fairly advanced, so
don't worry about such files until you figure out how to create a simple
(Standard EXE) Visual Basic program first.
Three Tabs contained in the Project dialog box
 New – for creating a new project
 Existing – for opening an existing project
 Recent – for opening a project that has been previously loaded into the
IDE.

Page 59 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Toolbox Form Title bar Menu bar Tool bar

Project
Explorer
Window

Sizing
handle

Properties
Window

Form
Layout
Window

IDE with a Standard EXE project open


Figure shows the IDE after the Standard EXE is selected. The top of the
IDE window (the title bar) displays Project1-Microosoft Visual Basic [design]. The
environment contains various windows, a menu bar and a tool bar.
A Standard EXE project contains the following windows:
 Project1–Form1(Form)
 Form Layout
 Properties-Form1
 Project-Project1
 Toolbox
Form Window
 Form Window
The Project-Form1 window contains a form named Form1, which is
where the program’s Graphical User Interface (GUI) will be displayed. A GUI
is the visual portion of the program(i.e., buttons, label, etc.) – this is where
the user enters data (called inputs) to the program and where the program
displays its results (called outputs) for the user to read. We refer the Form1
window simply as “the form”.
 Form Layout Window
The Form Layout window specifies a form’s position on the screen at
runtime. It consists of an image representing the screen and the form’s
relative position on the screen.
Screen

Form Page 60 of 118

Form Layout Window


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

 Properties Window
The Properties window displays the properties for a form or a
control. Properties are attributes such as size, position, etc. Like a form,
each control type has its own set of properties. Some properties, like
Width and Height, such as, are common to both forms and controls,
while other properties are unique to a form or a control. Controls often
differ in the number and type of properties.
Type of control

Name of control

Selected
property
Selected
property
description

Properties Window

Properties are listed either alphabetically (Alphabetic Tab) or


categorically (Categorized Tab). Alphabetic tab lists the properties in
alphabetical order and is the default. Categorized tab lists the properties
by categories, such as Appearance, Behavior, DDE, Font, Misc, etc.
Properties window displays the properties of a control that has the current focus
– control is surrounded with sizing handles.

 Project Window
The window titled Project-Project1 is called the Project Explorer and
contains the project files.
View Code Project name

View Object Forms folder

Toggle Folders Forms module

Project Explorer

View Code button – displays a window for writing Visual Basic code.
View Object button – displays the form.
Toggle Folders button – toggles the Forms folder

 Toolbox

Page 61 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

The toolbox contains controls used to customize forms. Controls are


prepackaged components that you reuse instead of writing them yourself-
this helps you write programs faster.

PictureBox
Pointer
TextBox
Label
CommandButton
Frame
OptionButtonn
CheckBox
ComboBox ListBox
VScrollBar
HScrollBar
DriveListBox
Timer
DirListBox FileListBox

Shape Line

Image Data

OLE

Toolbox Window

Prefi Description
Control
x
Pointer Used to interact with the controls on the form (I.e., resize them,
move them, etc.). The pointer is not a control.
PictureBox Pic A PictureBox control can display a graphic from a bitmap, icon, or
metafile, as well as enhanced metafile, JPEG, or GIF files. It clips
the graphic if the control isn't large enough to display the entire
image.
Label Lbl A Label control is a graphical control you can use to display text
that a user can't change directly. You can write code that changes
the text displayed by a Label control in response to events at run
time. Set the AutoSize and WordWrap properties if you want the
Label to properly display variable-length lines or varying numbers
of lines.
TextBox Txt A TextBox control, sometimes called an edit field or edit control,
displays information entered at design time, entered by the user,
or assigned to the control in code at run time.
To display multiple lines of text in a TextBox control, set the
MultiLine property to True.
Frame Fme A Frame control provides an identifiable grouping for controls. You
can also use a Frame to subdivide a form functionally—for
example, to separate groups of OptionButton controls.

Page 62 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

To group controls, first draw the Frame control, and then draw the
controls inside the Frame. To select multiple controls in a Frame,
hold down the CTRL key while using the mouse to draw a box
around the controls
Command cmd Use a CommandButton control to begin, interrupt, or end a
Button process. When chosen, a CommandButton appears pushed in and
so is sometimes called a push button.
To display text on a CommandButton control, set its Caption
property. A user can always choose a CommandButton by clicking
it.
CheckBox chk A control that provides the user with a toggle choice (checked or
unchecked). Use this control to give the user a True/False or
Yes/No option.
To display text next to the CheckBox, set the Caption property. Use
the Value property to determine the state of the control—
selected, cleared, or unavailable.
OptionButto opt A "radio button". OptionButtons are used in groups where only
n one at a time can be True.
An OptionButton control displays an option that can be turned on
or off.
When a user selects an OptionButton, the other OptionButton
controls in the same group are automatically unavailable. In
contrast, any number of CheckBox controls can be selected.
ListBox Lst A ListBox control displays a list of items from which the user can
select one or more. If the number of items exceeds the number
that can be displayed, a scroll bar is automatically added to the
ListBox control.
ComboBox cbo A control that provides a short list of items. A ComboBox control
combines the features of a TextBox control and a ListBox control—
users can enter information in the text box portion or select an
item from the list box portion of the control.
To add or delete items in a ComboBox and ListBox controls, use
the AddItem or RemoveItem method. Set the List, ListCount, and
ListIndex properties to enable a user to access items in the
ComboBox. Alternatively, you can add items to the list by using the
List property at design time.
HScrollBar hsb A horizontal scrollbar.
VScrollBar vsb A vertical scrollbar
Scroll bars provide easy navigation through a long list of items or a
large amount of information. They can also provide an analog
representation of current position. You can use a scroll bar as an
input device or indicator of speed or quantity—for example, to
control the volume of a computer game or to view the time

Page 63 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

elapsed in a timed process.


When you're using a scroll bar as an indicator of quantity or speed
or as an input device, use the Max and Min properties to set the
appropriate range for the control.
Timer tmr A Timer control can execute code at regular intervals by causing a
Timer event to occur.
The Timer control, invisible to the user, is useful for background
processing.
You can't set the Enabled property of a Timer for a multiple
selection of controls other than Timer controls.
FileListBox fil A FileListBox control locates and lists files in the directory specified
by the Path property at run time. Use this control to display a list
of files selected by file type.
DriveListBox drv A control for accessing the system disk drives (C:,A:, etc.)
A DriveListBox control enables a user to select a valid disk drive at
run time. Use this control to display a list of all the valid drives in a
user's system. You can create dialog boxes that enable the user to
open a file from a list of files on a disk in any available drive.
DirListBox dir A control for accessing files in a directory.
A DirListBox control displays directories and paths at run time. Use
this control to display a hierarchical list of directories.
Shape shp A control for drawing circles, rectangles, squares or ellipses
The Shape control is a graphical control displayed as a rectangle,
square, oval, circle, rounded rectangle, or rounded square.
Line lin A control for drawing lines.
A Line control is a graphical control displayed as a horizontal,
vertical, or diagonal line.
You can use a Line control at design time to draw lines on forms. At
run time, you can use a Line control instead of, or in addition to,
the Line method. Line controls can be displayed on forms, in
picture boxes, and in frames. You can't use the Move method to
move a Line control at run time, but you can move or resize it by
altering its X1, X2, Y1, and Y2 properties.
Image img A control for displaying images. The Image control does not
provide as many capabilities as the PictureBox, but it supports only
a subset of the PictureBox properties, events, and methods. Use
the Image control to display a graphic. An Image control can
display a graphic from a bitmap, icon, or metafile, as well as
enhanced metafile, JPEG, or GIF files.
Data dat A control for connecting to a database. Provides access to data
stored in databases using any one of three types of Recordset
objects. The Data control enables you to move from record to
record and to display and manipulate data from the records in

Page 64 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

bound controls.
OLE ole A control for interacting with other window application.
The OLE container control enables you to add insertable
objects to the forms in your Visual Basic applications.
Table 1. Controls
 Menu Bar and Tool Bar
Commands for developing, maintaining and executing programs are
contained in the IDE’s menus. Menus contains groups of related capabilities
from which the user may select appropriate choices. Rather than having to
navigate the menus for certain commonly used commands, the programmer
can select them from the tool bar. The tool bar comprised of pictures called
icons that represent commands.
Menu Description
Contains options for opening projects, closing projects,
File
printing projects, etc.
Edit Contains options such as cut, paste, find, undo, delete, etc.
View Contains options for displaying IDE windows and toolbars.
Contains options for adding features such as forms to the
Project
project.
Format Contains options for aligning and locking a form's control.
Debug Contains option for debugging.
Contains option for executing a program, stopping a program,
Run
etc.
Contains options for manipulating data retrieved from a
Query
database.
Contains options for editing and viewing the design of
Diagram
database.
Contains options for IDE tools and options for customizing the
Tools
environment.
Contains options for using, installing and removing add-ins.
Add-Ins Add-ins are typically independent software vendor (ISV)
products that extend Visual Basic's features.
Windows Contains options for arranging and displaying windows.
Help Contains option for displaying help
Table 2. Menus

8.5. VB6 BASIC PROCEDURES


To start Visual Basic
1. Click Start
2. Point to Programs
3. Point to Microsoft Visual Studio 6.0

Page 65 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

4. Click to Microsoft Visual Basic 6.0


To display the Standard tool bar
Click View, point to Toolbars, and then click Standard

Page 66 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

To display the Toolbox


Click the Toolbox button on the Standard toolbar or click View, then
click Toolbox
To display the Project window
Click Project Explorer button on the Standard toolbar or click View,
then click Project Explorer, or press Ctrl+R
To display the Properties window
Click Properties Window button on the Standard toolbar or click View,
then click properties Window, or press F4

To Add Controls on the form


1. Double-click (left click) the control in the Toolbox. This will add the
control at the center of the form.
2. Click (left click) the control to select from the toolbox. Mouse pointer will
appear as crosshair when moved into the form. Hold down the left
button of the mouse and move the mouse (a white rectangular broken
line will appear) to specify the size of the control and release the mouse.
Notice that once you created the label it will have the current focus –
surrounded with sizing handles. Select other controls by clicking to set
the current focus.
To set the value of a property
1. Select the object whose property you want to set.
2. Display the Properties window (if necessary)
3. Select the property whose value you want to set.
4. If an arrow appears in the setting box, click the list arrow in the setting
box , then click the desired value in either the list or the palette.
5. If an ellipsis (…) appears in the setting box, click the ellipsis and then
select/enter the appropriate value in the dialog box.
6. If the setting box does not display either a list arrow or an ellipsis, enter a
new value on the setting box.
To run a Visual Basic Application
Click the Start button on the standard toolbar. You can also press the
F5 key, or click Run, then click Start.
To stop running a Visual Basic application
Click the End button on the Standard toolbar, or you can also click
Run, then click End, or click the form’s Close button
To open a new project
Click File, then click New Project; or press Ctrl+N. (If you were working on
a project before choosing the New Project option and you did not save
that form and/or project, Visual Basic will display a dialog box asking if
you want to save the current files before opening another project.) When
the New Project dialog box appears, click Standard EXE, then click the OK
button.

Page 67 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

To open an existing project:


Click the Open Project button on the Standard toolbar. You can also
press Ctrl+O; or click File, then click Open Project. Select the appropriate
drive/folder, click the project name in the list of files, and then click the
Open button to open the project. (If you were working on a project
before choosing the Open Project option and you did not save that form
and/or project, Visual Basic will display a dialog box asking if you want to
save the current files before opening another project.)
To Exit Visual Basic
Click the Close button on the Visual Basic title bar. You can also click
File, then click Exit; or press Alt+Q

8.6. VISUAL BASIC DEVELOPMENT CYCLE


Before writing a Visual Basic program (or any program for that matter), get
away from your computer and plan your program using an old-fashioned paper and
pencil. After you know what you want your program to accomplish and how you
want it to look, then you can start writing your program. Skipping this crucial first
step is like building a house without blueprints. You can do it, but it will probably
take you longer.
Writing a Visual Basic program requires nine steps - three steps fewer than
those required to overcome an addictive habit. The first eight steps are what
programmers call the development cycle. The ninth step is what programmers call
job security.
1. Decide what you want the computer to do.
2. Decide how your program will look on the screen. (The appearance of your
program is its user interface).
3. Click File New Project (or press ctrl+N)
4. Draw your user interface on the form using common parts such as windows,
menus, and command buttons. The parts of a user interface are objects or
controls drawn from the toolbox.
5. Define the name, color, size, appearance, or any other feature of each user
interface object. An object's characteristics are its properties using the
properties window.
6. Save your work.(See Chapter 8.8. Saving for the first time. )
7. Write instructions in BASIC to make each part of your program do something.
BASIC instructions are commands you write on the code editor window.
8. Run your program to see if it works(Click the Start button. or click Run
Start, or press F5 key on your keyboard)
9. Fix any errors (or bugs) in your program.
10. Save your work (Click the Save button, or click File Save, or press Ctrl+S
key from your keyboard)

Page 68 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

11. Repeat steps 8 through 11 over and over again until you get tired of
searching for more bugs.
Although you don't have to memorize these eleven steps, you do have to
follow them. Shortcuts aren't an option. Trying to skip from Step 1 to Step 5 is like
trying to start a car by using the gas pedal but forgetting to turn the ignition key.
You can try it, but you're not going to get anywhere.
Believe it or not, Step 1 is actually the hardest and most important step of all.
After you know exactly what you want your program to do, it's just a matter of
finding ways to do it. Persistence and creativity are helpful, as are lots of caffeine-
laden beverages and plenty of sleepless nights in front of the computer screen.

8.7. DEFINING PROPERTIES


After you had created a form and draw some objects on it, the next step is
to define the properties of each form and object. An object's properties
determine the object's name, color, size, location, and appearance on the
screen.
Different objects have different properties. Each time you draw an object
on a form, Visual Basic assigns default property values, which define a generic
object that no one can really use. If you want to customize an object, you need
to define one or more properties for each object that your program uses. As you
click an object or a control on the form, you see its corresponding property on
the properties window.
8.8. SAVING THE PROJECT
When you select Save Project from the file menu, Visual Basic will display
the Save File As dialog box. You will be asked to save the form( *.frm) files first
then the program (*.vbp) files You can also save the files individually by selecting
Save Project As to save the project or Save Form As from the File menu. The
following steps will help you through the process.

Create New
Up one level
Existing Folder

Save-As Dialog Box


Step 1. Click the Create New Folder button to create a folder for the project.
Step 2. Type the name of the folder and press enter. Ex. Sample1

Page 69 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Step 3. Open the folder(ex. Sample1) by clicking the folder and click
. . Note that current folder on the Save-in textbox is the folder you
just created.
Step 4. Click on the Filename: textbox and type the name of the form. Ex.
frmMyform1(Note: The text on the Save as Type: should be Form Files
(*.frm)
Step 5. Click SAVE or press Enter from your keyboard.( you have just saved the
form)
Step 6. Click on the Filename: textbox and type the name of the project. (Note:
The text on the Save as Type: should be Project Files (*.vbp)
Step 7. Click SAVE or press Enter from your keyboard. ( you have just saved the
project)

Step1
Steps 2 & 3

Steps 6 & 7
Steps 4 & 5
Saving Procedure

When you have completed all the files for a project, you can convert the
project into an executable file (.exe): From the File menu, choose the Make
project.exe command.

Page 70 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

8.9. FONT DIALOG BOX


You can change the appearance of the caption of labels, option buttons,
check boxes, frames, command button or text on a textbox by clicking the ellipsis
at the right of the Font property. This dialog box will change the fonts, the font
size, and/or the font style you use for text and data fields

Font
Lists all the fonts that you have installed for Windows. When the box
first appears, the font already in use for the selected element is
highlighted.
Font Style
Lists four additional attributes that you can assign to the font
selected:
 Regular — Standard, unmodified style
 Bold —will make the text bolder or darker
 Italic — will make the text slant to the right
 Bold Italic — Bold text slanted to the right
Size
Lists common point sizes for the highlighted font. When the box
first appears, the point size for the font already in use for the selected
element is highlighted, and the highlighted point size appears in the edit
box at the top. You can select directly from the list or type the new point
size in the edit box at the top. For common fonts, 1 pt is equal to 1/72 of
an inch. Thus, a 72 pts. Font is 1 inch in actual height.
Effects
Lists two additional options that you can use for highlighting the
selected font.
 Strikeout — Prints the strikeout character across the font
 Underline —
Underlines the font
Sample
Displays a sample of
the font you have selected.
The sample shows the font,
style, size, effects, and color
you have specified. You can
use this box to preview the
results as you experiment
with different formatting
options.
Font Dialog Box

Page 71 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Post-Test.
Multiple Choice. Write the capital letter of your answer on the space provided.
______1. A control which appears like a push button a) check box
b)command button c) frame d) Label
______2. A menu that contains the START/RUN command. a) Edit b) File c) Run
d) Tools
______3. In which window do you set the characteristics that control an object’s
appearance and behavior?
a) Main b) Form c) Properties d) Toolbox
______4. To delete a control on a form at design-time, use the _____ button. a)
Backspace b) Delete c) Enter d) Cut
______5. Tools you use when designing your application are found in the
a) toolbox b) toolbar c) user interface d) user screen
______6. Visual Basic 6.0 was developed by
a) APPLE b) HP c) Microsoft d) UNIX
______7. Visual Basic is a/an ______ language.
a) assembler b) mnemonic c) object-oriented/event driven
d) procedure-oriented
______8. Which is true about the form layout window?
a) permanent b) movable c) fix d) none of the above.
______9. Which window in Visual Basic is the most important?
a) form layout b) Project c) properties d) all of the above
______10. You design your user interface in a
a) design bar b) form c) menu bar d) toolbar

Page 72 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER IX
METHODS AND EVENT PROCEDURES
Guide Questions:
1. Explain the difference between properties methods and events.
2. List down at least 5 properties of a form and explain its use.
3. What are event procedures? How do they differ from procedures in other low
level programming language?

Outcomes:
At the end of the Chapter, the students can:
☺ create a simple graphic user interface after the first laboratory session.
☺ save correctly the different files associated with a visual basic project
☺ understand the Visual Basic procedures, events and object properties

Pre-Test.
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. A function key to open the code window a) F2 b)F7 c) F8 d) F12
____2. Reserve words in Visual Basic code window is colored _____
a) black b) blue c) green d) red
____3. An event called when the user moves the mouse. a) activate b) keyup c)
mousemove d) mouseup
____4. A textbox property that changes the color of the text.
a) backcolor b) fontcolor c) forecolor d) fontbold
____5. Which of the following is an event? a) alignment b) change c) height
d) hide

9.1. INTRODUCTION
In Visual Basic an object is a combination of code and data that can be treated
as a unit. An object can be a piece of an application, like a control (e.g. textbox,
command button, label, etc.) or a form. An entire application can also be an object.
Most of the programming tasks in visual basic is done through working with the
objects.
Visual Basic objects have their own properties, methods and events. Properties
can be thought of as an object's attributes, methods as its actions, and events as its
responses.
An everyday object like a child's helium balloon also has properties, methods
and events. A balloon's properties include visible attributes such as its height,
diameter and color. Other properties describe its state (inflated or not inflated), or
attributes that aren't visible, such as its age. By definition, all balloons have these
properties; the settings of these properties may differ from one balloon to another.

Page 73 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

A balloon also has inherent methods or actions that it might perform. It has an
inflate method (the action of filling it with helium), a deflate method (expelling its
contents) and a rise method (if you were to let go of it). Again, all balloons are
capable of these methods.
Balloons also have predefined responses to certain external events. For
instance, a balloon would respond to the event of being punctured by deflating
itself, or to the event of being released by rising into the air.

Objects have properties, respond to events, and perform methods

If you were able to program a balloon, the Visual Basic code might look like the
following. To set the balloon's properties:
Balloon.Color = Red Balloon.Diameter = 10
Balloon.Inflated = True
Note the syntax of the code — the object (Balloon), followed by the property
(.Color), followed by the assignment of the value (Red). You could change the color
of the balloon from code by repeating this statement and substituting a different
value. Properties can also be set in the Properties window while you are designing
your application.
A balloon's methods are invoked like this:
Balloon.Inflate Balloon.Deflate Balloon.Rise 5
The syntax is similar to the property — the object (a noun) followed by the
method (a verb). In the third example, there is an additional item, called an
argument, which denotes the distance to rise. Some methods will have one or more
arguments to further describe the action to be performed.
The balloon might respond to an event as follows:
Sub Balloon_Puncture()
Balloon.Deflate
Balloon.MakeNoise "Bang"
Balloon.Inflated = False
Balloon.Diameter = 1
End Sub
In this case, the code describes the balloon's behavior when a puncture event
occurs: invoke the Deflate method, then invoke the MakeNoise method with an
argument of "Bang" (the type of noise to make). Since the balloon is no longer

Page 74 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

inflated, the Inflated property is set to False and the Diameter property is set to a
new value.
While you can't actually program a balloon, you can program a Visual Basic
form or control. As the programmer, you are in control. You decide which properties
should be changed, methods invoked or events responded to in order to achieve the
desired appearance and behavior.
Form objects are the basic building blocks of a Visual Basic application, the
actual windows with which a user interacts when he runs the application. Forms
have their own properties, events, and methods with which you can control their
appearance and behavior.

Forms and controls have their own properties, events, and methods

The work with forms and controls, set their properties, and write code for their
events at design time, which is any time you're building an application in the Visual
Basic environment. Run time is any time you are actually running the application and
interacting with the application as the user would.
Suggestions and Reminders about Visual BASIC Programming
1. Plan ahead
2. Think like a user
3. Think components
4. Learn by doing
5. Learn from Visual BASIC programs
9.2. WRITING BASIC CODE
When you're happy with the way your program looks, the next step involves
writing BASIC commands (also known as code) to make your program actually work.
The whole purpose of Visual Basic code is to tell objects on a form what to do
when the user does something. For example, if the user clicks on an OK or Cancel
command button, nothing happens unless you've written BASIC commands to tell
your computer exactly what to do.
Any time a user presses a key, moves the mouse, or clicks the mouse button,
it's called an event. Whenever an event occurs, your BASIC commands tell the
computer, "Something just happened. Let's do something about it!"

Page 75 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Essentially, writing a Visual Basic program means drawing your user interface
and then writing BASIC code to make it work. If you can handle these two steps
without losing your mind, you can start writing your very own programs using Visual
Basic.
9.3. EVENT PROCEDURES
Whenever the user takes any action, such as clicking the mouse, pressing a
key, passing out on the keyboard, or putting a bullet through the monitor, the action
is called an event. The moment an event occurs, Visual Basic looks for BASIC code to
tell the program what to do. The BASIC code that responds to a specific event is
called an event procedure.
A single Visual Basic program can consist of several thousand event
procedures. If you have that many, however, you either have a tremendously
complicated program or you're an incredibly incompetent programmer.
With so many possible events and so many possible event procedures in a
single program, how does Visual Basic know which event procedure to use?
The answer is easy. When an event occurs, this event is usually directed at
some part of your program's user interface. For example, most users click the mouse
button only when the mouse is pointing at an object, such as a command button,
check box, or menu command on the screen.
Every object can have one or more event procedures, and each event
procedure responds to one specific event, such as clicking the mouse or pressing a
key.
 Types of Events
Events can be classified into three categories:
1. Keyboard events occur when the user presses a certain key, such as Tab, or a
certain keystroke combination, such as Ctrl+P.
2. Mouse events occur when the user moves the mouse, clicks or doubleclicks
the mouse button, or drags the mouse across the screen.
3. Program events occur when a Visual Basic program does something on its
own, such as loading, opening, or closing a form. Whereas keyboard and
mouse events occur when the user does something, program events occur
when BASIC code does something.

Although Visual Basic can respond to a multitude of events, you generally


want your user interface to respond only to a few events, such as clicking the
mouse or pressing a certain key. As soon as Visual Basic detects an event, your
program immediately looks to see what part of the user interface needs to
respond.
When the user clicks the mouse, for example, Visual Basic first identifies
the event. ("Okay, that was a mouse click.") Next, Visual Basic looks to see where
the user clicked the mouse. ("The user clicked the mouse on the OK command
button.")

Page 76 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Visual Basic then finds that particular command button's event procedure,
which contains BASIC code that tells your program what to do when the user
clicks the mouse button.

 Creating Event Procedures


One object can respond to one or more events. For example, a command
button can respond to the user's clicking the mouse button or pressing Enter.
Two or more objects can respond to the same event. For example, both a
command button and a check box can respond to a mouse click, but they may
have different instructions that tell Visual Basic what to do next.
To write an event procedure, you have to perform the following tasks:

Identify the part of your user interface that is going to respond

Open the Code window.

Identify the event to which Visual Basic is to respond.

Write BASIC code to process the event.

Make sure that all the objects of your user interface have names before
creating any event procedure. If you create an event procedure for an object
and later change that object's name, you will have to rewrite your event
procedures.
The following three parts of a user interface can have events associated with
them:
1. Forms
2. Objects (command buttons, check boxes, and so on)
3. Pull-down menus
To create an event procedure for a form, follow these steps:
1. Click anywhere on the form, but not on any object on the form.
2. Open the Code window by pressing F7, choosing View Code, or
double-clicking anywhere on the form (but not on any object on
the form).
Visual Basic displays the Code window on the screen along with an
empty event procedure.
To create an event procedure for an object, such as a command button or
check box, follow these steps:
1. Click on the object so that little black rectangles (handles) appear
around it.
2. Open the Code window by pressing F7, choosing View-Code, or by
double-clicking on the object.
Visual Basic displays the Code window on the screen along with an
empty event procedure. You may still have to click on the Procedure list
box to choose a specific event to respond to, such as Click or KeyPress.
If you double-click on an object (such as a command button), Visual
Basic displays the Code window right away.

Page 77 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

To create an event procedure for a pull-down menu, follow these steps:


1. Click on the pull-down menu title containing the menu command
you want.
2. Click on the menu command you want to write BASIC code for.
Visual Basic displays the Code window on the screen along with an
empty event procedure.
 Using the Code Editor
The Visual Basic Code Editor is a window where you write most of
your code. It is like a highly specialized word processor with a number of
features that make writing Visual Basic code a lot easier. The Code Editor
window shown in the figure will be opened when you double-click a control
or when you click the View Code button on the Project Explorer window.

The Code Editor Window

 Syntax Color Highlighting


A coloring scheme imposed on the
line of code in an error free statement in
the code window
Green – Comments Auto Quick Info Feature
Black – Event procedures
Blue – Words recognized by Visual
Basic (called keywords or reserve
words)
Red – Incorrect command / Syntax
 Automatic Code Completion
Visual Basic makes writing the code
Auto List Member feature
much easier with features that can
automatically fill in statements, properties, and arguments for you. As you enter
the code, the editor displays lists of appropriate choices, statement or function
prototypes, or values. Options for enabling or disabling these and other code
settings are available on the Editor tab of the Options dialog, accessed through
the Options command on the Tools menu.

Page 78 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

When you enter the name of a control in your code, the Auto List Members
feature presents a drop-down list of properties available for that control. Type in
the first few letters of the property name and the name will be selected from the
list; the TAB key will complete the typing for you. This option is also helpful when
you aren't sure which properties are available for a given control. Even if you
choose to disable the Auto List Members feature, you can still access it with the
CTRL+J key combination.
The Auto Quick Info feature displays the syntax for statements and
functions. When you enter the name of a valid Visual Basic statement or
function, the syntax is shown immediately below the current line, with the first
argument in bold. After you enter the first argument value, the second argument
appears in bold. Auto Quick Info can also be accessed with the CTRL+I key
combination.

9.4. PARTS OF AN EVENT PROCEDURE


When you create an event procedure for the first time, Visual Basic displays
an empty event procedure in the Code window. All empty event procedures
consist of two lines, such as:
current event

keywords
control name

input area

Fig. 77. Click Event Procedure

The first line of any event procedure contains five parts:


1. Private Sub: Identifies the procedure as a subroutine.
2. The object's name: In this example, the object is a command button
named cmdExit.
3. An underscore
4. The event name: In this example, click, the event is a mouse click.
5. A pair of parentheses ( ), containing any data that the subroutine may
need to work: In this example, the parentheses are empty,
indicating that no additional data are necessary.
The preceding event procedure says to the computer, "Here are the
instructions to follow whenever the user clicks the mouse on the command
button named cmdExit. Now leave me alone."
Because this example contains no instructions to follow, this event
procedure does absolutely nothing, much like many co-workers you may know.
Any time you change the name of an object, make sure that you change
the name of all event procedures connected to the newly named object as well.

Page 79 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Otherwise, Visual Basic doesn't know which event procedures belong to which
objects on your user interface.
9.5. COMMON EVENTS
Activate – occurs when a form becomes the active window
Change – occurs when the contents of a combo box, directory list box, drive
list box, scroll bar, label, picture box, or text box change.
Click – occurs when the user clicks the mouse button once on the object
DblClick – occurs when the user clicks the mouse button twice in rapid
succession on an object
Deactivate – occurs when a form changes from being an active window
to an inactive window
DragDrop – occurs when the user holds down the mouse button on an object,
moves the mouse, and releases the mouse button
DragOver – occurs when the user holds down the mouse button on an object
and moves the mouse.
DropDown – occurs when the list portion of a combo box drops down
to display a list of choices
GotFocus – occurs when an object becomes highlighted when the user
presses Tab or clicks on an object, or if a form loads.
KeyDown – occurs when the user presses a key
KeyPress – occurs when the user presses and releases an ANSI key, such as a
keyboard character, Ctrl key combination, Enter, or backspace
key. (Basically, an ANSI key can be any letter, number, or oddball
keystroke combination that you press).
KeyUp – occurs when the user releases a key
LostFocus – occurs when an object is no longer highlighted because the user
pressed Tab or clicked on another object, or if a form has
unloaded.
MouseDown – occurs when the user presses a mouse button
MouseMove – occurs when the user moves the mouse
MouseUp – occurs when the user releases a mouse button

The combination of the object name and the event name defines the
name for an event procedure. Because object names must always be unique, no
two-event procedures on the same form can have the same name.

Page 80 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Post-Test .
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. A property that displays text in a button is: a) Alignment b) Appearance
c) Caption d) Text
____2. chkfree.value = 1 : a) b) c) d)
____3. lblGo’s caption can be centered by the code: lblGo.Alignment=____ : a) 0 b) 1
c) 2 d) null
____4. On the code window, the color of “cmdenter_click( )” is : a) black b) blue
c) green d) red
____5. The extension of a Visual Basic form : a) .bas b) .fme c) .frm d) .vbp
____6. The first procedure in Visual Basic programming : a) Coding
b) Designing c) Documenting d) Planning
____7. To execute/run a Visual Basic program click this button. a) b) c) d)
____8. Which of the following is an event? a) click b) color c) frame d) form
____9. Which of the following is not a mouse event? a) click b) dragover c) gotfocus
d) keydown
____10. Window to access to change the Height property of a control:
a) form b) form layout c) property d) toolbox

Page 81 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER X
B A S I C E L E M E N T S O F A V I S U A L B ASIC P R O G R A M
Guide Questions:
1. What are data types and variables? What are the important facts a programmer
always should remember when using them in the program?
2. What is/are the difference of the integer division operator (\) and the modulus
operator (mod)?
3. Convert the Pythagorean theorem formula to programming formula.
Outcomes:
At the end of the Chapter, the students can:
☺ understand the basic elements of a Visual BASIC program
☺ write simple programs in Visual BASIC
☺ be familiar with the use of fundamental data types
☺ use arithmetic operators
☺ understand the precedence of arithmetic operators
Pre-Test.
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. Which of the following is a valid declaration?
a) Dim x as integer b) Private x as float c) Sub x as long d) Variable x as double
____2. A variable declared at module level can be available in:
a) all modules b) all programs c) current procedure d) all forms
____3. Which is a valid variable? a)As b)intarea c) 2>1 d) dim
____4. A data type assigned to undeclared variables: a) byte b) date c)long d) variant
____5. Which of the following operators will be the last to be evaluated?
a) \ b) ^ c) + d) *

10.1. INTRODUCTION
The Visual BASIC language facilitates a structured and disciplined approach
to computer program design. When writing a program, it is equally essential to
understand the types of building blocks that are available and to employ proven
program construction principles. In this chapter, we introduce the Visual BASIC
programming concepts and illustrate many of its important features like memory
concepts, arithmetic operators, decision-making or comparison operators, and
data types used in Visual BASIC programming.
10.2. VARIABLES, CONSTANT, DATA TYPES AND OPERATORS
In Visual Basic, you use variables to temporarily store values during the
execution of an application. Variables have a name (the word you use to refer to
the value the variable contains) and a data type (which determines the kind of
data the variable can store).

Page 82 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

You use assignment statements to perform calculations and assign the


result to a variable:
ApplesSold = 10 ' The value 10 is passed to the variable.
ApplesSold = ApplesSold + 1 ' The variable is incremented.
Note that the equal sign in this example is an assignment operator, not
an equality operator; the value (10) is being assigned to the variable
(ApplesSold).
10.3. DECLARING VARIABLES
To declare a variable is to tell the program about it in advance. You
declare a variable with the Dim statement, supplying a name for the variable:
Dim variablename [As type]
Variables declared with the Dim statement within a procedure exist only
as long as the procedure is executing. When the procedure finishes, the value of
the variable disappears. In addition, the value of a variable in a procedure is local
to that procedure — that is, you can't access a variable in one procedure from
another procedure. These characteristics allow you to use the same variable
names in different procedures without worrying about conflicts or accidental
changes.

A variable name:
 Must begin with a letter.
 Can't contain an embedded period or embedded type-declaration
character.
 Must not exceed 255 characters.
 Must be unique within the same scope, which is the range from which
the variable can be referenced — a procedure, a form, and so on.
The optional As type clause in the Dim statement allows you to define the
data type or object type of the variable you are declaring (see Table 4). Data
types define the type of information the variable stores. Some examples of data
types include String, Integer, and Currency. Variables can also contain objects
from Visual Basic or other applications. Examples of Visual Basic object types, or
classes, include Object, Form1, and TextBox.
Examples:
Valid variables: x, q1, y2k, Exer2, Quiz_12,watchamacallit, etc.
Invalid variables : 808Q, as, we=2, v>b, dim, if, end, etc.
The scope of a variable defines which parts of your code are aware of its
existence. When you declare a variable within a procedure, only the code within
that procedure can access or change the value of that variable; it has a scope
that is local to that procedure.

Depending on how it is declared, a variable is scoped as either a


procedure-level (local) or module-level variable.

Page 83 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Scope Private Public


Variables are private to Not applicable. You cannot
Procedure-
the procedure in which declare public variables
level
they appear. within a procedure.
Variables are private to
Variables are available to all
Module-level the module in which
modules.
they appear.
Procedure-level variables are recognized only in the procedure in which
they're declared. These are also known as local variables. You declare them with
the Dim or Static keywords. For example:
Dim intTemp As Integer
–or–
Static intPermanent As Integer
Values in local variables declared with Static exist the entire time your
application is running while variables declared with Dim exist only as long as the
procedure is executing.
Local variables are a good choice for any kind of temporary calculation. For
example, you can create a dozen different procedures containing a variable
called intTemp. As long as each intTemp is declared as a local variable, each
procedure recognizes only its own version of intTemp. Any one procedure can
alter the value in its local intTemp without affecting intTemp variables in other
procedures.
By default, a module-level variable is available to all the procedures in that
module, but not to code in other modules. You create module-level variables by
declaring them with the Private keyword in the Declarations section at the top of
the module. For example:
Private intTemp As Integer
At the module level, there is no difference between Private and Dim, but
Private is preferred because it readily contrasts with Public and makes your code
easier to understand.
To make a module-level variable available to other modules, use the Public
keyword to declare the variable. The values in public variables are available to all
procedures in your application. Like all module-level variables, public variables
are declared in the Declarations section at the top of the module. For example:
Public intTemp As Integer
Note: You can't declare public variables within a procedure, only within the
Declarations section of a module.

Page 84 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

10.4. CONSTANT
A constant is a meaningful name that takes the place of a number or
string that does not change. Although a constant somewhat resembles a
variable, you can't modify a constant or assign a new value to it as you can to a
variable. There are two sources for constants:
 Intrinsic or system-defined constants are provided by applications and
controls. Visual Basic constants are listed in the Visual Basic (VB) and
Visual Basic for applications (VBA) object libraries in the Object Browser.
Other applications that provide object libraries, such as Microsoft Excel
and Microsoft Project, also provide a list of constants you can use with
their objects, methods, and properties.
 Symbolic or user-defined constants are declared using the Const
statement.

The syntax for declaring a constant is:


Const constantname[As type] = expression
example:
Const conPi = 3.14159265358979
Const conMaxPlanets As Integer = 9
10.5. DATA TYPES
Variables are placeholders used to store values; they have names and data
types. The data type of a variable determines how the bits representing those
values are stored in the computer's memory. When you declare a variable, you
can also supply a data type for it. All variables have a data type that determines
what kind of data they can store.
By default, if you don't supply a data type, the variable is given the Variant
data type. The Variant data type is like a chameleon — it can represent many
different data types in different situations. You don't have to convert between
these types of data when assigning them to a Variant variable: Visual Basic
automatically performs any necessary conversion.

Page 85 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Memory
Data Type Pre- fix Stores Range of values
Required

Boolean bln Logical Values 2 bytes True or False


Byte byt Binary values 1 byte 0 to 255
Currency cur Numbers with 8 bytes -922337203685477.5808 to
up to 15 digits 922337203685477.5808
to the left of
the decimal
Date dte and 4 digits to 8 bytes 1 January 100 to 31
the right December 9999
Double dbl Date and time 8 bytes 0:00:00 to 23:59:59
information -1.79769313486232E308 to
Floating-point –4.94065645841247E-324
numbers 1.79769313486232E308 to
Integer int 2 bytes 4.94065645841247E-324
Long lng 4 bytes -32768 to 32767
Object obj Whole 4 bytes -2147483648 to
numbers 2147483647
Single sng Whole 4 bytes Any Object type
numbers
String str Any object 10+ -3.402823E38 to –
Variant vnt reference bytes 1.401298E-45
Floating-point 16 bytes 3.402823E38 to 1.401298E-
numbers 45
Text 0 to ~2000000000
Information characters
Any other data Any value within the range
types listed above

Before using a non-Variant variable, you must use the Private, Public, Dim
or Static statement to declare it As type. For example, the following statements
declare an Integer, Double, String, and Currency type, respectively:
Private H As Integer
Dim Amt As Double
Static YourName As String
Public BillsPaid As Currency
A Declaration statement can combine multiple declarations, as in these
statements:
Private intJ As Integer, dblAmt As Double
Private strYourName As String, curBillsPaid As Currency
Private intTest, intAmount, intJ As Integer

Page 86 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

10.6. ARITHMETIC OPERATORS


Precedence Arithmetic Operators Evaluation
First Exponentiation (^) Used to raise a number to the
power of an exponent
Ex. 2^3 = 8
Second Negation (-) Makes a number negative
Third Multiplication and division (*, Used to multiply and divide
/) numbers
Ex. 2 * 4 = 8, 8/4=2
Fourth Integer division (\) Used to divide two numbers and
return an integer result
Ex. 10 \ 4 = 2
Fifth Modulus arithmetic (Mod) Used to divide two numbers and
return the remainder
Ex. 5 mod 2 = 1
Sixth Addition and subtraction (+, -) Used to add and subtract two
numbers.
String concatenation (&) Used to concatenate strings
Ex. “Hello” & “ world” this will
result to “Hello world”
Example Computations ( if x = 3,y = 5, z = 1)
a) N = x + y * z
N= 3 + 5 * 1
N= 3 + 5
N=8
b) N = (y + z) / x ^ z
N = (5 + 1)/ 3 ^ 1
N = 6/ 3
N=2
c) N = y mod x * z + y ^ ( y \ x)
N = 5 mod 3 * 1 + 5 ^ ( 5 \ 3)
N = 5 mod 3 + 5 ^ 1
N=2+5
N=7
d) N = x mod y \ ((x - z) ^ z ^ ( y – x))
N = 3 mod 5 \ ((3 – 1) ^ 1 ^ (5 – 3))
N = 3 mod 5 \ (2 ^ 1 ^ 2)
N = 3 mod 5 \ 4
N = 3 mod 1
N=0
Evaluate the following expressions when a=3, b=2, c=1.)
1. m = (a + b * c) + a Mod b Mod c ans. = 5

Page 87 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

2. m = a * (a - b) ^ b * (b - c) ^ c * (c - a) ans. = -6
3. m = a ^ (a - b) * b ^ (b - c) + c ^ (a - c) ans. = 7

Programming Exercise Set A.


1. Prepare a program that will compute for the Area and Perimeter of a right
triangle with base = 18 and Height = 40.(Area= ½ BH)
2. Prepare a program that will compute for the future worth of money invested
using simple interest method. Display individually the interest gained and the
future amount.(F=P+I, I=Prt).
3. Develop a program that would compute for the roots of a quadratic equation
where the values of A, B, and C are entered by the user. Display the roots in a 3
decimal places.
Post-Test .
Multiple Choice. Write the capital letter of your answer on the space provided.
______1. The location of an object in a form is measured in ____ from the edges of
the form: a) characters b) inches c) points d) twips
______2. The ____ instruction tells Visual Basic to end an application:
a) Done b) End c) Finish d) Stop
______3. You use the _____ character to assign an access key to a control:
a) & b) * c) @d) $
______4. _______ are memory locations in which you store information temporarily:
a) Boxes b) Labels c)Variables d) Variances
______5. Which of the following are valid variable names ?
a) cur94Income b) curincome c) curInc_94 d) all
______6. Which of the following is the only data type that can store numbers and
strings? a) Integer b) Long c) Single d) Variant
______7. To execute/run a Visual Basic program click this button.
a) b) c) d)
______8. Which of the following is an event a) click b) color c) frame d) form
______9. Which of the following is not a mouse event.
a) click b) dragover c) gotfocus d) keydown
______10. Window to access to change the Height property of a control
a) form b) form layout c) property d) toolbox

Page 88 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

CHAPTER XI
DECISION STRUCTURES
Guide Questions:
1. How do you think the decision making capability of the computer differs from
yours? Explain the limitations.
2. List down the limitations when using If..then..else statement.
3. Can you enumerate examples of real life application programs that uses decision
making. Site the applications where it is applicable.

Outcomes:
At the end of the Chapter, the students can:
☺ use the comparison and logical operators
☺ write decision-making programs in Visual BASIC
☺ write simple decision-making statements
☺ use the IF/THEN, IF/THEN/ELSE and SELECT-CASE statements.
Pre-Test.
Multiple Choice. Write the capital letter of your answer on the space provided.
____1. A comparison operator not suited for the given equation: 12 ___ 7 = true
a) > b) < c) < > d) >=
____2. Which is correct? a) Case 9 - 11 b) Case 11,115,119 c) case A, 5 d) Case none
____3. Evaluate the expression: 3 > 6 AND 7 > 4 a) True b) False
____4. Evaluate the expression: X - Y = Z when x=5, y=3 and z=2 a) True b) False
____5. Evaluate the expression: A OR B when A=true and B=false a) True b) False

11.1. INTRODUCTION
You use the selection structure, also called the decision structure, when
you want a program to make decision or comparison and then based on the
result of that decision or comparison, to select one of two paths. You can think
of the selection structure as being a fork in the road. The theory and principles of
structured programming will also be presented in this chapter. The techniques
that you will learn here are applications of decision-making capability in
computer programming applicable to most of high-level languages including
Visual BASIC. Application of pre-built functions in Visual BASIC will also be
covered in this chapter.
11.2. COMPARISON OPERATORS
Comparison operators compare two operands and returns Boolean values
depending on the outcome of the evaluation.

Page 89 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Comparison Boolean
Example
Operators Value
10 = 10 - (10 is equal to 10) TRUE
Equality (=)
1=5 - ( 1 is equal to 5 ) FALSE
10 < > 10 - (10 is not equal to 10) FALSE
Inequality (<>)
1<>5 - ( 1 is not equal to 5 ) TRUE
10 < 10 - (10 is less than 10) FALSE
Less than (<)
1<5 - ( 1 is less than 5 ) TRUE
10 > 10 - (10 is greater than 10) FALSE
Greater than (>)
1>5 - ( 1 is greater than 5 ) FALSE
Less than or equal 10 < = 10 - (10 is less than or equal to 10) TRUE
to (<=) 1<=5 - ( 1 is less than or equal to 5 ) TRUE
Greater than or 10 > = 10 - (10 is greater than or equal to 10) TRUE
equal to (>=) 1>=5 - ( 1 is greater than or equal to 5 ) FALSE
11.3. LOGICAL OPERATORS
These operators are used in Boolean expressions. Logical operators may
be used to form more complex conditions by combining simple conditions.
Boolean
Logical Evaluation Example
Value
Not Ex. Not expression Not ( 1 > 10 ) TRUE
- Evaluates to True if the Not (10 = 10) FALSE
expression is false,
otherwise, False.
And Ex. Expression1 And (10 = 10 ) And (1 < 5) TRUE
Expression 2 (10 <> 10) And ( 1 > 5) FALSE
- evaluates to True if (10 > 10) And ( 1 < 5 ) FALSE
expressions are true,
otherwise, False.
Or Ex. Expression1Or (10 = 10 ) Or (1< 5) TRUE
Expression2 (10 <> 10) Or ( 1 > 5) FALSE
- Evaluates to True if either of (10 > 10) Or ( 1 < 5 ) TRUE
the expression is true,
otherwise, False
11.4. DECISION STRUCTURE STATEMENTS
Visual Basic procedures can test conditions and then, depending on the
results of that test, perform different operations. The decision structures that
Visual Basic supports include:
1. If...Then
2. If...Then...Else 3. Select Case

Page 90 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

If-Then Statement
Use an If...Then structure to execute one or more statements
conditionally. You can use either a single-line syntax or a multiple-line block
syntax:
1. If condition Then statement
2. If condition Then
statements
End If
The condition is usually a comparison, but it can be any expression that
evaluates to a numeric value. Visual Basic interprets this value as True or
False; a zero numeric value is False, and any nonzero numeric value is
considered True. If condition is True, Visual Basic executes all the statements
following the Then keyword. You can use either single-line or multiple-line
syntax to execute just one statement conditionally (these two examples are
equivalent):
If x < 10 Then Print “Hello”
---- or -----
If x < 10 Then
Print “Hello”
End If
Notice that the single-line form of If...Then does not use an End If
statement. If you want to execute more than one line of code when
condition is True, you must use the multiple-line block If...Then...End If
syntax.
If x < 10 Then
Print “Hello”
cmdOk.Enabled = False ' Disable button control.
End If
If -Then-Else
Use an If...Then...Else block to define several blocks of statements, one
of which will execute:
If condition1 Then
[statementblock-1]
[ElseIf condition2 Then
[statementblock-2]] ...
[Else
[statementblock-n]]
End If
Visual Basic first tests condition1. If it's False, Visual Basic proceeds to
test condition2, and so on, until it finds a True condition. When it finds a True
condition, Visual Basic executes the corresponding statement block and then
executes the code following the End If. As an option, you can include an Else

Page 91 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

statement block, which Visual Basic executes if none of the conditions are
True.
If...Then…ElseIf is really just a special case of If...Then...Else. Notice
that you can have any number of ElseIf clauses, or none at all. You can
include an Else clause regardless of whether you have ElseIf clauses.
Example:
If Number < 10 Then
Digits = 1
ElseIf Number < 100 Then
Digits = 2
Else
Digits = 3
End If
Notice that you can always add more ElseIf parts to your If...Then
structure. However, this syntax can get tedious to write when each ElseIf
compares the same expression to a different value. For this situation, you
can use a Select Case decision structure.
Select Case
Visual Basic provides the Select Case structure as an alternative to
If...Then...Else for selectively executing one block of statements from among
multiple blocks of statements. A Select Case statement provides capability
similar to the If...Then...Else statement, but it makes code more readable
when there are several choices.
A Select Case structure works with a single test expression that is
evaluated once, at the top of the structure. Visual Basic then compares the
result of this expression with the values for each Case in the structure. If
there is a match, it executes the block of statements associated with that
Case:
Select Case testexpression
[Case expressionlist1
[statementblock-1]]
[Case expressionlist2
[statementblock-2]]
.
[Case Else
[statementblock-n]]
End Select
Each expressionlist is a list of one or more values. If there is more
than one value in a single list, the values are separated by commas. Each
statementblock contains zero or more statements. If more than one Case
matches the test expression, only the statement block associated with the
first matching Case will execute. Visual Basic executes statements in the Case

Page 92 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Else clause (which is optional) if none of the values in the expression lists
matches the test expression. Example:

Dim NumberNumber = 8 ' Initialize variable.


Select Case Number ' Evaluate Number.
Case 1 To 5 ' Number between 1 and 5, inclusive.
Debug.Print "Between 1 and 5"' The following is the only Case
clause that evaluates to True.
Case 6, 7, 8 ' Number between 6 and 8.
Debug.Print "Between 6 and 8"
Case 9 To 10 ' Number is 9 or 10.
Debug.Print "Greater than 8"
Case Else ' Other values.
Debug.Print "Not between 1 and 10"
End Select
Notice that the Select Case structure evaluates an expression once at
the top of the structure. In contrast, the If...Then...Else structure can
evaluate a different expression for each ElseIf statement. You can replace an
If...Then...Else structure with a Select Case structure only if the If statement
and each ElseIf statement evaluates the same expression.

Post-Test.
Multiple Choice. Write the capital letter of your answer on the space provided.
______1. Evaluate the expression: 4 > 6 OR 10 < 2*6 a) True b) False
______2. Evaluate the expression: 7 >= 3+4 OR 6 <4 AND 2 < 5 a) True b) False
Use the following information: x=5, y=3, z=2, A=true and B=false
______3. Evaluate the expression: X*Z > X*Y AND A a) True b) False
______4. Evaluate the expression: X*Z < X*Y OR A a) True b) False
______5. Evaluate the expression: A AND B a) True b) False
______6. Evaluate the expression: X*Y > Y^Z a) True b) False
______7. Evaluate the expression: X*Y>Y^Z AND A OR B a) True b) False
______8. A function that returns the sign of s number a) Atn b) Rnd C)Sgn d)Val
______9. ABS(-210-5) is equal to a) -215 b)-205 c) 205 d)215
______10. RIGHT$(“Unbelievable”, 4) is a) Unbel b) liev c) live d) able

Page 93 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Programming Exercise.
1. Prepare a program that requests the cost and revenue for a company’s
business venture and displays “Break Even” if the cost and revenue are equal;
otherwise display the profit or loss.
2. Prepare a program that will determine if the first number entered by the user
is less than, greater than, or equal to the second number entered.
3. Develop a program that would determine if the number entered by the user is
POSITIVE, NEGATIVE, or ZERO.
4. Revise programming exercise Set A # 3, create a condition when there will be
no roots available for the entered data. (In case where imaginary number will
be one of the roots.)
5. Create a program that would tell the user if the numbered entered by the user
is ODD or EVEN.
6. Create a program for a Cartesian Plane. Two numbers will be entered by the
user as data for X and Y. After clicking a button, the program will display its
location on the Cartesian Plane.

Page 94 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY
ACTIVITIES

Page 95 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 1


WINDOWS FAMILIARIZATION

INTRODUCTION
Each time you turn on your computer, it goes through a start-up process during
which it loads the system files necessary for you to interact with your computer and for
your computer to interact with other devices, such as the monitor, keyboard, and
mouse. When the start-up process is complete, your computer will open Windows.
Familiarization of this operating systems program and its applications will help a lot in
understanding the computer.

OUTCOMES
At the end of this activity, the students can:
1. manage files using folders
2. explore the windows desktop
3. efficiently utilize the keyboard and mouse
4. use the accessories program included in Windows, and;
5. find information about the computer system's storage.

PROCEDURE
I. Creating Folder
a. Open My Computer
b. Double click Comp##(C:)
c. Click File New Folder
d. Type your family name and press Enter
e. Click your folder and press Enter.
f. Close the My Computer window and other opened windows.
II. NotePad
a. Click Start Programs Accessories Notepad
Type the following for ten(10) times on the opened window :
The quick brown fox jumps over the lazy dog near the bank of the
river and cried for help.
b. Click File Save
c. Locate and find your folder on the Save-As dialog box
a. Click the down arrow opposite the Save-in textbox
b. Click CPU###(C:)
c. Click your folder.( If you can’t find your folder, click the arrows on
the horizontal scroll bar to view the left or the right part of the
window.)
d. Click or press Enter on your keyboard

Page 96 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

e. Click inside the textbox


and erase the
existing text(Document.doc)
f. Type Typing1
g. Click or press Enter on your keyboard.
h. Close the Notepad window and other opened windows.
III. WordPad
a. Click Start Programs Accessories WordPad
Type the following:
Keyboarding Tips
1) Keep your work. Have a folder to keep your files in.
2) Good posture is important. Sit up. Adjust the monitor and keyboard
so they are comfortable for you. Make them ergonomic.
3) Think about each key as you type. You should not be thinking about
whole words (otherwise you will learn to type only the words you
can easily spell).
4) Know by heart the home keys: a,s,d,f,g,h,j,k,l:
5) As time progresses, learn which finger covers which letter. If asked,
which is your “ J finger” you should immediately raise your right
index finger.
6) Keyboarding is a pragmatic skill. That means you learn by doing it.
Practice, practice, practice.
b. Save the WordPad document (follow J. Notepad, step 2 and 3a to 3e)
c. Type Typing2
d. Click or press Enter on your keyboard.
e. Close the WordPad window and other opened windows.
IV. Paint
a.Start MS Paint. Click Start Programs Accessories Paint
b.Draw this object
c.Save the WordPad
document (follow J.
Notepad, step 2 and
3a to 3e)
d. Type Draw1
e. Click or
press Enter on your
keyboard.
f. Close the Paint
window and other opened windows.

V. Shut-Down Procedure
a. Click Start Shut-down Yes/OK
b. Wait until the message “ It is now safe to turn-off the computer.” is
displayed before turning the power off.

Page 97 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 2


Windows Dialog box Elements

INTRODUCTION
In a graphical user interface operating system, a dialog box or dialogue box is a
new window that appears above the rest that lists additional information, errors, or
options. A box that pops up to enable communication between the computer and you,
the user. Dialogue boxes may ask you questions or give you information about the next
processing it will do. Identifying the elements of this object will be learned on this
activity.

OUTCOMES
At the end of this activity, the students can:
1. identify the elements of the dialog box
2. understand the use of the different objects in the dialog box
3. differentiate the use of option buttons and check boxes

PROCEDURES
Listed below are some dialog boxes you can find in Windows.
Task #1. Open the dialog boxes one at a time(see the click direction for every
dialog box)
Task #2. List down the names and number of elements of the dialog box you can
find.
A. Start Programs Accessories  WordPad  Insert  Date & Time…
Ex.
Listbox – 1
Command Button – 2

B. Start Programs Accessories  WordPad  Format  Tab…

___________________ - ____
___________________ - ____
___________________ - ____

Page 98 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

C. Start Programs Accessories  Notepad  Search  Find…

___________________ - ____
___________________ - ____
___________________ - ____
___________________ - ____

D. Start Programs Accessories Paint  Image  Flip Rotate…

___________________ - ____
___________________ - ____

E. Start Programs Accessories  Notepad  Edit  Set Font…

___________________ - ____
___________________ - ____
___________________ - ____
___________________ - ____
___________________ - ____
___________________ - ____

F. Start Programs Accessories  Paint  Image  Stretch and Skew…

___________________ - ____
___________________ - ____
___________________ - ____

Page 99 of 118
COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 3


VISUAL BASIC PROPERTIES WINDOW FAMILIARIZATION

INTRODUCTION
In Visual Basic Programming, programs or dialog box contains objects that
should be designed to its specific property. Properties are attributes such as size,
position, etc. Like a form, each control type has its own set of properties. Some
properties, like Width and Height, such as, are common to both forms and controls,
while other properties are unique to a form or a control. Controls often differ in the
number and type of properties. These object's properties can be changed on the
Properties window.

OUTCOMES
At the end of this activity, the students can:
1. display and use the Properties Window in Visual Basic
2. differentiate the settings applied in different objects when used on a
form; and
3. open, close or hide the properties window at anytime.

PROCEDURES
Some properties have predefined settings and some do not. You can tell if
a property has predefined settings by first selecting the property in the property
list, and then looking in the Settings box next to the selected property. Use the
following key to complete this exercise.
A This property has no predefined setting
B This property has predefined settings. The list arrows in the
Setting box will display either a list of the valid choices or a palette
C This property has predefined settings. The ellipsis in the Setting
box will display a dialog box.
D Not Available
Task 1: Start Visual Basic and open a new
project.
Task 2: On the form draw a 1) label, 2)textbox,
3)command button, 4)option button,
5)check box, 6)combo box, 7)shape and a 8)timer.
Task 3: Select the individual object and given the table below, write A, B, C or D
on the corresponding column according to the key given above.

Page 100 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Alignment 1. 2.B 3. 4. 5. 6. 7. 8. 9.
Caption 10. 11. A 12. 13. 14. 15. 16. 17. 18.
Enabled 19. 20. B 21. 22. 23. 24. 25. 26. 27.
FillColor 28. 29. B 30. 31. 32. 33. 34. 35. 36.
FillStyle 37. 38. B 39. 40. 41. 42. 43. 44. 45.
Font 46. 47. C 48. 49. 50. 51. 52. 53. 54.
ForeColor 55. 56. B 57. 58. 59. 60. 61. 62. 63.
Icon 64. 65. C 66. 67. 68. 69. 70. 71. 72.
Interval 73. 74. D 75. 76. 77. 78. 79. 80. 81.
Left 82. 83. A 84. 85. 86. 87. 88. 89. 90.
Name 91. 92. A 93. 94. 95. 96. 97. 98. 99.
Picture 100. 101. D 102. 103. 104. 105. 106. 107. 108.
TabIndex 109. 110. D 111. 112. 113. 114. 115. 116. 117.
Text 118. 119. D 120. 121. 122. 123. 124. 125. 126.
Value 127. 128. D 129. 130. 131. 132. 133. 134. 135.
Task 4: After accomplishing the above table. Save the form and the project
Name of the folder (for step 2): Activity1
Filename for the form (for step 4): frmForm1.frm
Filename for the project ( for step 6): Activity1.vbp.
Task 5: Close the project by clicking on the close button.

Filing

Page 101 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 4a


GRAPHIC USER INTERFACE DESIGN

INTRODUCTION
Before writing a Visual Basic program, knowing your way in the development
cycle would pass by the understanding of how the user interface would be used.
Layouting the objects on the form should be easier when you knew the use of the
windows/toolbars that are displayed on the user interface. This activity guides you
on the process of developing the project user interface.

OUTCOMES
At the end of this activity, the students can:
1. differentiate the use of the Properties, Form Layout and Project Properties
Window in Visual Basic;
2. create a program and understand the use of the toolbox; and
3. save and open the project with confidence.
PROCEDURE:
On your computer, open Visual basic and replicate the given layouts, change
the corresponding property settings found at the left side and save the project using
the given data below the form. When done, execute(run) the program to view
required output.
A. Layout1
Task 1: Start Visual Basic and open a New project
Task 2:Add controls on the form and layout Task 3: Define object properties
Object Property Property Setting

Form Name FrmAct2


Caption Sample 1
Backcolor Black
BorderStyle 1-Fixed Single
label Name lblQ
Caption Question:
BackStyle 0 -Transparent
Task 4: Run the program
Font Arial, 16 pts
Task 5:Save the form and the project ForeColor White
Textbox Name txtQuestion
Folder name: Activity2
Alignment 2-Center
Form name: frmAct2.frm Comic Sans MS, 16
Font
Project name: Activity2.vbp pts
Processed data is
Text
called information.
Multiline True
Command Name cmdTrue
Button Caption TRUE
Command Name cmdFalse
Button Caption FALSE

Page 102 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 4b


GRAPHIC USER INTERFACE DESIGN
B. Layout 2
Task 1: Start Visual Basic and open a New project

Task 2: Add controls on the form and layout Task 3: Define object properties

Property
Object Property
Setting
Form Name FrmAct3
Caption Sample 2
Textbox Name txtDisplay
Text Visual BASIC
Frame Name fmeColors
Caption Text Color
Option Name OptBlack
Button Caption Black
Value True
Option Name OptRed
Task 4: Run the program
Button
Caption Red
Task 5: Save the form and the project
Option Name OptBlue
Folder name: Activity3 Button Caption Blue
Form name: frmAct3.frm
Command Name CmdApply
Project name: Activity3.vbp
Button Caption &Apply
Command Name CmdExit
Button Caption &Exit

B. Layout 3.
On your own, create a form with the following objects.

Folder name: Activity4


Form name: frmATM.frm
Project name: Activity4.vbp

Page 103 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 5a


EVENT PROCEDURE CODING

INTRODUCTION
Whenever the user takes any action, such as clicking the mouse, pressing a key
in the keyboard the action is called an event. When an event occurs, this event is
usually directed at some part of your program's user interface. This activity will
teach the student how the codes are done and how the program would work when
some actions will be made by the user.

OUTCOMES
At the end of these activities, the students can:
1. make his program do some work when objects are clicked
2. create a program and understand the use of the code window; and
3. open, edit and save the project without difficulty.
PROCEDURE
On your computer, open Visual Basic and replicate the given layouts, change
the corresponding property settings found at the left side and save the project using
the given data below the form. When done, execute(run) the program to view
required output.

A. Hello World. Develop a program (displays “Hello World!” on the form) as illustrated
below:
Task 1: Start Visual Basic and open a New project
Task 2: Lay-out the controls on the form Task 3: Define object properties

Object Property Property Settings

Form Name FrmAct4


Caption Printing Text on the Form
Button Name cmdPrint
Caption Print
Button Name CmdExit
Task 4: Supply the codes Caption Exit
Task 5: Run/Execute the program

Task 6: Click the Print Button


Task 7: Save the form and the project
Folder name: Activity5
Form name: frmAct5.frm
Project name: Activity5.vbp

Page 104 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 5b


EVENT PROCEDURE CODING
B. Codes for Activity2. Supply codes for Activity2.
Task 1: Start Visual Basic and open a Activity2.vbp from your folder.
Task 2: On the Project Explorer window, click the + sign on the form folder(a), click the form
(frmSample1.frm) then click the View Object button(b) or simply double-click the form(c)

b
Activity2 Activity2
a
c

Task 3: Supply the additional buttons for UNDO and EXIT.

Task 4: Supply the corresponding codes for each buttons.


Task 5: Run the program. The
program should work like this at
runtime.

Clicking the TRUE button

Task 6: Change the form’s name to


frmAct5 and form’s caption to
Trivia #1 and save the form and
the project as a new file using
Save frmAct2.frm As for the
form and Save Activity2 As for Clicking the UNDO button
the project on the File menu.
Folder name: Activity6
Form name: frmAct6.frm
Project name: Activity6.vbp

Page 105 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 5c


EVENT PROCEDURE CODING

C. WIT Color. Develop a program changing the color, hiding and displaying a label on the form.
Task 1: Start Visual Basic and open a New project
Task 2: Layout objects on the form as illustrated Task 3: Define object properties on the Properties window

Object Property Property Settings

Form Name frmAct6


Caption Font Color
Option Name optRed
Button Caption RED
Task 4: Run the program. The output should Option Name optBlue
be like the one below. Notice that Button Caption BLUE
there were no actions made when you Option Name optWhite
click the controls. Button Caption White
Label Name lblColor
Caption WIT
Alignment 2-center
Font Times New
Roman,64pts
Button Name cmdHide
Caption HIDE
Task 5: Supply the codes to make the program work Button Name cmdAppear
Caption APPEAR
Enabled False
Button Name cmdExit
Caption Exit

Task 6: The program should work like this at runtime.

Task 7: Save the form and the project


Folder name: Activity7
Form name: frmWIT.frm
Project name: Activity7.vbp

Clicking the WHITE option button


Clicking the HIDE button

Page 106 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 5d


EVENT PROCEDURE CODING

D. Simple Database. Develop a program that adds entered items in a list(as shown below).
Task 1: Start Visual Basic and open a New project
Task 2: Layout objects on the form as illustrated Task 3: Define object properties
Object Property Property Settings
Form Name frmAct7
Caption List of Names
Label Font Arial, Bold, 10 pts
Caption First Name
Label Font Arial, Bold, 10 pts
Caption Last Name
Label Font Arial, Bold, 10 pts
Caption Age
Textbox Name txtFN
Textbox Name txtLN
Textbox Name txtAge
Task 4: Supply the codes to make the program work
List Box Name LstTable
Checkbox Name chkBold
Caption Bold
Checkbox Name chkItalic
Caption Italic
Checkbox Name chkRegular
Caption Regular
Enabled False
Command Name cmdAdd
Button Caption &Add to List
Command Name cmdClear
Button Caption Clear
Command Name cmdExit
Button Caption Exit
Note: the underscore( _ ) on the code
means that the next line is still the
continuation of the same line of code.

Page 107 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Task 5: The program should work like this at runtime.

Entering data on textboxes Clicking the checkboxes Clicking the regular checkbox

Try to use the CLEAR button and enter new set of names

Task 6: Save the form and the project


Folder name: Activity8
Clicking Add to List button Adding more entries Form name: frmDatabase.frm
Project name: Activity8.vbp

Page 108 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 6a


PROGRAMMING EXPRESSIONS

INTRODUCTION
In programming, understanding the types of building blocks that are
available and to employ proven program construction principles are necessities.
In these activities, we introduce the Visual BASIC programming concepts and
illustrate many of its important features like memory concepts, arithmetic
operators, and data types used in Visual BASIC programming.
OUTCOMES
At the end of these activities, the students can:
1. solve problems requiring mathematical solutions
2. create an object-oriented program and understand the use of the
variables, data types and operators; and
3. provide electronic solutions to their math, engineering or financial
problems.
PROCEDURE
On your computer, open Visual Basic and replicate the given layouts, provide
codes, when done, execute(run) the program to view required output.

A. Sum and Product. Develop a program that computes for the sum and product of 2
numbers entered:
Task 1: Start Visual Basic and open a New project
Task 2: Layout objects on the form as illustrated Task 3: Define object properties

Object Property Property Settings

Form Name frmAct8


Caption Sum and Product
Label Font Arial, Bold, 14 pts
Caption First number
Label Font Arial, Bold, 14 pts
Caption Second Number
Label Name Lblsum
Caption SUM =
Label Name lblProd
Task 4: Supply the codes to make the program work
Caption PRODUCT =
Textbox Name txtFirst
Alignment Center
Textbox Name txtSec
Alignment Center
Command Name cmdCompute
Button Caption COMPUTE
Command Name cmdExit
Button Caption EXIT

Page 109 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

Task 5: The program should work like this at runtime.


(Try also other numbers)
Task 6: Save the form and the project
Folder name: Activity9
Form name: frmAct9.frm
Project name: Activity9.vbp

Page 110 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 6b


PROGRAMMING EXPRESSIONS

B. EXAM Average. Develop a program that computes for the average of 3 exams
entered by the user:
Task 1: Start Visual Basic and open a New project
Task 2: Layout objects on the form as illustrated

Task 3: Define object properties on the Properties window


Object Property Property Settings

Form Name frmAct9


Caption Average of 3 Exams
Textbox Name txtMT
Alignment Center
Textbox Name txtPF
Alignment Center
Textbox Name txtF
Alignment Center
Command Name cmdComp
Button Caption COMPUTE
Label Name lblAve
Caption AVERAGE =
Task 4: Supply code on the Code window

Task 5: Run the program and enter values to check the computations

Task 6: Save the form and the project


Folder name: Activity10
Form name: frmAct10.frm Project name: Activity10.vbp

Page 111 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 7a


DECISION STRUCTURES

INTRODUCTION
When you want a program to make decision or comparison and then based on
the result of that decision or comparison, to select one of two paths, we use the
decision structure. The application of the decision making capability of the computer
is the theory and principle of structured programming.

OUTCOMES
At the end of these activities, the students can:
1. write decision-making programs in Visual Basic
2. create a program in situations to provide options; and
3. use the IF/THEN, IF/THEN/ELSE and SELECT-CASE statements.
PROCEDURE
On your computer, open Visual Basic and provide codes, when done, execute(run)
the program to view required output.

A. Pass or Fail. Open Activity 9 and add Passed or Failed remarks based on the
computed average.
Task #1 Extend the form downwards and add a label.
Object Property Property Settings

Label Name lblDisplay


Border 1-Fixed Single
Style

Task#2 . Add the following codes for the remarks.

Task#3. Run the program and enter different values to check the output

Task#4. Save the program


using the same filename

Page 112 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

LABORATORY ACTIVITY NO. 7b


DECISION STRUCTURES

B. Grades. Open Activity9 and add grades equivalent for the computed average.

Task #1. Extend the form downwards and add another label.

Object Property Property Settings

Label Name lblGrade


Forecolor Yellow
Border 1-Fixed Single
Style

Task#2. Add the following codes for the remarks.

Task#3. Run the program and enter different values to check the output. Save

Page 113 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

References:

Capron, L., Johnson, J.A. Capron, Computers, Tools for an Information Age, 7th Ed.,
2009, The Benjamin/Cummings Publishing Company, Inc.

Kenneth C. Laudon, Jane P. Laudon, Jane Price Laudon, Carol Guercio Traver,
Information Technology: Concepts and Issues (2nd edition), 1997, Course
Technology

Gary B. Shelly, Thomas J. Cashman, Misty E. Vermaat, Discovering Computers 2011,


Livingin a DIgital World, 2010, Thompson Course Technology.

Zak, Diane, Programming with Microsoft Visual Basic 6.0, 1999,Course Technology

Dietel, H.M., Dietel, P.J. and Nieto, T.R., Visual Basic 6 How to Program, 1999, Prentice-
Hall

Ken Getz & Mike Gilbert, Visual Basic Language Developer’s Handbook, 2000, SYBEX

MSDN Library Visual BASIC 6.0

77

Page 114 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

RUBRICS

Page 115 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

RUBRIC used for Activity 1


Unsatisfac-
Objective Exceptional (4) Acceptable (3) Amateur (2) Score
tory (1)
The files are The files are created The files created Only one file
created correctly and meets most of were insufficient. was created.
Specificat- and meets all the specifications.
ions the
specifications.

The operations The accessories The accessories Only one


and accessories programs were used programs were accessories
programs were with familiarization used with program was
Mastery
used with full of its operation. adaptation of its used.
control of its operation
operation.
The files were The files were fairly The files were Only one file
precisely formatted according formatted only were
formatted to its model. 50% according to formatted.
Format- according to its its model.
ting model.

The files were The files were done The files were The files were
Delivery finished before on time. finished after the long overdue.
the time. due time.
The files were The files were saved The files were The files were
saved correctly correctly but saved but saved on
on the specified filenames are not locations and unknown
Saving
folders with the named as filenames are not locations.
proper prescribed. prescribed.
filenames.

Score 20

Page 116 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

RUBRIC used for Activity 2

Unsatisfac-
Objective Exceptional (7) Acceptable (5) Amateur (3) Score
tory (1)
The dialog box The dialog box were The dialog box The dialog box
were promptly located on time and were located with were located
located and named. delay and named. with delay and
Operations identified. named
incorrectly.

The type of The type of controls The controls in The dialog box
controls in the in the dialog box the dialog box were not
Mastery dialog box were were partially listed. were not located.
completely completely
listed. answered.
The listing was The listing was done The listing was The listing was
Delivery finished before on time. finished after the long overdue.
the time. due time.

Score 21

Page 117 of 118


COMP 1 (COMPUTER FUNDAMENTALS & PROGRAMMING)
INSTRUCTION & LABORATORY MANUAL

RUBRIC used for Activity 3 to Activity 10

Unsatisfac-
Objective Exceptional (4) Acceptable (3) Amateur (2) Score
tory (1)
The program The program works The program The program is
works and meets and produces the produces correct producing
all of the results but displays results but does incorrect
Specificat- specifications. them without not display them results.
ions format. It also correctly.
meets most of the
other specifications.

The project, The project, form, The project The project


form, and/or and/or codes were specifications user interface
codes are made managed to be were not is way
with full control finished even with managed due to different from
Mastery of the disordered difficulty in model.
operations of interface. locating
the appropriate
programming window/toolbar.
language used.
The The documentation The The
documentation consists of documentation is documentatio
is well written embedded simply comments n is simply the
and clearly comment and some embedded in the name of the
Documen-
explains what simple header code but does activity
tation
the code is documentation that not help the embedded in
accomplishing is somewhat useful reader the code .
and how. in understanding understand the
the code. code.
The program The program was The program was The program
Delivery was delivered delivered on time. delivered after was long
before the time. the due time. overdue.
The whole The whole project is The project is The project is
project and its saved correctly but saved but saved on
associated files filenames are not locations and unknown
are saved named as filenames are not locations.
Saving
correctly on the prescribed. prescribed.
specified folders
with the proper
filenames.

Score 20

Page 118 of 118

You might also like