Professional Documents
Culture Documents
CHAPTER 1
Introduction to Programming
ANSWERS TO THE REVIEW QUESTIONS
Question 1. Broadly classify the computer system into two parts. Also make a comparison between a
human body and the computer system thereby explaining which part does what.
When we talk about a computer, we actually mean two things.
The first is the computer hardware which does all of the physical work computers are known for.
The second part is computer software which tells the hardware what to do and how to do it.
If we think of computer as a living being, then the hardware would be the body that does things like
seeing with eyes, lifting objects, and filling the lungs with air; the software would be the intelligence
which helps in interpreting the images that come through the eyes, instructing the arms how to lift
objects, and forcing the body to fill the lungs with air.
For details please refer to Section 1.1 page number 1 of chapter 1.
Question 2. Differentiate between computer hardware and software
software solutions. The hardware of a to complete. Software is generally not
computer is infrequently changed, in needed for the hardware to perform
comparison with software and data, which its basic level tasks such as turning on
are “soft” in the sense that they are readily and responding to input.
created, modified, or erased on the
computer
Fault: Hardware faults is physical. Software faults are not.
Lifetime: Hardware wears out over time. Software does not wear out over time.
Failure: Hardware failure is random. Hardware Software failure is systematic.
does have increasing failure at the last Software does not have an increasing
stage. failure rate.
Reliability: Hardware stays at steady reliability level in Software needs constant testing after
useful life. upgrades.
Question 3. Define programming
The computer hardware cannot think and make decisions on its own. So, it cannot be used to analyze a
given set of data and find a solution. The hardware needs a software (a set of programs) to instruct what
has to be done. A program is a set of instructions that is arranged in a sequence to guide a computer to
find a solution for the given problem. The process of writing a program is called programming.
Computer software is written by computer programmers using a programming language.
Question 4. Define source code
The programmer writes a set of instructions (program) using a specific programming language. Such
instructions are known as the source code. Another computer program called a compiler is then used on
the source code, to transform the instructions into a language that the computer can understand.
Question 5. What is booting?
When the computer starts, the first function that BIOS performs is to initialize and identify system
devices such as video display card, keyboard and mouse, hard disk, CD/DVD drive, and other hardware.
In other words, the code in the BIOS chip runs a series of tests called POST (Power On Self Test) to
ensure that the system devices are working correctly.
The BIOS then locates software held on a peripheral device such as a hard disk or a CD, and loads and
executes that software, giving it control of the computer. This process is known as booting.
Question 6. What criterion is used to select the language in which the program will be written?
The question of which language is best depends on the following factors:
The type of computer on which the program has to be executed
The type of program
The expertise of the programmer
For example, FORTRAN is a particularly good language for processing numerical data, but it does not
lend itself very well to organizing large programs. Pascal can be used for writing well‐structured and
readable programs, but it is not as flexible as the C programming language. C++ goes one step ahead of
C by incorporating powerful object‐oriented features, but it is complex and difficult to learn.
Question 7. Explain the role of operating System
Please refer to section 1.2.1 page number 4 of chapter 1.
Question 8. Give some examples of application software
Typical examples of software applications are word processors, spreadsheets, media players, education
software, CAD, CAM, data communication software, statistical and operational research software, etc.
Multiple applications bundled together as a package are sometimes referred to as an application suite.
Question 9. Differentiate between source code and object code.
Source code is the category of computer language instructions that is most frequently written and read
by software programmers. A computer cannot generally run a program in source code form though. The
source code is translated, with the use of an assembler or compiler, into a language form that contains
instructions to the computer known as object code. Object code consists of numeric codes specifying
each of the computer instructions that must be executed, as well as the locations in memory of the data
on which the instructions are to operate.
While source code and object code are commonly referred to as different classes of computer language,
these terms actually describe the series of transformations a program goes through when being
converted from a higher level language more easily comprehensible to humans to the lower level
language of computer operations.
Question 10. Why are compilers and interpreters used?
Compiler: A compiler is a program that converts the instructions of a high‐level language into machine
language as a whole. A program written in high level language is called source program. After the source
program is converted into machine language by the compiler, it is called an object program.
The compiler checks each statement in the source program and generates machine instructions.
Compiler also checks syntax errors in the program. A source program containing an error cannot be
compiled into an object program.
A compiler can translate the programs of only that language for which it is written. For example C++
compiler can translate only those programs, which are written in C++. Each machine required a separate
compiler for each high level language.
Interpreter: An interpreter is a program that converts one statement of a program at a time. It executes
this statement before translating the next statement of the source program. If there is an error in the
statement, the interpreter will stop working and displays an error message.
The advantage of interpreters over compilers is that an error is found immediately. So the programmer
can make corrections during program development.
The disadvantage of interpreter is that it is not very efficient. The interpreter does not produce an object
program. It must convert the program each time it is executed. Visual basic uses interpreter.
Question 11. Is there any difference between a compiler and an interpreter?
Compiler characteristics:
Interpreter characteristics:
Question 12. What is application software? Give examples
Please refer to section 1.2.2 page number 5 of chapter 1.
Question 13. What is BIOS?
Please refer section 1.2.1 page no. 3 of chapter 1.
Question 14. What do you understand by utility software? Is it a must to have it?
Please refer section 1.2.1 page no. 4 of chapter 1.
Question 15. Differentiate between syntax errors and logical errors?
Syntax errors. Errors in spelling and grammar. They appear while you write code. Syntax errors are the
most common type of errors. You can fix them easily in the coding environment as soon as they occur.
You can use the compiler or interpreter to uncover syntax errors.
You must have a good working knowledge of error messages to discover the cause of the error.
Logical errors. Errors that indicate the logic used when coding the program failed to solve the problem.
They appear once the application is in use. They are most often unwanted or unexpected results in
response to user actions. Logic errors are generally the hardest type to fix, since it is not always clear
where they originate
You do not get error messages with logic errors.
Your only clue to the existence of logic errors is the production of wrong solutions.
Question 16: Can a program written in a high level language execute without a linker?
A program that uses several files cannot be executed without a linker
Question 17: Give a briefing of generation of programming languages. Highlight the advantages and
disadvantages of languages in each generation.
Refer to section 1.4, page no. 6 of chapter 1.