Você está na página 1de 7

CS 40A FINAL

HOWARD DACHSLAGER

ASSUME NO SYNTAX ERRORS AND THE LOGIC IS CORRECT. NONE OF THE


PROGRAMS ARE COMPLETE.
Unless otherwise indicated, all numbers are assume unsigned (natural ).
NAME __

STUDENT #

1. For the finite ring R2 = {00000000, 00000001, ...,


} find:
1101011110101010 = N2 =_00101101__
2.

Compute (2354327* 25517 )mod(3117) = N7 = _15_____

For the finite BYTE of octal numbers R8 = {0, 1, 2,3,4,5,6,7, 10, 11, ...,, N }
,

answer question 3, and 4:


3. N = _377_____
4. The number in the BYTE R8 : N8 = (78)5 M0D(4008) = __67_____
5. For the dword :
2B

07

FC

FF

The additive inverse in hexadecimal is


15

39

04

01

6. Assume in an AL program:
x

DWORD

0011

0101

1110

1010

The additive inverse of x is

1000

1101

0110

1101

1101

1011

0010

0110

1000

0011

1010

0011

7. Complete the following tables using hexidecimal numbers only :


32

25 24

17 16

9 8

INSTRUCTIONS
mov eax, 3F293567h

mov ax, 9BCh

mov ax, 3D32h

mov ax, 5h

mov ax, 3h

mov eax, 1267h

8.
Let R = {0,1,2,3,..., 255}be decimal byte ring. For this ring find the following value of
N = 100 + (- 235*59 + 222)*133 = _24________
9.
Complete the following table (Make sure all celled are filled):
mov eax , 278901d
EAX
BASE
16:

BASE 2: 0 0 0 0

0000

0000

0100

0100

0001

0111

0101

BASE 8: 0

10. Complete the following table using binary numbers only. (Make sure all celled are filled):

32

25 24

17 16

9 8

INSTRUCTIONS
mov eax, 112937234d 0000

0110

1011

1011

0100

1001

0001

0010

mov ax, 9BCh

0000

0110

1011

1011

0100

1001

1011

1100

mov al, 5

0000

0110

1011

1011

0100

1001

0000

0101

mov ah, 0Eh

0000

0110

1011

1011

0000

1110

0000

0101

mov al, 2d

0000

0110

1011

1011

0000

1110

0000

0010

11.
Complete the following table with HEXADECIMAL NUMBERS ONLY:
AL PSEUDO CODE

AL CODE

X := 23o

mov x, 23o

13

Y := 57o

mov y, 57o

13

EAX := X

mov eax, x

13

EBX := Y

mov ebx, y

X := EBX
Y := EAX

EAX

EBX

2F

13

13

2F

13

2F

mov x, ebx

2F

2F

13

2F

mov y, eax

2F

13

13

2F

2F

For problems 12, 13 complete the following tables using hexadecimal numbers only :
Make sure all cells are filled.
12.
BASE 16

32

24
25

16

17

INSTRUCTIONS
mov eax, 293567h

mov ax, 9BCh

mov ax, 3D32h

mov ax, 5h

mov ax, 3h

mov eax, 1267

32

13.

0
1

25 24

17 16

9 8

INSTRUCTIONS
mov eax, 112937234d

mov ax, 9BCh

mov al, 5

mov ah, 0Eh

mov al, 2

14. The largest signed integer number, base 8, that can be store in a variable of type BYTE is
____127__________

The smallest signed integer number, base 8, that can be store in a variable of type BYTE is
___-127____

15. Assume the decimal byte ring {0, 1, 2, ..., 255} is considered signed numbers.
Then the relation 210 < 4 is (a). true (b) false

____false_______

16. K := 0
R := 2259
WHILE R > 0
BEGIN
K := K +1
R :=2258 - K*100
END
R := R + 55
For the above program, the final value stored in R is __-7________

17.
For the instruction: mov ecx , 725715041d complete the following table below:
ECX

BASE 2:

1010

1101

0000

0110

0010

0001

1000

0001

BASE 16:

BASE 9:

18. Complete the following table USING HEXADECIMAL NUMBERS ONLY :


AL PSEUDO CODE

AL CODE

EAX

X := 29d

mov x, 29

1D

EBX
-

Y := 59d

mov y, 59

1D

3B

EAX := X

mov eax, x

1D

3B

1D

EBX := Y

mov ebx, y

1D

3B

1D

3B

X := EBX

mov x, ebx

3B

3B

1D

3B

Y := EAX

mov y, eax

3B

1D

1D

3B

19. Complete the following table using BINARY NUMBERS ONLY (Make sure all cells
that have numbers are filled)
32

25 24

17 16

9 8

INSTRUCTIONS
mov eax, 293567h

0000

0000

0010

1001

0011

0101

mov ax, 9BCh

0000

0000

0010

1001

0000

1001

1011

1100

mov ax, 3D32h

0000

0000

0010

1001

0011

1101

0011

0010

mov ax, 5h

0000

0000

0010

1001

0000

0000

0000

0101

mov ax, 3h

0000

0000

0010

1001

0000

0000

0000

0011

mov eax, 1267

0000

0000

0000

0000

0001

0010

0110

0111

0110

0111

20. Complete the following table in DECIMAL NUMBERS ONLY. (Make sure all cells that
have numbers are filled)

INSTRUCTIONS

CYCLE OF INSTRUCTIONS

N10

N7

N10 := 489

N10 := 489

1E9

K:=1

K:=1

1E9

N7 := 0

N7 := 0

1E9

WHILE N10 <> 0

WHILE N10 <> 0

BEGIN

BEGIN

A := N10 MOD 7

A := N10 MOD 7

1E9

N7 := N7 + A*K

N7 := N7 + A*K

1E9

N10 := N107

N10 := N107

45

K := 10*K

K := 10*K

45

10

A := N10 MOD 7

45

10

N7 := N7 + A*K

45

42

10

N10 := N107

42

10

K := 10*K

42

64

A := N10 MOD 7

42

64

N7 := N7 + A*K

10A

64

N10 := N107

10A

64

K := 10*K

10A

3E8

A := N10 MOD 7

10A

3E8

N7 := N7 + A*K

4F2

3E8

N10 := N107

4F2

3E8

K := 10*K

4F2

END

END

2710

Você também pode gostar