Final Exam 605.204    Solution

 

1)                  As described by Hennessy and Patterson ,the modern computer is composed of five  (4)    classic hardware components.  Given one, list the other four:

 

            ___________________________ ,    ___________________________ , and OUTPUT, 

 

            ___________________________ ,    ___________________________ .

 

 

2)                  The hardware above provides the four basic functions that every computer performs.   

(4)        What are these functions ?

 

            data _______________________ ,     data __________________________ ,

 

            data _______________________ ,     and ___________________________ .

 

 

3)                  The integer word length and register size of the MIPS machines is  (1)

A)  8 bits.         B) 1 byte.        C) 3 bytes.       D) 32 bits.

 

 

4)                  How are negative integer numbers represented on the MIPS machines ?

(1)         

A)  ASCII.   B) 1's complement.   C) 2's complement.   D) negative integers are not allowed.

 

 

5)                  Today, assembly language programs are more efficient than compiled high-level language  (1)             programs, such as C++, for the same large accounting applications.                                     

                                    ( True / False )

  

6)                  1,099,511,627,776 bytes is known as:    A) Gigabyte            B) Terabyte     C) Petabyte

(1)

 

7)                  Given this hexadecimal representation of a 16-bit Two’s Complement number:  

(1)                   753B

 

             Is the value    A) less than zero      B) equal to zero      C) greater than zero       D) invalid

 

 

 

8)                  Match these people with their noted accomplishments :

(4)         

                    Alan Turing ____
A) - ENIAC 
                              L0pht ____
B) - TCP / IP 
            J. Presper Eckert ____
C) - computing theory
              Vinton G. Cerf ____
D) - Internet Security
 

 

9)                  What is the purpose of each of the following MIPS assembler directives:

(4)         

             .globl ____________________________________________________________

 

             .text    ____________________________________________________________

 

             .word ____________________________________________________________

 

             .asciiz ____________________________________________________________

 

 

10)              Convert   0.435   to a binary fraction ( total of 8 bits)  For example 0.75 = 0.1100 0000 (3)

 

 

 

 

 

 

 

 

 

11)              The MIPS subroutines generally have  PROLOG code.  What is the purpose of this code ?

(2)

            __________________________________________________________

 

            __________________________________________________________

 

 

12)              The MIPS multiply hardware stores the 64 bit product in two registers, HI and LO. 

(1)        What does it mean when the value in the HI register is minus one (-1) ?

 

            _________________________________________________________________

 

 

13)              Which of the following must be performed by every assembler :

(1)

A)    Provide relocatable object code.

B)     Process a program in two passes.

C)     Assign machine memory addresses to symbol labels.

14)              Floating point arithmetic has problems different from integer arithmetic.  

(3)        Which of these floating point arithmetic statements are True and which are False?

 

A)      Addition of two positive numbers will never overflow.

 

B)       Addition of a positive and a negative number will never overflow.

 

C)       Multiplication of a positive and a negative number will never overflow.

 

 

15)              What is the primary reason a two-pass assembler is necessary rather than a one-pass assembler ?

(1)

A)    Instructions may vary in length.

B)     Symbols need to be stored in the symbol table. 

C)     Symbols may be defined before they are used as operands.

D)    Symbols may be used as operands before they are defined.

 

 

16)              Computer Arithmetic has a problem called ‘Overflow’.  Simply what is this problem ?

(1)

            ___________________________________________________________________

 

 

17)              Generate the hexadecimal object machine code for each line in the following MIPS source          (20)             program.  (Use the Green reference card)  Values are decimal numbers.

                                                 

                        ( For example:  sub $s4, $s2, $s1  =  0251 A022 )

 

                        .text     2044

                        .globl strcpy                #  subroutine for memory copy of a string from A to B  strcpy: add      $t0, $zero, $zero         #  index to the next character to copy             loop: add         $t1, $t0, $a0                       #  t1 has address of A                         lb         $t2, 0($t1)                   #  get the next character                          add      $t3, $t0, $a1                #  t3 has the address of B

                        sb         $t2, 0($t3)                   #  copy it

                        beq      $t2, $zero, finish         #  if it is null character, then finished

                        addi     $t0, $t0,1                     #  increment the index

                        j           loop                             #  continue the copy

             finish: jr          $ra                               #  return from the subroutine

18)              Write the MIPS Assembler pair of hardware instructions for this pseudoinstruction:

(3)

            BGT $s4, $t1, AGAIN

 

 

 

 

 

 

19)              The MIPS hardware does not have a subtract immediate instruction.  Why ?

(1)

            _________________________________________________________________

 

 

20)              The MIPS architecture has five Addressing Modes.  

(5)        For each of the modes, give an example of an instruction that uses each.

 

            Base  ____________________________________________________________

 

            Register  _________________________________________________________

 

            Immediate  _______________________________________________________

 

            Pseudo Direct  _____________________________________________________

 

            Program Counter  _________________________________________________

 

 

21)              Floating point numbers are stored in Normalized format.  Give three reasons :

(3)

A)  _______________________________________________________________

 

B)   _______________________________________________________________

 

C)   _______________________________________________________________

 

 

22)              From the discussion readings:  What was the first Internet ‘killer app’?

(1)

            _________________________________________________________________

 

 

23)              What decimal value does this bit pattern :

(1)

            0000  0000  0000  0000  0000  0000  0000  0000

 

            represent (exactly) in the IEEE 754 format ?  ______________________

 

 

24)              Convert the following decimal value to its MIPS floating point binary value: 

(4)        (IEEE 754 32-bit format)  Show result as hex digits.

            8765.75

 

 

 

 

 

 

 

 

 

 

 

 

 

 

25)              Identify which of these Assembly process functions would most likely occur in  (4)

             1)   Pass one  or  2)   Pass two            of a two-pass assembler

 

             _____ a)  Translate mnemonic operation codes to machine codes

             _____ b)  Save addresses assigned to labels

             _____ c)  Scan for label definitions

             _____ d)  Write object code

 

 

26)              Match the statements ( a - e ) with the most appropriate Object Program record type : 

(5)

                        D)  Data Segment        S)  Symbol

                        H)  Header                   T)  Text Segment         

                        R)  Relocation              

 

             _____ a)  Object instruction code.

 

             _____ b)  Relative address of global symbol.

             

             _____ c)  Modification information.

             

             _____ d)  Program name.

 

             _____  e)  Data values.

 

 

27)              Does the MIPS assemble language allow for arithmetic with 1-byte and 2-byte operands?   

(2)        Yes / No ? Why ?

            _______________________________________________________________________

 

            _______________________________________________________________________ 28) Natural languages are clear and concise, and therefore suitable for use as programming languages.

(1)                                (True / False) 

 

 

29)       Register $t5 contains a negative 32-bit value in two’s complement form. After performing a         1-bit sll instruction, followed by a 1-bit srl instruction. Register $t5 would contain the absolute       value of the original value.  

(1)                                ( True / False )

 

 

30)       The IEEE 754 floating point standard includes these objects.  

(4)        What they are, and how they are used ??

 

            Guard Bit :____________________________________________________________

 

            _____________________________________________________________________

 

            Round Bit : ____________________________________________________________

 

            _____________________________________________________________________

 

             Sticky Bit :____________________________________________________________

 

            _____________________________________________________________________

 

            NaN : ________________________________________________________________

 

            _____________________________________________________________________

 

 

31)              What is RAID 1 ? ________________________________________________

(2)

            ________________________________________________________________________

 

 

32)              Which of the following is a primary characteristic of System Software ?

(1)

A)    It is totally machine independent.

B)     Will run on any PC or Unix machine.

C)     Supports the operation of a specific computer.

D)    Calculates employee paychecks.

 

 

33)              What is the primary purpose of Pass One of the Two-pass Linker/Loader ?  ___________

(2)

            ________________________________________________________________________

 

 

34)              A process that is BLOCKED must wait for an event to occur before it can resume processing.

(1)                                ( True / False )

35)       Given two programs that are multiprogrammed in a single processor computer: 

(2)        Program ONE uses a large amount of CPU time and little I/O.  

            Program TWO uses a small amount of CPU time but performs a large number of I/O operations.  Which program should get the higher priority for dispatching the single CPU?   Why?

 

            ________________________________________________________________________

 

            ________________________________________________________________________

 

 

36)              The purpose of the Main Frame Operating System Job Scheduler is to assign resourses   (2)       to waiting program processes.  The Scheduler has a priority scheme.           List the names of two of these schemes. 

             

A)    ____________________________________________________________________

 

B)     ____________________________________________________________________

 

 

37)              The Grammar describes the  (A) SEMANTICS  or (B) SYNTAX  of the   (1)             programming language.

 

 

38)              The I / O  Channel causes an I / O Interrupt  when the I / O process completes. 

(1)                                ( True / False )

 

 

39)              The purpose of Interrupts and the Interrupt Processing is to  (1)

A)    Stop the computer when a fault occurs.

B)     Slow down the processing of programs.

C)     Enable the operating system to efficiently process several concurrent programs.

 

 

40)              Given this binary bit pattern, what is the MIPS instruction as Assembly Language: 

(3)

            1000 1101 0010 1000 0000 0100 1011 0000

 

 

 

 

 

 

41)              One of the two basic functions of any Operating System is to provide the  programming (1)              run-time environment.  What is the other basic function ?

 

            _______________________________________________________________________

 

42)              Given this Intermediate File of a Compiler : 

(8)

            ( 1 )       : =         #1                             Indx

            ( 2 )       JGT      Indx           #25         (20)

            ( 3 )       -            Indx           #1           t1

            ( 4 )       *            t1               #10         t2

            ( 5 )       *            #2              MLK      t3

            ( 6 )       -            t3               #1           t4

            ( 7 )       -            t4               #1           t5

            ( 8 )       +           t2               t5            t6

            ( 9 )       *            t6               #4           t7

            ( 10 )     -            Indx           #1           t8

            ( 11 )     *            t8               #10         t9

            ( 12 )     *            #2              MLK      t10

            ( 13 )     -            t10             #1           t11

            ( 14 )     +           t9               t11          t12

            ( 15 )     *            t12             #4           t13

            ( 16 )     : =         ZYX[t13]                 CBA[t7]

            ( 17 )     +           #1              Indx        t14

            ( 18 )     : =         t14                            Indx

            ( 19 )     JMP                                      ( 2 )

            ( 20 )

 

Optimize the code.  

Mark which statements would be moved, modified, or removed.  

Machine independent code optimization uses many techniques.   List the optimization methods you used.

 

 

 

 

 

 

 

 

 

43)              In a few phrases, describe these components of a compiler.

(3)

            SCANNER - 

 

            _________________________________________________________

 

PARSER - 

 

            _________________________________________________________

 

            CODE GENERATOR - 

 

            _________________________________________________________

 

 

44)              From the discussion readings: What is Ubuntu?

(1)

            _________________________________________________________________

 

 

45)              Machine independent code optimization uses many techniques.  List two of the methods   (2)             discussed in the presentation that you did not use in problem #42  (on previous page).

 

            __________________________________

 

            __________________________________

 

 

46)              Match the following terms with the most correct definition.

(8)

             _____ 1)  CHANNEL PROGRAM                  A)  Set of programs in a Circular Wait.

             _____ 2)  CONTEXT SWITCHING               B)  Set mask to prevent Interrupt Processing

             _____ 3)  DEAD - LOCK                                C)  Register containing interrupt mask

             _____ 4)  DISPATCHING                               D)  Set of instructions for special i/o 

             _____ 5)  STORAGE PROTECTION KEY   E)  Select next program to process by CPU

            _____ 6)  INHIBIT INTERRUPT                    F)  Data area used by the Memory Manager  _____ 7)  PAGE TABLE MAP                        G)  Saving / restoring registers by Interrupt Processor.

             _____ 8)  PROGRAM STATUS WORD        H)  Half byte used for memory access control.

 

 

47)              Is memory-protection hardware necessary on a machine that uses a Virtual (demand-paged)  (2)             Memory Management system ? Yes / No ? Why ?

 

            ____________________________________________________________

 

            ____________________________________________________________

 

 

48)              In many operating systems, the Timer Interrupt (the assigned time interval is used up) is assigned (2)             a lower priority than the Operating System Service Request Interrupt.  Why is this done?

 

            ____________________________________________________________

 

            ____________________________________________________________

 

 

49)              Once the operating system detects that a Deadlock has occured, 

 (2)      how does it resolve the conflict between the processes ?   List two methods.

 

A)    __________________________________________________________

 

B)     __________________________________________________________

 

 

50)              What actions must the Operating System perform when an interrupt is recognized ?

(2)

             A)___________________________________________________________

 

            B)___________________________________________________________

 

 

51)              Is it ever safe (you do not lose data values ) for a MIPS user program to use registers $k0 or $k1 ?

(2)        Yes / No ? Why ?

 

            _____________________________________________________________________

 

            _____________________________________________________________________

 

 

52)              The Textbook, page 36, discusses the Classic CPU Performance Equation.  Fill in the blanks:

(2)         

 

             



 

 

 

 

53)              Given the following Simplified Pascal grammar :

(3)

            < stmt-list     : : =      < stmt   { ;  < stmt }

            < stmt           : : =     < assign   |  < read   |  < write   |  < for

             < assign        : : =      id  : = < exp

             < exp            : : =     < term { + < term   |  - < term }

             < term          : : =      < factor { * < factor   |  DIV < factor }

            < factor         : : =     id | int | ( < exp )

 

Modify the above Grammar to include the exponentiation operation.  Make exponentiation the highest priority arithmetic operation.

 

            __________________________________________________________________

 

            __________________________________________________________________

 

__________________________________________________________________

 

 

54)       Create quadruples of the form we have used in class for the following <assign statement:

(6)

            ZEE :=  3 * EX – 5 * WHY + EX / WHY;
 

 

 

 

 

 

 

 

 

 

55)       The Optical Mouse includes an embedded processor.

(1)                                (True / False)

 

 

56)              Data Security consists of a number of methods and techniques.  Name two.

(2)

            ( Extra credit for more than two. Max : 4 extra points.)

 

            ____________________________    ______________________________

 

            ____________________________    ______________________________

 

            ____________________________    ______________________________

 

57)              Don’t forget to complete the online Course Evaluation Survey.

             It is the only method to provide the feedback for improving the course.
Powered by