Fill in the Blanks and Short Answer

advertisement
SUFFOLK COUNTY COMMUNITY COLLEGE
MATHEMATICS AND COMPUTER SCIENCE DEPARTMENT
CST121 – Computer Organization & Assembly Language Programming
2013 Spring
Section 151 – CRN 27701
MidTerm Exam #1
Print Your Name:______________________________________________
Fill in the Blanks and Short Answer
1.
Translate the following decimal numbers to binary:
73
2.
Translate the following decimal numbers to hexadecimal:
258
3.
Add the following binary integers: 00101101 and 00111011
4.
Form the 8-bit two's complement of each binary integer:
11111000
5.
Translate the following signed decimal numbers to binary:
35
Multiple-Choice
6.
A program that combines object files into an executable program is called a _________.
a. compiler
b. loader
c. linker
d. assembler
7.
If virtual machine V2 is radically different that virtual machine V1, what major problem results
when we try to run V2 programs on machine V1?
a. translation is too difficult
b. machine V2 cannot run V1 programs
c. V1 would have to be written in microcode
d. V2 would have to be implemented by software
8.
What is the value of the booloean expression X  (Y  Z), when X=true, Y=false, and Z=false?
a. true
1
b. false
9.
Is the expression X  (Y  Z) equivalent to (X  Y)  (X  Z) for all possible inputs of X, Y, and
Z?
a. yes
b. no
10. The following C++ expression cannot be written in assembly language code.
X = (Y + 4) * 3;
a. true
b. false
11. Three hexadecimal digits can be used to represent 12 binary bits.
a. true
b. false
12. The most significant bit in a binary byte is numbered bit 8.
a. true
b. false
13. A signed integer stores the sign in the least significant bit (LSB).
a. true
b. false
14. If an integer's sign bit is 1, the integer is positive.
a. true
b. false
15. The ASCII codes for alphabetic letters are smaller than for decimal digits.
a. true
b. false
16. The expression X Y is true only when X and Y are both true.
a. true
b. false
17. The expression X Y is only true when X and Y are both true.
a. true
b. false
18. The expression (X Y) is true when X and Y are both false.
a. true
b. false
19. The three most basic operators in Boolean algebra are AND, OR, and NOT.
a. true
2
b. false
20. The integer range of standard ASCII codes is:
a. 128 to +127
b. 0 to 127
c. 0 to 270
d. 0 to 65,535
21. How many bits are used by Unicode characters in MS-Windows?
a. 7
b. 8
c. 16
d. 24
22. Which type of program must usually run on multiple platforms?
a. device driver
b. business application
c. embedded system
d. assembler
23. Which of the following best describes the relationship between assembly language and machine
language?
a. one to many
b. one to one
c. many to one
d. many to many
24. A program is considered portable if it . . .
a. can be rewritten in a different programming language without losing its meaning.
b. can be quickly copied from conventional RAM into high-speed RAM.
c. can be executed on multiple platforms.
d. none of the above
25. Device drivers nearly always contain some code written in
a. machine language
b. assembly language
c. Java
d. an application-oriented language
26. What is the largest unsigned integer that may be stored in 24 bits?
a. 32,767
b. 65,536
c. 1,048,575
3
d. 1,048,576
27. What is the largest signed integer that may be stored in 32 bits?
a. 232  1
b. 232
c. 231  1
d. 231
28. Which of the following binary values is equivalent to hexadecimal 4A2B?
a. 0100 1010 0010 1101
b. 0100 1010 0010 1011
c. 0100 1010 0010 1011
d. 0110 1011 0010 1001
29. Which of the following binary values is equivalent to hexadecimal 7CBE?
a. 0111 1101 1011 1110
b. 0111 1011 1011 1100
c. 0111 1100 1100 1110
d. 0111 1100 1011 1110
30. Which of the following is the binary translation of signed decimal 33 ?
a. 11011111
b. 10101011
c. 11001100
d. 11100011
31. Express -28 in two’s complement with 8 bit quantities. Show your
work in 8 bit binary and in two’s complement format.
32. Conversion from Two’s Complement
Show your work in 32 bit binary and in two’s complement format.
33. Conversion to Two’s ComplementShow your work in 8 bit binary and in
two’s complement format.
4
34. Arithmetic with Tw’s Complement
Add two decimal numbers 69 and 12 together. Show your work in 8 bit binary
format.
5
35. Arithmetic with Tw’s Complement
Subtract 12 from 69. Now, 69 - 12 = 69 + (-12). Show your work in 8 bit binary and in
two’s complement format.
36. Arithmetic with Tw’s Complement
Subtract 69 from 12. 12 - 69 = 12 + (- 69). Show your work in 8 bit binary and in two’s
complement format.
6
Boolean Truth Table (Question 7 to 10)
The truth tables for the basic operations are:
And
A
0
0
1
1
B
0
1
0
1
Or
AB
0
0
0
1
A
0
0
1
1
B
0
1
0
1
Not
A+B
0
1
1
1
A
0
1
~A
1
0
37. Draw a truth table for A+BC.
A
B
C
BC
A+BC
0
0
0
0
0
1
0
1
0
0
1
1
1
0
0
1
0
1
1
1
0
1
1
1
38. Draw a truth table for A(B+D).
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
D
0
1
0
1
0
1
0
1
B+D
A(B+D)
7
39. Draw a truth table for (A+B)(A+C).
A
0
B
0
C
0
A+B
0
0
0
1
0
0
0
1
1
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
1
A+C
(A+B)(A+C)
40. Draw a truth table for (P~T)(P+Z).
P
0
T
0
Z
0
0
0
1
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
1
1
1
~T
P~T
P+Z
(P~T)(P+Z)
8
Download