Chapter 1
Process of Writing a Program
1. Clearly define what the program is to do. 2. Visualize the program running on the computer. 3. Use design tools such as a hierarchy chart, flowcharts, or pseudocode to create a model of the program. 4. Check the model for logical errors. 5. Type the code, save it, and compile it. 6. Correct any errors found during compilation. Repeat Steps 5 and 6 as many times as necessary. 7. Run the program with test data for input. 8. Correct any errors found while running the program. Repeat Steps 5-8 as many times as necessary. 9. Validate the results of the program.
Translating a C++ source file to an executable file (7)
1. Source Code 2. Preprocessor 3. Modified Source Code 4. Compiler 5. Object Code 6. Linker 7. Executable Code
Secondary
Flash drives, CDs, external disks are all examples of ______ storage (memory) devices.
you can pick any two random locations and it will take the same time to access the data.
RAM, random-access memory, is called that because
Syntax
Rules that must be followed when constructing a program. Dictates how key words and operands may be used, and where punctuation symbols must appear.
Fetch
The CPU's control unit fetches, from main memory, the next instruction in the sequence of program instructions.
=
The _ symbol is called the assignment operator. It takes the value of the expression on the RIGHT and stores it in the variable whose name appears on the LEFT. Example: pay = hours * rate "Make the pay variable equal to hours times rate.
portability
The ability of a language to let a programmer develop a program on computer system that can be run on other systems is called.
Decode
The instruction is encoded in the form of a number. The control unit decodes the instruction and generates an electronic signal.
It allows us to express an algorithm
What best defines a "programming language"?
CPU
When a program runs on a computer, the part of the computer that carries out the instructions is called the
An algorithm allows ambiguity.
Which of the following is not true?
Machine languages can be used to write programs that can run on any machine.
Which statement is NOT true:
Key Words
Words have a special meaning. ONLY may be used for their intended purpose. ALSO known as RESERVED WORDS. Examples: using, namespace, double, int ...
Programmer-Defined Identifiers
Words or names defined by the programmer. They are symbolic names that refer to variables or programming routines. Examples: hours, rate, and pay. These are names made up by the programmer.
Key Words
Words that have a special meaning in a programming language are called
Operating System
is the the most fundamental set of programs on a computer. The operating system controls the internal operations of the computer's hardware, manages all the devices connected to the computer, allows data to be saved to and retrieved from storage devices, and allows other programs to run on the computer.
Utility Program
performs a specialized task that enhances the computer's operation or safeguards data. Examples are virus scanners, file-compression programs, and data-backup programs.
An Instruction
At each step of its operation, the input to a Central Processing Unit is
A binary digit, like a 0 or a 1
A bit is
Address
A byte in memory is identified by a unique number called its
Machine Language
A computer's CPU can only process instructions that are written in
bytes
A computer's memory is divided into tiny storage locations known as ________. One byte is enough memory to store only a letter of the alphabet or a small number.
variable
A location in memory used for storing data and given a name in a computer program is called a _______ because the data in the location can be changed.
allocates resources like memory to programs that are running.
An operating system
defined
Before a variable is used it must be
Object
Compilers translate the instructions written by the programmer into _____ code.
gathering input, performing some process on the information gathered, then producing output.
Computer programs typically perform a 3-step process of
preprocessor
During the first phase of this process, a program called the ____________ reads the source code. The preprocessor searches for special lines that begin with # symbol. These lines contain commands that cause the preprocessor to modify the source code in some way. Example: #include <iostream>
linker
During the last phase of the translation process, another program called the ______ combines the object file with the necessary library routines.
compiler
During the next phase, the ________ steps through the preprocessed source, translating each source code instruction into the appropriate machine language instruction. This process will uncover any SYNTAX errors that may be in the program.
address
Each byte is assigned a unique number known as an
bits
Each byte is divided into eight smaller storage locations known as
object code
If the program is free of syntax errors, the compiler stores the translated machine language instructions, which are called ______ ____, in an object file. Although an object file contains machine language instructions, it is not a complete program.
Numbers and Characters
In programming, there are two general types of data:
Variable Definition
It is used to define one or more variables that will be used in the program and to indicate the type of data they will hold.
Input
Mice, trackpads, keyboards, scanners, joysticks are all examples of _____ devices.
Output
Monitors, printers, status lights are all examples of___________devices.
executable code
Once the linker has finished this step, an __________ ____ is created. The executable file contains machine language instructions, or Executable Code, and is ready to run on the computer.
Application Software
Programs that make a computer useful for everyday tasks are known as
Source Code
Statements written by the programmer are called The file they are saved in is called the source file. After the source code is saved to a file, the process of translating it to machine language can begin.
system software
The programs that control and manage the basic operations of a computer are generally referred to as
syntax
The rules that govern the correct order and usage of the elements of a language are called the _______of the language
Execute
The signal is routed to the appropriate component (such as the ALU, a disk drive, or some other device). The signal causes the component to perform an operation.
Software Development Tools
The software tools that programmers use to create, modify, and test software are referred to as Compilers and integrated development environments are examples of programs that fall into this category.
Definition statement
always causes a variable to be created in memory. Some types of DECLARATION statements do not cause a variable to be created in memory.
High-level Language
are closer to the level of human readability than computer readability.
Syntax errors
are illegal uses of key words, operators, punctuation, and other language elements.
Variables
are the names of memory locations that may hold data. is a named storage location in the computer's memory for holding a piece of information. Information stored in variables may change while the program is running (hence the name "variable") When information is stored in a variable, it is actually stored in the RAM.
C++
based on the C Language, offers object-oriented features not found in C. Invented at Bell Laboratories.
Statements
can be a combination of key words, operators, and programmer-defined symbols.
Javascript
can be used to write small programs that run in webpages.
Punctuation
characters that mark the beginning or end of a statement, or separate items in a list.
Integrated Development Environment (IDE)
environments consist of a text editor, compiler, debugger, and other utilities integrated into a package with a single set of menus. Preprocessing, compiling, linking, and even executing a program is done with a single click of a button.
Python
general-purpose language used in business and academic applications.
program
is a set of instructions that a computer follows to perform a task.
Algorithm
is a set of well-defined steps for performing a task or solving a problem.
Object-oriented programming (OOP)
is centered on the object. An object is a programming element that contains data and the procedures that operate on the data. It is a self-contained unit.
Procedural programming
is centered on the procedure, or function.
Low-Level Language
is close to the level of the computer, which means it resembles the numeric machine language of the computer more than the natural language of humans.
Main memory
is commonly known as random-access memory or RAM. RAM is usually a volatile type of memory that is used only for temporary storage while a program is running.
double
means the variable will hold double precision floating-point numbers.
Java
object-oriented language that may be used to develop programs that run on many different types of devices.
Central Processing Unit (CPU)
part of the computer that actually runs programs. Contains 2 parts: Control Unit and Arithmetic and Logic Unit (ALU)
Operators
perform operations on one or more operands. An operand is usually a piece of data, like a number.