0% found this document useful (0 votes)
86 views

Midterm Exam1 - 2020-2021 - Model Answer

The document is a midterm exam for a computer organization and assembly language course. It contains multiple choice and true/false questions testing knowledge of computer architecture concepts like RISC vs CISC, data representation, assembly instructions, and memory addressing modes. It also includes an assembly language programming question asking to write a RISC-style program to compute an expression.

Uploaded by

Khaled Hesham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views

Midterm Exam1 - 2020-2021 - Model Answer

The document is a midterm exam for a computer organization and assembly language course. It contains multiple choice and true/false questions testing knowledge of computer architecture concepts like RISC vs CISC, data representation, assembly instructions, and memory addressing modes. It also includes an assembly language programming question asking to write a RISC-style program to compute an expression.

Uploaded by

Khaled Hesham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

The Higher Technological Institute (HTI)

Department of Computer Science


Computer Organization, Architecture
Subject: Code: CSC 313
and Assembly language
Examiner: Dr. Nader Mahmoud Elshahat Time: 60 min
Exam Type: MID Term - exam Date: 13-12- 2020

Name: Group: Code:


Q1. True/False [10 marks]
1 Basic idea of RISC is to reduce number of machine instructions needed. (T )
2 Data is usually accessed from memory in n-bit groups, where n is called word length. (T )
3 Using 4-bit 2’s complement number, an overflow will result from the addition of (T )
(-7) + (- 2).
4 During the program execution, IR register is incremented to the point to next instruction (F )
5 Most computer operations are executed in the ALU but data operands are stored in memory (F )
unit during execution.
6 In sign extension, we extend new bits with only 0’s (F )
7 The main function of Program Counter (PC) register is to fetch and execute instructions (F )
8 Store R4,C (F )
Stores the value of memory location C to registers R4
9 The following assembly language is the correct representation of arithmetic expression (F )
C=A+B:
Load R2,A
Load R3,B
Add R4,R2,R2
Store R4,C
10 Processor uses a special register to point to top of stack that called “Link Register” (F )

Q2. Choose the correct answer [15 marks]


1) Which of the following is correct according to “Multi-computer” term.
a) All processors have access to shared memory.
b) Each computer have access to its own memory.
c) Processor exchange message via shared internal bus.

2) ………… converts assembly source program to an object program (machine code)


a) Loader b) Assembler c) Debugger d) Compiler

3) Assume R1 = 10011010 (8btis), R2 will contain ……… after executing AshiftR R2,R1, #3
a) 10011010 b) 11110011 c) 11100111 d) 00010011

4) Assume R1 = 10011010 (8btis), R2 will contain ……… after executing AshiftL R2,R1, #3
a) 10011010 b) 11010000 c) 11010111 d) 11110011

5) Assume R5 = 01110011 (8btis), R3 will contain ……… after executing RotateL R3,R5, #4
a) 00110000 b) 00110111 c) 00111110 d) 11010000

6) Assume R5 = 01110011 (8btis), R3 will contain ……… after executing RotateRC R3,R5, #4
a) 11001110 b) 00110011 c) 00110011 d) 00111001

1
7) Assuming 5-bit 2’s-complement numbers, the output of the following addition 7 and 13 is :
a) 00100 b) 10100 c) 00101 d) 11100

8) Assuming 5-bit 2’s-complement numbers, the output of the following addition -2 and -9 is :
a) 11101 b) 10101 c) 10111 d) 11110

9) In subroutine linkage …………. is used to save the address for return instruction to use:
a) Link register b) Stack pointer c) Frame pointer d) PC register

10) If SP points to top of stack which of the following statements pushes a new value from Register
R2 to top of stack:

a) store R2,(SP) b) subtract SP,SP,#4 c) add R2, SP d) Load R2,(SP)


store R2,(SP) Add SP,SP,#4

11) ADD R1,R1, (R2) is an example of ………….. address mode.


a) Indirect b) Immediate c) Implied d) Direct

12) If R4 contain the decimal number 2000, what is the effective address in case of 12(R4):
a) 2000 b) 2012 c) 1988 d) none of the mentioned

13) Which of the following instructions causes the value 300 to be stored in memory location 1000:
a) store 1000,300 b) load R2,#1000 c) load R2,#1000 d) load R2,#300
load R3,#300 load R3,#300 load R3,#100
store R3,(R2) store R3, R2 store R3,(R2)

14) …………. is the assembly directive that define the starting memory address to store program instruction.
a) RESERVE b) ORIGIN c) DATAWORD d) EQU mentioned

15) Which of the following instructions uses hexadecimal representation for number:
a) ADD R2,R3, #0h5D b) ADD R2,R3, %01011101 c) ADD R2,R3, #0x5D

Q3. [5 marks]
Write a RISC-style program that computes the expression Z = (A * B + C) / D.

LOAD R2, A

LOAD R3, B

MULTIPLY R2, R2,R3

LOAD R3, C

ADD R2,R2,R3

LOAD R3, D

Divide R2,R2,R3

STORE R2, Z

Best Wishes

You might also like