Lab 1.1 Exercise Answers


This section gives you some suggested answers to the questions in Lab 1.1, with discussion related to how those answers resulted. The most important thing to realize is whether your answer works. You should figure out the implications of the answers here and what the effects are from any different answers you may come up with.

1.1.1 Answers

a)

What is a program?

A1:

Answer: A computer program comprises instructions that direct the actions of the computer.


b)

Without using a computer program to fulfill this responsibility, what potential problems do you foresee in generating this report every day?

A1:

Answer: Programs help us with repetitive, time-consuming , and error-prone tasks . If you do not have a program that helps you create this report, it might take you a whole day to collect the needed information for the report and perform the needed calculations. As a result, you will not be able to concentrate on your other responsibilities. In addition, sooner or later you will probably make mistakes while creating the report.

c)

Based on your observations in question b, how do you think a computer program would make that task easier?

A2:

Answer: Using a program guarantees fast retrieval of needed information and accurate results, assuming that the program does not contain any errors. Furthermore, once a program is created, the same set of steps is repeated on a daily basis. Consequently, a well-written program is not susceptible to human frailties such as typographical errors or the accidental exclusion of a formula.

d)

What is a programming language?

A3:

Answer: A programming language is a set of instructions consisting of rules, syntax, numerical and logical operators, and utility functions.


e)

What type of programming language is this code written in?

A1:

Answer: This is an example of a machine language.


Machine language is understood directly by the computer. Each statement in machine language is represented by a string of zeros and ones.

This example illustrates the nonintuitive nature of machine language. However, a computer can read these instructions directly and execute them instantly. You can see that creating a program in a machine language can be a slow and tedious process. To facilitate program creation, programmers use higher-level languages that are closer to human language.

f)

What type of programming language is this code written in?

A1:

Answer: This is an example of an assembly language.


Assembly language uses mnemonic symbols to represent the binary code of machine language. Each assembly instruction is directly translated into a machine language instruction. You may notice that assembly language is slightly easier to understand than machine language.

g)

What type of programming language is this code written in?

A1:

Answer: This is an example of a high-level language.


Programs created in high-level languages are portable. They can be moved from one computer to another because a high-level programming language is not machine-specific. High-level languages must be translated into machine language with the help of an interpreter or a compiler.

1.1.2 Answers

a)

What is an interpreted language?

A1:

Answer: An interpreted language is translated into machine language with the help of another program called an interpreter. The interpreter translates statement in the program into machine language and executes it immediately before the next statement is examined.

b)

What is a compiled language?

A2:

Answer: A compiled language is translated into machine language with the help of the program called a compiler. Compilers translate English-like statements into machine language.

c)

Which do you think will run quicker, an interpreted or a compiled program?

A3:

Answer: Generally, interpreted programs run slower than compiled programs.


As you observed earlier, an interpreted program must be translated into machine language every time it is run. A compiled program is translated into machine language only once when it is compiled, and then it can be executed as many times as needed. As a result, an interpreted program runs slower than a compiled program.



Oracle PL[s]SQL by Example
Oracle PL[s]SQL by Example
ISBN: 3642256902
EAN: N/A
Year: 2003
Pages: 289

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net