0% found this document useful (0 votes)
46 views6 pages

CSNP Homework 1-Chp1

The document contains a homework assignment with multiple choice and short answer questions about computer hardware and software concepts. It begins by asking the student to define the steps a CPU takes to execute a program (fetch, decode, execute) and continues with questions about memory, operating systems, compilers, variables, and programming processes. Pseudocode examples are provided to demonstrate displaying values. The homework concludes by asking the student to write pseudocode for an algorithm to calculate available credit.

Uploaded by

Ian Picho
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views6 pages

CSNP Homework 1-Chp1

The document contains a homework assignment with multiple choice and short answer questions about computer hardware and software concepts. It begins by asking the student to define the steps a CPU takes to execute a program (fetch, decode, execute) and continues with questions about memory, operating systems, compilers, variables, and programming processes. Pseudocode examples are provided to demonstrate displaying values. The homework concludes by asking the student to write pseudocode for an algorithm to calculate available credit.

Uploaded by

Ian Picho
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Page 1 of 6

Homework #1 - Chapter 1
Read Chapter 1 and Complete the following Review Questions (4pts each):

1. What are the steps taken by a CPU when executing a program?


Fetch: In this step, The CPU’s control unit gets the next instruction in the sequence of program
instructions from the main memory.

Decode: In this step, the program instruction is encoded into a form of numbers, like 1s and 0s.
After, the control unit of the CPU decodes the instructions again and then generates a certain
electronic signal depending on what the program instruction said.

Execute: In the final step of this process, the electronic signal sent in the Decode step of the
process is directed and routed to the correct component, of the computer that the CPU’s control
unit sent the signal to. After the component received the electronic signal, the component
performs an operation based on what the electronic signal was and said.

2. A byte is made up of eight: ____


A. CPUs
B. Addresses
C. Variables
D. Bits

3. Fill in the blanks.


Main memory is where the computer stores the program while the program is running, as well as
the data that the program is working with.

4. Each byte is assigned a unique number known as:


A. the RAM
B. the ROM
C. an address
D. 128
E. binary digit
Page 2 of 6

5. What fundamental set of software controls the internal operations of the computer’s hardware:
A. Operating System
B. Utility Programs
C. Software Development Tools
D. Compilers
E. Linkers

6. If you were to look at a machine language program, you would see _____.
A. C++ source code
B. A stream of binary numbers
C. English words
D. Circuits
E. RAM

7. These are the rules that must be followed when writing a program: ______
A. Syntax
B. Punctuation
C. Key words
D. Operators 6

8. The C++ compiler generates____.


A. Machine code
B. Executable program
C. Source code
D. HTML

9. This computer hardware coordinates and performs arithmetic operations:____


A. Memory
B. CPU
C. ROM
D. LAN
Page 3 of 6

10. In the Software Development Model, which step is where writing the algorithm using
programming statements:______
A. Defining Problem Requirements
B. Analysis
C. Design
D. Implementation
E. Testing
F. Maintenance

11. This type of memory is volatile and data storage is temporary:______


A. RAM
B. ROM
C. WAN
D. LAN
E. CPU

12. These tools are combined into an IDE (Integrated Development Environment): (select all that
apply by highlighting in YELLOW)
A. Memory
B. Editor
C. Compiler
D. Tester
E. Linker
F. Loader
G. Debugger

13. What is the first large scale general purpose electronic digital computer called?
ENIAC

14. What is a source file?


The source file is the file that the source code, which is the program of instruction statements that
are written by a programmer, is saved in.

15. What does a compiler do?


The compiler translates each source program instruction into a machine language instruction,
made of 1s and 0s, that the computer can read. These machine language instructions are stored in
an object file
Page 4 of 6

16. Why must programs written in a high-level language be translated into machine language before
they can be run?
The programs written in a high-level language must be translated into the machine language
before they can be run because the high-level language is readable by the programmer but is
unreadable to the computer. The computer can read machine language instructions because it is
made up 1s and 0s, the computer CPU can understand, and cannot read the words in the high-
level language

17. Provide an example of a C++ keyword: namespace

18. Provide an example of a Programmer-defined Identifier: wallHeight

19. What happens to a variable’s current contents when a new value is stored there?
A. syntax error
B. runtime error
C. old value saved in RAM
D. contents are overwritten with new contents
E. old value persisted to secondary storage

20. Evaluate the expressions using the below memory map:


Address Contents
00 100
01 22
02 9
03 3
04 52
05 15
06 29
A. Value at memory location 02 is 9
B. Value of memory location arithmetic 04 + 01 = 52 + 100 = 152

21. Provide an example Variable Definition (variable declaration)


int wallHeight;
wallHeight = 10;
Page 5 of 6

22. List the steps of the Programming Process in order:


1. Define what the program is to do.
2. Visualize the program running on the computer.
3. Use design tools to create a model of the program.
a. Pseudocode, flowcharts, Hierarchy chart, etc.
4. Check the model for logical errors.
5. Write the program source code.
6. Compile the source code.
7. Correct any Syntax errors found during compilation.
8. Link the program to create an executable file.
9. Run the program using test data for input.
10. Correct any logical or runtime errors found while running the program.
a. Repeat steps 4 – 10 as many times as necessary.
11. Validate the results of the program.
a. Does the program do what was defined in step 1.

The following are programs expressed as English statements (Pseudocode). What would each display
on the screen if they were actual programs?
23.
The variable x starts with the value 0.
The variable y starts with the value 5.
Add 1 to x.
Add 1 to y.
Add x and y, and store the result in y.
Display the value in y on the screen.

Answer: 7
24.
The variable a starts with the value 10.
The variable b starts with the value 2.
The variable c starts with the value 4.
Store the value of a times b in a.
Store the value of b times c in c.
Add a and c, and store the result in b.
Display the value in b on the screen.

Answer: 28 _______________________________
Page 6 of 6

2. Write pseudocode algorithms for the programs described as follows:


1. Available Credit
A program that calculates a customer’s available credit should ask the user for the following:
 The customer’s maximum amount of credit
 The amount of credit used by the customer
Once these items have been entered, the program should calculate and display the customer’s
available credit. You can calculate available credit by subtracting the amount of credit used from
the maximum amount of credit.

The variable maxCreditAmount is defined as an int variable and starts with the value 0.
The variable creditAmountUsed is defined as an int variable and starts with the value 0.
The variable availableCredit is defined as an int variable and starts with the value 0.
The program asks the customer to type in an input value for maxCreditAmount.
Store the inputted value in maxCreditAmount.
The program asks the customer to type in an input value for creditAmountUsed.
Store the inputted value in creditAmountUsed.
Subtract maxCreditAmount by creditAmountUsed, and store the result in
availableCredit.
Display the value in availableCredit on the screen.

You might also like