0% found this document useful (0 votes)
40 views4 pages

17030132040407 2020計概期中

The document contains a midterm exam for an introduction to computer science course. The exam consists of 15 multiple choice and short answer questions testing knowledge of concepts like booting processes, processes, deadlocks, virtual memory, floating point representation, and machine language instructions.

Uploaded by

蔡彤旻
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views4 pages

17030132040407 2020計概期中

The document contains a midterm exam for an introduction to computer science course. The exam consists of 15 multiple choice and short answer questions testing knowledge of concepts like booting processes, processes, deadlocks, virtual memory, floating point representation, and machine language instructions.

Uploaded by

蔡彤旻
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction to Computer Science

Midterm Exam
Student ID: Name: 1 •e

1. (6%) Describe the booting process.

47(5%) What is a process

3. (6%) Explain the concept of a deadlock and the concept of starvation in


coordination

4. Suppose an operating system executes 100 processes in a second, and the time
for a context switch is negligible. Note that one millisecond is 1/1000 seconds.
(4%) If each of those processes uses one time slice, how long is a time slice in
a
terms of
b
(4%) If each of 1/4 of those processes uses two time slices and each of the 13
processes uses only one time slice, how long is a time slice a in terms of
,1
z 101to
x
2~0 4
11
1 L
+ Y288
(3%) Suppose a computer contained 1024 MB of main memory, and operating
needed to a create a virtual memory of twice that size using pages
syste
How many pages would be required? (1MB=1024KB) [-
(3%) Suppose a multiprogramming operating system is allotting time slices of 50f x 2
b.
milliseconds. If it normally takes 9 milliseconds to position a disk's read/
head over the desired track and another 16 milliseconds for the desired data to
rotate around to the read/write head, what percentage of a program's time slice
be spent waiting for a read/write operation from a disk to take place (not
the time required to actually transfer the

(3%) If the machine is capable of executing 10 instructions each nanosecond,


C
many can be executed during this

6. (4%) When using two's complement notation in 8 bits, what bits pattern represents

lollol|
negation

7. (4%) In a two": complement system, what decimal number is represented by the


1111111141111100
10
D
rI
VT 6 0

2621Y 4
JEN eel
(c
I|De

8.
a. (3%) What is the largest positive integer that can be represented in a
complement system in which each value is represented by
0
b. (3%) What is the smallest negative integer that can be in a two's
complement system in which each value is represented by

9. Consider a floating-point system in which each value is encoded by a byte whose


significant bit is the sign bit, the next three bits represent the exponent field in

notation, and the last four bits represent


(4%) What value is represented by the bit pattern 01 011 100 in the floating-point
a.
T
system
1 +4 x2
b. (4%) What is the largest value that can be represented in the floating-

07
D
c. (4%) Can we represent the value 21/8 using the floating-point system?
why

10. (4%) Determine the output S and output C of the following circuit, assuming that
upper input A is and the lower input B is 1.

A S
- B
A x)11
20 colileol
11. (3%) Which of the following data storage systems provides the most efficient
access to individual data items?
A. Main memory B. Hard disk C. CDs/DVDs D. Magnetic

12. (8%) Encode each of the following commands in terms of the machine
described in the language description table.
a. ROTATE register 0xC four bits to the right.
ALo
b. ADD the contents of registers 0x4 and 0x6 as thought they were values in two's
complement notation and leave the result in
•X OF 46
5
C OR the contents of registers 0x5 and 0x6, leaving the result in
0x745
.
d. AND the contents of register 0xB and 0x6 leaving the result in register 0x1.

8 0x816

2
(Y ).
Lenn
13. per
bob. is the maximum rate at which the data is
(2%) What measure

(2%) Explain the concept of direct memory access


b.

14. (6%) The following table shows a portion of a machine's memory containing a
program described in the Appendix. Answer the questions
written in the language
assuming that the machine is started with its program counter

address content (21


Ye]
0x0 0x14
0x0 0x04
0x02 0×B •Y 7
0x0 0x0 vole
0x0 0x2
0x0 0x0 Beleepbo/
0x06 0xA4
0x0 0x0
0x0 0xC )°0 44
0x0 0x0
What bit pattern will be in register 0x4 when the
a
What bit pattern will be in the program counter when the
b

table shows a portion of a machine's memory


15. (15%) The in Appendix. Answer the questions below
program written in the language
assuming that the machine is started with program counter

address content address


D
0x0 0x2 0x07 0x3
0x0 0x1 0x08 0x5
0x0 0×2 0x09 0x3 3

0x0 0x0 0x0 0×B


0x0 0x25 0x0B 0x0
0x0 0 xCO
0x0 OxF
0x0 0×74 0x0D 0x00

a.
What bit pattern will be in register 0x3 when the 006 | 00-0
b
What bit pattern will be in register 0x4 when the Do 8 ollI
How many times is the code stored at memory locations 0x06 and 0x07 3
when the machine halts?

3
Appendix

Op-code Descriptio

0x1 RXY LOAD the register R with the bit pattern found in the memory cell whose address
Example: 0x14A3 would cause the contents of the memory cell at located at address 0xA3 to
in register
0x2 LOAD the register R with the bit
Example: 0x20A3 would cause the value 0xA3 to be in placed in

0x3 STORE the bit pattern found in register R in the memory cell whose address
Example: 0x35B1 would cause the contents of register 0x5 to be placed in the memory
address
0x4 MOVE the bit pattern found in register R to
Example: 0x40A4 would cause the contents of register 0xA to be copied into
0x5 RST ADD the bit patterns in registers S and T as though they were two's complement
and leave the result in
Example: 0x5726 would cause the binary values in registers 0x2 and 0x6 to be added and the
in register
0x RST ADD the bit patterns in registers S and T as though they represented values in
notation and leave the floating-point result in
Example: 0x634E would cause the values in registers 0x4 and O OxE to be added as floating-
and the result to be placed in
0x7 OR the bit patterns in registers S and T and place the result in
Example: 0x7CB4 would cause the result of ORing the contents of registers 0xB and 0x4 to be
register
0x8 RST AND the bit patterns in register S and place the result in
Example: 0x8045 would cause the result of ANDing the contents of registers 0x4 and 0x5 to be
register
0x9 RST EXCLUSIVE OR the bit patterns in registers S and T and place the result in
Example: 0x95F3 would cause the result of EXCLUSIVE ORing the contents of registers 0xF and
be placed in
0xA ROTATE the bit pattern in register R one bit to the right X times. Each time place the
started at the low-order end at the high-
Example: 0xA403 would cause the contents of register 0x4 to be rotated 3 bits to the right in
fashion

0xB JUMP to the instruction located in the memory cell at address XY if the bit pattern in
is equal to the bit pattern in register number 0. Otherwise, continue with the normal
execution. (The jump is implemented by copying XY into the program counter during the
phase.
Example: 0xB43C would first compare the contents of register 0x4 with the contents of
the two were equal, the pattern 0x3C would be placed in the program counter so
instruction executed would be the one located at that memory address. Otherwise,
be done and program execution would continue in its
0xC 000 HALT execution.
Example: 0xC000 would cause program execution

You might also like