Chapter 1 Introduction to Computers and Programming
1.4 Describe the steps in the fetch/decode/execute cycle.
"Fetch: The CPU's control unit fetches, from main memory, the next instruction in the sequence of program instructions. Decode: The instruction is encoded in the form of a number. The control unit decodes the instruction and generates an electronic signal. Execute: The signal is routed to the appropriate component of the computer (such as the ALU, a disk drive, or some other device). The signal causes the component to perform an operation."
1.19 Describe the difference between operators and punctuation symbols.
"Operators - Operators perform operations on one or more operands. An operand is usually a piece of data, like a number. Punctuation - Punctuation characters that mark the beginning or ending of a statement, or separate items in a list. "
1.1 Why is the computer used by so many different people, in so many different professions?
Because they are programmable.
Creating program
Define, visualize, tools, logical errors, type code and compile, correct, run, correct, validate
The programming process consists of several steps.
Design, create, testing, debugging
1.17 What is an integrated development environment?
Environment consisting of a text editor, compiler, linking and execution
Statements written by the programmer are called
Source code
IDE (Interactive Development Environment)
Text editor, compiler, debugger, other utilities.
1.25 What four items should you identify when defining what a program is to do?
The program's purpose, information to be input, the processing to take place, and the desired output
text editor
Used for typing program into the computer
1.27 What is a hierarchy chart?
a diagram that graphically depicts the structure of a program
1.11 What is an algorithm?
a set of well defined steps for performing a task or solving a problem
1.21 Why are variables called "variable"?
because they vary, i.e. they can have a variety of values
1.12 Why were computer programming languages invented?
to ease the task of programming
1.32 What is the purpose of testing a program with sample data or input?
to help determine if it solves the original problem
1.26 What does it mean to "visualize a program running"? What is the value of such an activity?
to see it in your mind
25. A variable must be __________ before it can be used in a program.
defined
11. A(n) __________ is an example of a secondary storage device.
disk
1.24 What are the three primary activities of a program?
input, processing and output
Three primary activities of a program are:
input, processing, output
13. A program is a set of __________.
instructions
1.30 What is a run-time error?
is an error that occurs while the program is running
1.22 What happens to a variable's current contents when a new value is stored there?
it is replaced
1.23 What must take place in a program before a variable is used?
it must be defined
17. _________ languages are close to the level of the computer.
low-level
15. _________ is the only language computers really process.
machine
20. Words or names defined by the programmer are called __________.
variables
19. Words that have special meaning in a programming language are called __________.
keywords
1.14 What does portability mean?
means that is can be written on one type of computer and then run on many other types of systems
24. A(n) __________ is a named storage location.
memory address
18. A program's ability to run on several different types of computer systems is called __________.
portability
1.29 Describe what a compiler does with a program's source code.
puts into machine language
1.9 What do you call a program that performs a specialized task, such as a virus scanner, a file-compression program, or a data-backup program?
utility program
1.31 Is a syntax error (such as misspelling a key word) found by the compiler or when the program is running?
yes
1.20 Describe the difference between a program line and a statement.
"program line - a single line statement - is a complete instruction that causes the program to perform some action"
1.5 What is a memory address? What is its purpose?
A byte is assigned unique number know as an address. Store memory.
preprocessor directive
Begins with #, modifies the source code .
1.18 Describe the difference between a key word and a programmer-defined identifier.
"keywords - Words that have a special meaning. Key words may only be used for their intended purpose. Key words are also known as reserved words., Programmer-defined - Words or names defined by the programmer. They are symbolic names that refer to variables or programming routines."
1. Both main memory and secondary storage are types of memory. Describe the difference between the two.
"main memory - (ram) the CPU is able to quickly access data at any random location in RAM, volatile type used for temp. storage, secondary storage - can hold date for long periods of time
Keywords
Are reserved and cannot be used for anything other than their designed purpose.
1.33 Briefly describe the difference between procedural and object-oriented programming.
In procedural programming, program is divided into small parts called functions. In object oriented programming, program is divided into small parts called objects. Procedural programming follows top down approach. Object oriented programming follows bottom up approach
statement
Is a complete instruction that causes the computer to perform some action.
1.2 List the five major hardware components of a computer system.
Main Memory, Central Process Unit (CPU), Secondary Storage Unit, Input Devices, Output Devices"
1.6 Explain why computers have both main memory and secondary storage.
Main memory is volatile for temp storage, secondary is holds data for long periods
A variable is a named storage location in the computers
Memory for holding a piece of data
Step in coding
Source code, preprocessor, modified source code, compiler, object code, linker, executable code.
Source code is saved to a
Source file
1.7 What are the two general categories of software?
application and system
1.10 Word processing programs, spreadsheet programs, e-mail programs, Web browsers, and game programs belong to what category of software?
application program
29. A(n) __________ is a diagram that graphically illustrates the structure of a program
hierarchy
1.13 What is the difference between a high-level language and a low-level language?
high level is close to human, and low is close to machine
16. _________ languages are close to the level of humans in terms of readability.
high-level
5. Why is it easier to write a program in a high-level language than in machine language?
high-level is close to human
27. _________ is information a program gathers from the outside world.
input
6. Explain the difference between an object file and an executable file.
object file - object code, executable file - executable code
1.8 What fundamental set of programs control the internal operations of the computer's hardware?
operating system
21. _________ are characters or symbols that perform operations on one or more operands.
operators
28. _________ is information a program sends to the outside world.
output
1.15 Explain the operations carried out by the preprocessor, compiler, and linker.
preprocessor - reads the source code, compiler - stores the translated machine language instructions, linker - combines the object file with the necessary library routines. "
8. Computers can do many different jobs because they can be __________.
programmed
1.28 Describe the process of desk-checking.
programmer starts reading the program and steps through each statement
14. Since computers can't be programmed in natural human language, algorithms must be written in a(n) __________ language.
programmming
22. _________ characters or symbols mark the beginning or ending of programming statements, or separate items in a list.
punctuation
4. Why must programs written in a high-level language be translated into machine language before they can be run?
so that the computer can execute the program (as the computer only understands machine language)
1.16 Explain what is stored in a source file, an object file, and an executable file.
source file - source code is stored in this file type, object file - compiler stores translated machine language instruction called object code into this file type, executable file - contains machine language instructions."
23. The rules that must be followed when constructing a program are called __________.
syntax
7. What is the difference between a syntax error and a logical error?
syntax error - error in the way it is written, logical error - error in the logic of how it is written
3. What type of software controls the internal operations of the computer's hardware?
system - operating system
12. The two general categories of software are __________ and __________.
system and application
2. What is the difference between system software and application software?
system software - operating systems, utility programs, software development tools, application - useful for everyday tasks (word processing)
9. The job of the __________ is to fetch instructions, carry out the operations commanded by the instructions, and produce some outcome or resultant information.
CPU
1.3 Internally, the CPU consists of what two units?
Control Unit and the Arithemetic and logical unit (ALU)
10. Internally, the CPU consists of the __________ and the __________.
Control Unit and the Arithemetic and logical unit (ALU)
26. The three primary activities of a program are __________, __________, and __________.
input, process and output