Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
129 views

Computer Organization & Assembly Language Mid Term 2020-Resit Students

This document contains a midterm examination for a Computer Organization and Assembly Language course. It consists of 4 questions assessing various topics: 1. Multiple choice questions testing concepts like file types produced by a linker, virtual address ranges, overflow in unsigned addition, and assembly instruction examples. 2. Questions involving converting between binary, hexadecimal, and decimal representations of numbers, writing assembly code for bitwise operations, and explaining shifting a register arithmetic right 31 times. 3. Questions explaining assembly addressing modes, variants of the mov instruction, and representing floating point numbers in IEEE 754 standard format. 4. A question explaining the working of a simple C function and its equivalent assembly code, including drawing the initial stack

Uploaded by

Hamayon Wazir
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views

Computer Organization & Assembly Language Mid Term 2020-Resit Students

This document contains a midterm examination for a Computer Organization and Assembly Language course. It consists of 4 questions assessing various topics: 1. Multiple choice questions testing concepts like file types produced by a linker, virtual address ranges, overflow in unsigned addition, and assembly instruction examples. 2. Questions involving converting between binary, hexadecimal, and decimal representations of numbers, writing assembly code for bitwise operations, and explaining shifting a register arithmetic right 31 times. 3. Questions explaining assembly addressing modes, variants of the mov instruction, and representing floating point numbers in IEEE 754 standard format. 4. A question explaining the working of a simple C function and its equivalent assembly code, including drawing the initial stack

Uploaded by

Hamayon Wazir
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Department of Computer Science

Mid Term Examination Fall 2020


Semester III Computer Organization & Assembly Language

10-12-2020 Time: 120 Minutes

Roll NO. _______________ Name ___________________________ Section _______

Question No. 1 Multiple Choice (05 Marks)

1. What kind of file is produced by a Linker


a) .s file 6. For a w-bit number the UMIN and UMAX
b) .o file would be
c) .exe file a) –2w–1, 2w–1 – 1
d) .i file b) 0, 2w – 1
c) –2w, 2w–1 – 2
2. An address of 16-lines can address
d) –2w, 2w–1
memory upto
a) 4 GB
b) 64 KB
7. For unsigned addition of w-bit numbers
c) 128 KB
we need w+1 bit in sum, therefore for two
d) More than 4 GB
numbers x and y the sum s would always
be
3. A w-bit word size would generate virtual a) s module 2w
address from, assume address start from b) (x+y) module 2w
1 c) Both a and b
a) 1 to 2w d) None of the above
b) 1 to 2w-1
c) 1 to 2w-2 8. At machine level program, the program
d) All of the above and data both are encoded as
a) Same kind of sequence of bytes
4. The equivalent sets of following bit b) Program and data encoded differently
vectors c) Program is not encoded as it is part of
a = 0010 1001 for set A ISA
b = 1110 0001 for set B d) None of above
would be
9. In unsigned addition, the type of overflow
a) A = {0,3,5}, B={0,5,6,7}
b) A = {1,2,4}, B={2,3,6,7} occurs when
c) A = {2,6,7}, B={3,4,6,7} a) Negative overflow
d) None of above b) Positive overflow
c) Both a and b
5. Assume x = 1001 1111, the expression x d) Carry goes out of MSB
<< 4 (arithmetic) would yield
a) 1111 1001 10. MOV (%eax),%ebp is an example of
b) 0000 1001 a) Immediate addressing mode
c) 1001 0000 b) Register Addressing Mode
d) 1001 1111 c) Memory Addressing Mode
d) None of the above

1
Question No. 2: (05 Marks)
a) Given following hex numbers write down their binary equivalent and decimal (both in
signed and unsigned). (1)
i. 0xAB903091
ii. 0XFFFFFFFF
iii. 0x00890090
iv. 0XE80989BA

b) Assume two number 0x00FF11CD in register %eax, 0XFFABCD01 in %ebx, use bitwise ^ to
complement both LSB and MSB, use bitwise & clear this whole number with appropriate
bit MASKING, write assembly code for this as well. (2)

c) What happens to a 32-bit register if we shift it arithmetic right for 31 times, explain your
answer in detail (2)

Question No. 3: (05 Marks)


a) Explain all the addressing modes in detail with examples in assembly code (1.5)

b) Explain all variants of mov instruction in detail(1.5)

2
c) Represent the following float number into IEEE 754 standard (2)
i. float k = 99.5
ii. float r = 80.1
iii. double m = 7.9
iv. double h = 5.1

Question No. 4: (05 Marks) Explain the working of following C code and equivalent Assembly
Code, draw diagram of stack to show its initial stage
C Code Equivalent Assembly Code

long simple(long *xp, long y,


long *ptr)

{ movl 4(%esp), %edx

long t = *xp + y; movl (%edx), %eax

*xp = t; addl 8(%esp), %eax

*ptr = *xp; movl %eax, (%edx)

char c = 'a'; movl 12(%esp), %edx

return c; movl %eax, (%edx)

} movl $97, %eax

ret

3
4

You might also like