go to previous page   go to home page   go to next page hear noise highlighting

Answer:

The assembler will not catch this mistake, and the program will run to completion. However, the second print method call writes an incorrect value to the screen.


No Type Checking

SPIM output

This type of mistake often happens when programming in C where type checking is weak. A variable j might hold a bit pattern that represents an integer. If that bit pattern is passed to a function that expects a float, such as printf("%f", j), odd things happen.

Compilers that keep track of the data types of values and that make sure that the correct types are used as arguments do strong type checking. Java is strongly typed. In assembly language type checking is up to the programmer.


QUESTION 11:

Look at the program on the previous page.

The first line of output shows the 32 bits interpreted as a single precision floating point value. Is this output correct?


go to previous page   go to home page   go to next page