Sunteți pe pagina 1din 5

Section 1.1.

1. How do assemblers and linkers work together?

An assembler converts source-code programs from assembly language into machine language. A linker combines
individual files created by an assembler into a single executable program.

2. How will studying assembly language enhance your understanding of operating systems?

Assembly language is a good tool for learning how application programs communicate
with the computer's operating system via interrupt handlers, systemcalls, and common memory areas. Assembly
language programming also helps when learning how the operat- ing system loads and executes application
programs.

3. What is meant by a one-to-many relationship when comparing a high-level language to machine


language?

In a one-to-many relationship, a single statement expands


into multiple assembly language or machine instructions.

For example:

int Y;

int X = (Y + 4) * 3;

now assembly language

mov eax,Y ; move Y to the EAX register

add eax,4 ; add 4 to the EAX register

mov ebx,3 ; move 3 to the EBX register

imul ebx ; multiply EAX by EBX

mov X,eax ; move EAX to X

4. Explain the concept of portability as it applies to programming languages.

Portability is a characteristic attributed to a computer program if it can be used in an operating systems other than
the one in which it was created without requiring major rework. ... Ideally, such a program needs only to be
compiled for the operating system to which it is being ported.

5. Is the assembly language for x86 processors the same as those for computer systems such as the Vax
or Motorola 68x00?

No. Each assembly language is based on either a processor family or a specific computer.

6. Give an example of an embedded systems application.


Some examples of embedded systems are MP3 players, mobile phones, video game consoles, digital cameras,
DVD players, and GPS. Household appliances, such as microwave ovens, washing machines and dishwashers,
include embedded systems to provide flexibility and efficiency.

7. What is a device driver?

In computing, a device driver is a computer program that operates or controls a particular type of device that is
attached to a computer. ... Drivers are hardwaredependent and operating-system-specific. They usually provide the
interrupt handling required for any necessary asynchronous time-dependent hardware interface.

8. Do you suppose type checking on pointer variables is stronger (stricter) in assembly language, or in C
and C++?

C++ does not allow a pointer of one type to be assigned to a pointer of another type. Assembly language has no such restriction
regarding pointers.

9. Name two types of applications that would be better suited to assembly language than a high-level
language.

Applications suited to assembly language: hardware device driver and embedded systems and computer games requiring direct
hardware access.

10. Why would a high-level language not be an ideal tool for writing a program that directly accesses a
printer port?

Assembly language not be an ideal tool for writing a program that directly accesses a printer port

11. Why is assembly language not usually used when writing large application programs?

Assembly language has minimal formal structure so structure must be imposed by programmers who have varying
levels of experience. This leads to difficulties maintaing existing code.

12. Challenge: Translate the following C++ expression to assembly language, using the example
presented earlier in this chapter as a guide: X (Y * 4) 3.

int Y;

int X = (Y + 4) * 3;

now assembly language

mov eax,Y ; move Y to the EAX register

add eax,4 ; add 4 to the EAX register

mov ebx,3 ; move 3 to the EBX register

imul ebx ; multiply EAX by EBX

mov X,eax ; move EAX to X

1.2.1 section review


1. In your own words, describe the virtual machine concept.

Virtual machine concept: Computers are constructed in layers, so that each layer represents a
translation layer from a higher-level instruction set to a lower-level instruction set.

2. Why do you suppose translated programs often execute more quickly than interpreted ones?

Translated Programs run faster, due to having code directlyexecuted on the machine. Interpretation
Programs interprets and execute the instructions one by one.

3. (True/False): When an interpreted program written in language L1 runs, each of its instructions is
decoded and executed by a program written in language L0.

True

4. Explain the importance of translation when dealing with languages at different virtual machine levels.

An entire L1 program is converted into an L0 program by an L0 program specifically designed for this
purpose. Then the resulting L0 program is executed directly on the computer hardware.

5. At which level does assembly language appear in the virtual machine example shown in this section?

Assembly language, which appears at Level 3, uses short mnemonics such as ADD, SUB, and MOV, which
are easily translated to the ISA level. Assembly language programs are translated (assembled) in their
entirety into machine language before they begin to execute.

6. What software utility permits compiled Java programs to run on almost any computer?

The Java virtual machine (JVM) allows compiled Java programs to run on almost any computer.

7. Name the four virtual machine levels named in this section, from lowest to highest.

1Digital logic, 2instruction set architecture,3 assembly language,4 high-level language.

8. Why don’t programmers write applications in machine language?

Machine language is difficult for humans to understand, since it provides no visual clues relating to the
instruction syntax.

9. Machine language is used at which level of the virtual machine shown in Figure 1-1?

Instruction set architecture (ISA)

10. Statements at the assembly language level of a virtual machine are translated into statements at
which other level?

Level 2

1.3.9 Section Review


1. Explain the term least significant bit (LSB).

Sometimes abbreviated as LSB, the least significant bit is the lowest bit in a series of numbers in binary; the LSB
is located at the far right of a string. For example, in the binary number 10111001, the least significant bit is the far
right 1.

4. How many bytes are contained in each of the following data types? a. word b. doubleword c.
quadword d. double quadword

Fundamental Data Types A byte is eight bits, a word is 2 bytes (16 bits), a doubleword is 4 bytes (32 bits), and a quadword is
8 bytes (64 bits).

5. What is the minimum number of binary bits needed to represent each of the following unsigned
decimal integers? a. 65

Binary numbers are numbers with base 2 in which each bit is either 0 or 1 while the
decimal numbers are the numbers with base 10 containing digits 0, 1, 2, 3, 4, 5, 6, 7,
8, or 9. Unsigned binary integers are positive but a signed binary integer can be
positive or negative. Hence, the binary representation of 65 is 1000001.

The minimum bits required to represent decimal number 65 is 7 bits.

21. What are the hexadecimal and decimal representations of the ASCII character capital B?

Decimal:66 ,hexadecimal:42

22. What are the hexadecimal and decimal representations of the ASCII character capital G?

Dec:71,hex:47

23. Challenge: What is the largest decimal value you can represent, using a 129-bit unsigned
integer?

2^129 – 1

24. Challenge: What is the largest decimal value you can represent, using a 86-bit signed
integer?

Answer Expert Verified. 2^85 - 1 or 38,685,626,227,668,133,590,597,631 Sinceyou're using a 86-bit signed


integer, the smallest number you can represent is -2^85 and the largest number you can represent is 2^85 - 1.

27. If a boolean function has four inputs, how many rows are required for its truth table?

If a Boolean expression has two inputs then there will be 22=4 rows in its truth table. If a
Boolean expression has three inputs then there will be 23=8 rows in its truth table. If a Boolean expression has four
inputs then there will be 24= 16 rows in its truth table.

28. How many selector bits are required for a four-input multiplexer?
As two selector lines are required for a four-input multiplexer, two selector bits are required. The possible
values for the selector bits are 00,01,10,11.

S-ar putea să vă placă și