Computer Organization Quiz Part I. Multiple choice questions. Please write down one answer for each question in the following table. 4 points for each question. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1....

1 answer below »
Quiz on Computer Architecture. There are total 21 questions in this quiz including 15 MCQs and 6 short answer type questions.


Computer Organization Quiz Part I. Multiple choice questions. Please write down one answer for each question in the following table. 4 points for each question. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1. Which of the following numbers has a two’s complement representation as 1001 1110 in 8 bits? (a) -2610 (b) -9810 (c) -12010 (d) None of the above. 1. What is -4.7510 represented as a single precision floating point number? (a) 1 10000001 001 1000 0000 0000 0000 0000 (b) 1 10000001 001 0100 0000 0000 0000 0000 (c) 1 10000010 011 0000 0000 0000 0000 0000 (d) None of the above. 1. After the following instructions, what will be the value in $t0? ori $t0, $0, 9 addi $t0, $t0, 2 (a) 1 (b) 11 (c) 0 (d) None of the above. 1. After the following instructions, what will be the value in $t0? xori $t0, $0, 8 andi $t0, $t0, 16 (a) 0 (b) 8 (c) 16 (d) None of the above. 1. After the following instructions, what will be the value in $t0? ori $t0, $0, 9 ori $t0, $t0, 11 (a) 2 (b) 9 (c) 11 (d) None of the above. 1. After the following instructions, what will be the value in $t0? addi $t0, $t0, 8 slt $t0, $t0, $t0 (a) 0 (b) 1 (c) 8 (d) None of the above. 1. Which of the following statements is true? a. ori $t0, $0, 100000 will result in an error message in the simulator b. The lower 16 bits of the encoding of beq $t0, $t1, L1 are the lower 16 bits of the address associated with L1. c. Both of the above d. None of the above 1. Suppose a word array is 0,1,2,3,4,5,6,7,8,9 and its starting address is now in $t0. After the following instructions, what will be the values in the array? addi $t0, $t0, 12 sw $t0, 12($t0) (a) 0,1,2,12,4,5,6,7,8,9 (b) 0,1,2,3,4,5,6,7,8,9 (c) 0,1,2,3,4,5,12,7,8,9 (d) None of the above. 1. Suppose $t0 and $t1 are holding 0 and 1, respectively. When the program enters this segment, right before the program executes the instruction after p9L3, what will be the value in $t0? p9L0:bne $t0, $t1, p9L2 p9L1:beq $t0, $t0, p9L3 p9L2:jal p9L1 p9L3:add $t0, $t1, $t1 (a) 0 (b) 1 (c) 2 (d) None of the above. 1. Which of the following statements is true? (a) A MIPS function must save $ra in $sp (b) A MIPS function must save $a0 in the stack (c) Both of the above (d) None of the above. 1. Which of the following statements is true? (a) In MIPS, a label must have 2 or more characters (b) In MIPS, the name of a word array is a special kind of label different from labels for instructions (c) Both of the above (d) None of the above. 1. Which of the following statements is true? (a) After executing a jal instruction, the value in $ra may stay the same. (b) A function must have at least one jr $ra instruction. (c) Both of the above (d) None of the above. 1. Suppose a function F1 calls another function F2 inside a loop. Which of the following statements is true? (a) F1 must save $ra (b) The loop counter in F1 can be $t0 (c) Both of the above (d) None of the above. 1. Which of the following statements is true? (a) In MIPS, the stack is always pointed by the PC (b) In MIPS, $ra is always the address of the instruction currently being executed (c) Both of the above (d) None of the above. 1. Which of the following statements is true? (a) A MIPS instruction is always encoded in 32 bits (b) Different instructions may have different length of the opcode field (c) Both of the above. (d) None of the above. Part II. Short answer questions 1. (6 points) Please complete the following code, which multiplies $s0 by 12 and stores the result in $t0. No registers other than $t0 should be modified. add sll $t0, 1. (4 points) Please fill the truth table for a circuit that takes three bits X2, X1, X0 as input, and produces one bit Y as output, where Y is 1 if and only if (X2, X1, X0) as an unsigned binary number is a power of 2. X2 X1 X0 Y 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 1. (6 points) Please use the Karnaugh map to derive the logic function for the following truth table: X2 X1 X0 Y 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 X2X1 X0 1. (6 points) Please complete the following code, which copies bit 0 to 3 of $s0 to bit 4 to 7 of $s1. Assume the higher 24 bits of both $s0 and $s1 are 0. For example, if the lower 8 bits of $s0 and $s1 are 0011 0010 and 1111 0000, respectively, after running the code, $s1 should be 0010 0000. Only $t0 can be modified in addition to $s1 in your code. andi $t0, or $s1, $s1, $t0 1. (8 points) Please complete the following code, which is supposed to be a loop that scans a word array, adds the numbers that have been scanned, and exits when the summation, to be stored in $t0, is larger than the number in $s2, or until all numbers has been scanned. The starting address of the array is in $s0. The length of the array is in $s1. Only $t0, $t1, and $t2 can be modified in your code. ori $t0, $0, 0 ori $t1, $0, 0 P2P5L0:sll $t2, $t1, 2 lw $t2, 0($t2) bgt $t0, addi $t1, $t1, 1 P2P5L1: nop 1. (10 points) Please write a function called “bin2dec” to convert a binary number to decimal, where the binary number is 8 bits and is stored as a word array in the memory, Most Significant Bit (MSB) at the lowest address. The starting address of the array is in $a0. The result should be returned in $v0. For example, for the following code, $v0 should be 177 after the function call. .data AA:.word 1, 0, 1, 1, 0, 0, 0, 1 .text .globl main main:la $a0, AA jal bin2dec done:li $v0,10 syscall Please note that: · You would need to complete the function using a total of 9 or less instructions. Two points will be taken off for any additional instructions. jr $ra is counted as one instruction in the function. · Please follow the MIPS calling conventions for register use. In particular, you would not need to keep $a0 unchanged after the function call. · Certain registers must be initialized. They cannot be assumed to be 0 when the function is called.
Answered Same DayFeb 26, 2021

Answer To: Computer Organization Quiz Part I. Multiple choice questions. Please write down one answer for each...

Vaishnavi R answered on Feb 26 2021
151 Votes
Computer Organization Quiz
Part I. Multiple choice questions.
Please write down one answer for each question in the following table. 4 points for each question.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11

    12
    13
    14
    15
    b
    a
    b
    a
    c
    a
    c
    c
    c
    b
    d
    b
    c
    d
    a
1. Which of the following numbers has a two’s complement representation as 1001 1110 in 8 bits?
(a) -2610
(b) -9810
(c) -12010
(d) None of the above.
1. What is -4.7510 represented as a single precision floating point number?
(a) 1 10000001 001 1000 0000 0000 0000 0000
(b) 1 10000001 001 0100 0000 0000 0000 0000
(c) 1 10000010 011 0000 0000 0000 0000 0000
(d) None of the above.
1. After the following instructions, what will be the value in $t0?
ori $t0, $0, 9
addi $t0, $t0, 2
(a) 1
(b) 11
(c) 0
(d) None of the above.
1. After the following instructions, what will be the value in $t0?
xori $t0, $0, 8
andi $t0, $t0, 16
(a) 0
(b) 8
(c) 16
(d) None of the above.
1. After the following instructions, what will be the value in $t0?
ori $t0, $0, 9
ori $t0, $t0, 11
(a) 2
(b) 9
(c) 11
(d) None of the above.
1. After the following instructions, what will be the value in $t0?
addi $t0, $t0, 8
slt $t0, $t0, $t0
(a) 0
(b) 1
(c) 8
(d) None of the above.
1. Which of the following statements is true?
a. ori $t0, $0, 100000 will result in an error message in the simulator
b. The lower 16 bits of the encoding of beq $t0, $t1, L1 are the lower 16 bits of the address associated with L1.
c. Both of the above
d. None of the above
1. Suppose a word array is 0,1,2,3,4,5,6,7,8,9 and its starting address is now in $t0. After the following instructions, what will be the values in the array?
addi $t0, $t0, 12
sw $t0, 12($t0)
(a) 0,1,2,12,4,5,6,7,8,9
(b) 0,1,2,3,4,5,6,7,8,9
(c) 0,1,2,3,4,5,12,7,8,9
(d) None of the above.
1. Suppose $t0 and $t1 are holding 0 and 1, respectively. When the program enters this segment, right before the program executes the instruction after p9L3, what will be the value in $t0?
p9L0:    bne $t0, $t1,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here