0% found this document useful (0 votes)
8 views4 pages

Chapter 1 Solutions

The document discusses various aspects of computer memory, software types, and programming concepts. It explains the differences between primary and secondary memory, system and application software, and the importance of high-level languages. Additionally, it includes exercises on algorithms, flowcharts, and error identification in programming.

Uploaded by

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

Chapter 1 Solutions

The document discusses various aspects of computer memory, software types, and programming concepts. It explains the differences between primary and secondary memory, system and application software, and the importance of high-level languages. Additionally, it includes exercises on algorithms, flowcharts, and error identification in programming.

Uploaded by

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

Chapter 1 – Solutions

Short Answer
1. Both main memory and secondary storage are types of memory. Describe the difference
between the two.
Answer:-
a) Primary memory is volatile, the data stored is lost during a power outage, while secondary
memory is non-volatile, and the saved data is stored permanently.
b) Data stored in primary memory can be directly accessed by the CPU, whereas the data in
secondary memory cannot be accessed directly (the data is first read from secondary
memory into primary memory).
c) Access to Primary memory is fast whereas access to secondary memory is slow. Access time
for Primary memory is in nanoseconds (ns) and in milliseconds (ms) for the secondary
memory. Note that (1 second = 103 milliseconds = 109 nanoseconds)
d) Primary memory is costly and smaller in size (in Mega bytes) whereas secondary memory is
cheap and very large in size(in Tera bytes).

2. What is the difference between system software and application software?


Answer:- System software and application software serve different purposes, but both are
essential for the proper functioning of a computer. While they're both important, they aren't
interchangeable. System software provides a platform for other software to run, while
application software performs specific tasks for the user, so both are necessary for the computer
to work properly.
 System software is a set of programs that runs on computers, enabling them to
perform tasks such as running applications. System software is responsible for the
functioning of the computer system as a whole. Without it, computers are like body
without sole or shells of metal and plastic. Three components of system software are:
operating system, system drivers and utility programs.
a) Operating systems control the computer's hardware and manage the system's resources.
b) System drivers act as a bridge between the hardware and the software, allowing
information to flow between the two.
c) Utility software helps to manage, maintain, and optimize computer resources. Examples
of utility software include antivirus and anti-malware programs, disk defragmentation
tools, system cleaners and recovery tools.
 Application software is any software designed to run on a computer and to perform a
specific function. Commonly used Application software include Web browsers, word
processors, spreadsheets, media players, presentation software. Specialized applications
include database management systems, graphic design tools and video editing
applications.

3. What type of software controls the internal operations of the computer’s hardware?
Answer:- The system software Operating system (OS) controls the internal operations of the
computer’s hardware and coordinates the computer hardware devices and runs other software
and applications on a computer.
4. Why must programs written in a high-level language be translated into machine
language before they can be run?
Answer:- Computers only understand and run programs written in machine language or
machine code. So to run a high-level program by a computer it must be translated into
its machine language.
5. Why is it easier to write a program in a high-level language than in machine language?
Answer:- High-level languages are English like languages and are understandable by humans.
6. Explain the difference between an object file and an executable file.
Answer: - An object file contains machine language instructions, but it does not contain code for
any library routines that may be necessary. Whereas an executable file is a program which is
ready to run.

7. What is the difference between a syntax error and a logical error?


Answer: Syntax Errors occur due to the violation of the rules for writing statements of the
programming language. In case of syntax errors, a program fails to compile and execute.
Logical Errors occur due to programmer’s misunderstanding of the problem logic or
programming logic.

Fill-in-the-Blank

8. Computers can do many different jobs because they can be Programmed.


9. The job of the Control Unit is to fetch instructions, carry out the operations commanded
by the instructions, and produce some outcome or resultant information.
10. Internally, the CPU consists of the Control Unit and the Arithmetic Logic Unit.
11. A(n) Hard Disk / CD /SSD is an example of a secondary storage device.
12. The two general categories of software are System Software and Application Software.
13. A program is a set of Instructions to solve some problem.
14. Since computers can’t be programmed in natural human language, algorithms must
be written in a(n) programming language.
15. Machine Language or Machine Code is the only language computers really process.
16. High Level languages are close to the level of humans in terms of readability.
17. Machine or Low Level languages are close to the level of the computer.
18. A program’s ability to run on several different types of computer systems is called
Portability.
19. Words that have special meaning in a programming language are called Reserve Words.
20. Words or names defined by the programmer are called Identifiers.
21. Operators are characters or symbols that perform operations on one or more operands.
22. Punctuations characters or symbols mark the beginning or ending of programming
statements, or separate items in a list.
23. The rules that must be followed when constructing a program are called Syntax Rules.
24. A(n) Variable is a named storage location.
25. A variable must be declared before it can be used in a program.
26. The three primary activities of a program are input, process, and output.
27. Input is information a program gathers from the outside world.
28. Output is information a program sends to the outside world.
29. A(n) Hierarchy Chart is a diagram that graphically illustrates the structure of a program.
Algorithm Workbench

Draw hierarchy charts or flowcharts that depict the programs described below. (See Appendix D for
instructions on creating flowcharts.)

30. Available Credit

The following steps should be followed in a program that calculates


a customer’s available credit:

1. Display the message “Enter the customer’s maximum credit.”


2. Wait for the user to enter the customer’s maximum credit.
3. Display the message “Enter the amount of credit used by the
customer.”
4. Wait for the user to enter the customer’s credit used.
5. Subtract the used credit from the maximum credit to get the
customer’s available credit.
6. 6. Display a message that shows the customer’s available credit.

31. Sales Tax

Design a hierarchy chart or flowchart for a program that calculates


the total of a retail sale. The program should ask the user for:
– The retail price of the item being purchased
– The sales tax rate
Once these items have been entered, the program should calculate
and display:
– The sales tax for the purchase
– The total of the sale

32. Account Balance

Design a hierarchy chart or flowchart for a program that calculates


the current balance in a savings account. The program must ask the
user for:
- The starting balance
- The total dollar amount of deposits made
- The total dollar amount of withdrawals
- The monthly interest rate

Once the program calculates the current balance, it should be


displayed on the screen.
Predict the Result
Questions 33–35 are programs expressed as English statements. What would each display
on the screen if they were actual programs?

33. The variable x starts with the value 0. // x = 0


The variable y starts with the value 5. // y = 5
Add 1 to x . // x = x + 1 = 0 + 1 = 1
Add 1 to y . // y = y + 1 = 5 + 1 = 6
Add x and y , and store the result in y . // y = x + y = 1 + 6 = 7
Display the value in y on the screen. // 7

34. The variable j starts with the value 10. // j = 10


The variable k starts with the value 2. // k = 2
The variable l starts with the value 4. // l = 4
Store the value of j times k in j . // j = j * k = 10 * 2 = 20
Store the value of k times l in l . // l = k * l = 2 * 4 = 8
Add j and l , and store the result in k . // k = j + l = 20 + 8 = 28
Display the value in k on the screen. // 28

35. The variable a starts with the value 1. // a = 1


The variable b starts with the value 10. // b = 10
The variable c starts with the value 100. // c =100
The variable x starts with the value 0. // x = 0
Store the value of c times 3 in x . // x = c * 3 = 100 * 3 = 300
Add the value of b times 6 to the value already in x . // x = x + b *6 = 300 + 10*6 = 360
Add the value of a times 5 to the value already in x . // x = x + a*5 = 360 + 1*5 = 365
Display the value in x on the screen. // 365

Find the Error


36. The following pseudocode algorithm has an error. The program is supposed to as the user for the
length and width of a rectangular room, and then display the room’s area. The program must
multiply the width by the length in order to determine the area. Find the error.

area = width x length.


Display “What is the room’s width?”.
Input width.
Display “What is the room’s length?”.
Input length.
Display area.

Solution:

Program has Logical Error as it is calculating the area without asking the user for width and length of
the room. The correct program shall first ask the user for the values of length and width of the room
and then calculate area by multiplying the length with width.

Display “What is the room’s width?”.


Input width.
Display “What is the room’s length?”.
Input length.
area = width * length.
Display area.

You might also like