You are on page 1of 14

Note! Answer sheet!

Computers and Software Engineering A, 15 credits, DV006A


Midterm Re-examination
Time: Friday, Februrary 29, 2008
Place: 96:243
Duration: 3 hours

Exam aids: This is a closed-book exam. The only student materials allowed are pencils,
erasers and an English-Chinese dictionary.

General Instructions: Write your answers on separate sheets of paper and do not write your
answers on the pages of the exam. Start each section of the exam on a new sheet of paper.
Write on only one side of each answer sheet and put your name at the top of each answer
sheet. If the question is unclear to you, explain the ambiguity and your interpretation of the
question in your answer. Try to answer all of the exam questions and use illustrations in order
to get partial credit for the question. However, if the question asks for exactly two responses,
do not answer with three or more alternative answers.
Note that some of the questions related to Chapter 2 (Data Manipulation) refer to
Appendix 1: language description table on the last page of this exam.

Scoring: There are a total of 75 questions and a maximum of 100 points in this exam. At least
50% of the maximum number of points must be scored in order to get a passing grade. The
ECTS scale will be used on all passing grades (i.e., grades of A, B, C, D and E will be given).
The questions are not listed in order of difficulty.

GOOD LUCK!

Section 1. Questions with Multiple Choice Answers (There are 25 questions


in this section each worth 1 point apiece.)
Answer these questions with only one letter!

Chapter One (Data Storage)

1.1 How many bytes are there in a Unicode character?

A. 8 B. 12 C. 16 D. 2

ANSWER: D

1.2 What is the result of the binary operation 11110000 XOR 00000000 ?

A. 11110000 B. 10100101 C. 00000000 D. 11110101

ANSWER: A

1.3 Which of the following bit patterns represents the decimal integer value 15?

A. 00011010 B. 00001111 C. 00010110 D. 00011111


ANSWER: B

1.4 What is the base ten value of the binary fraction 101.110 ?

A. 5.101 B. 5.625 C. 5.75 D. 45

ANSWER: C

1.5 Which of the following Boolean operations produces the output 0 for the fewest number of
input patterns?

A. AND B. OR C. XOR

ANSWER: B

Chapter Two (Data Manipulation)

1.6 Which of the following instructions falls into the category of data transfer instructions?

A. STORE B. JUMP C. ROTATE D. AND

ANSWER: A

1.7 Which of the following instructions (as described in the Appendix 1: language description
table) changes the contents of a memory cell?

A. 10AB B. 30AB C. 20AB D. 40AB

ANSWER: B

1.8 Which of the following instructions (as described in the Appendix 1: language description
table) places 00000000 in register A?

A. 1A00 B. 2A00 C. 3A00 D. 200A

ANSWER: B

1.9 Which of the following instructions (as described in the Appendix 1: language description
table) changes the contents of register 7?

A. 4077 B. 4075 C. 4057 D. 37BB

ANSWER: C
1.10When a STORE operation is performed, what information besides the data to be stored
must be sent over the bus to main memory by the CPU?

A. the program counter contents B. the instruction register contents


C. the contents of register 0 D. an address

ANSWER: D
Chapter Three (Operating Systems)

1.11The end of a time slice is indicted by the occurrence of a signal called

A. An interrupt B. A semaphore C. A login

ANSWER: A

1.12Which of the following components of an operating system maintains the directory


system?

A. Memory manager B. Device drivers C. File manager

ANSWER: C

1.13Which of the following components of an operating system is critical for multitasking so


that one task cannot address and change the intructions in another task?

A. Memory manager B. File manager C. Device drivers

ANSWER: A

1.14Which of the following is an attempt to provide security?

A. Deadlock B. Privilege levels C. Multitasking

ANSWER: B

1.15Which of the following items of information would not be contained in an operating


system’s process table?

A. The location of the memory area assigned to the process


B. The machine language instructions being executed by the process
C. The priority of each process
D. Whether the process is ready or waiting

ANSWER: B

Chapter Four (Networks and the Internet)

1.16What is an alternative model to the client/server model used for interprocess


communication?

A. gateway B. peer-to-peer C. proxy


ANSWER: B

1.17Whichof the following is a mechanism that limits the number of times that a packet is
forwarded as it is routed through the Internet?

A. Protocol B. Port number C. Domain D. Hop count

ANSWER: D

1.18Which layer of the TCP/IP hierarchy directs message segments through the Internet so that
they get closer and closer to their destination?

A. Application B. Transport C. Network D. Link

ANSWER: C

1.19Which of the following is not a means of connecting networks?

A. Switch B. Server C. Router D. Bridge

ANSWER: B

1.20Which layer of the TCP/IP hierarchy reassembles messages as their pieces arrive at the
destination?

A. Transport B. Link C. Network D. Application

ANSWER: A

Chapter Five (Algorithms)

1.21Which of the following is an activity?

A. Algorithm B. Process C. Program D. Psuedocode

ANSWER: B

1.22Which of the following set of instructions defines an algorithm in the formal, strict sense?

A. X ← 3; B. X ← 3; C. X ← 3;
while (X < 5)do while (X < 5) do while (X < 5) do
(X ← X) (X ← X + 1) (X ← X - 1)

ANSWER: B

1.23Which of the following is a conditional statement in Java?


A. do-while B. while C. if-else D. for

ANSWER: C

1.24When searching within the list

Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger

which of the following entries will take the least time to find using the sequential search
algorithm?

A. Maurice B. Nathan C. Oliver

ANSWER: A

1.25When searching within the list

Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger

which of the following entries will take the least time to find using the binary search algorithm?

A. Maurice B. Nathan C. Oliver

ANSWER: C
Section 2. Fill-in-the-blank/Short-answer Questions (There are 25 questions
in this section each worth 2 points apiece.)
Answer these questions with words, numbers and/or sentences.
Chapter One (Data Storage)

2.1 How many bits would be in the memory of a computer with 4 Kilobytes of main memory?

ANSWER: 8 X 4 X (1024) = 32,768 bits.

2.2 What is the largest numeric value that could be represented with three bytes if each digit
were encoded using one ASCII pattern per byte? What if binary notation were used? (Just
give an expression for the numeric value; you do not need to calculate the actual value.)

ANSWER: With ASCII, the largest numeric value is 999. With binary notation, the largest
value is 2**24 = 16,777,215.

2.3 Represent the bit pattern 1110100001001011 in hexadecimal notation.

ANSWER: E84B

2.4 A7DF is the hexadecimal representation for what bit pattern?

ANSWER: 1010 0111 1101 1111

2.5 How many different bit patterns can be formed if each must consist of exactly 8 bits?

ANSWER: 256 (2**8)

Chapter Two (Data Manipulation)

2.6 Can AND-operations be performed directly on memory cells? Explain your answer!

ANSWER: No. The only operations that can be performed on memory cells are LOAD (from
memory cell to register) and STORE (from register to memory cell). Data must reside in a
register before it can be manipulated by a binary operation such as AND.

2.7 Encode each of the following commands in terms of the machine language described in
Appendix 1: language description table.

A. ADD the contents of registers 5 and 6 as thought they were values in two’s
complement notation and leave the result in register 4.

B. LOAD register 7 with the contents of the memory cell at address A5.

C. LOAD register 7 with the value A5.

D. OR the contents of registers 5 and 6, leaving the result in register 4.

ANSWER: A. 5456 (or 5465) B. 17A5 C. 27A5 D. 7456 (or 7465)


2.8 If register 0 contains the pattern 01101001 before executing the instruction A503 (see the
language description table), what bit pattern will be in register 0 after the instruction is
executed?

ANSWER: register 0 will still contain the bit pattern 01101001 since the instruction A503
rotates the data in register 5.

2.9 Using the machine language described in the language description table, write a sequence
of instructions that will place the pattern FF in the memory cell at address A0.

ANSWER: 2XFF, 3XA0 (where X can be any register but must be the same in both
instructions)

2.10What are the three operations performed during each machine cycle?

ANSWER: Fetch, decode, execute

Chapter Three (Operating Systems)

2.11 Explain the relationship between BIOS (Basic Input/Output System) and the bootstrap
program.

ANSWER: The bootstrap program uses BIOS to communicate via the keyboard and CRT with
the user and with the hard disk. Both BIOS and the bootstrap program are stored in ROM.

2.12What is the difference between a process that is waiting as opposed to a process that is
ready?

ANSWER: A process that is waiting would not be able to advance if given a time slice
(perhaps because it is waiting for a peripheral device to complete a task) whereas a process
that is ready would be able to continue execution if given a time slice.

2.13Suppose an operating system allocates time slices in 5 millisecond units and the time
required for a context switch is negligible.

A. How many processes can obtain a time slice in one second?

B. How many processes can obtain a time slice in one second if they all use only half
of their slice?

ANSWER: A. 200 B. 400

2.14What is the difference between time-sharing and multitasking?

ANSWER: Multitasking means that a number of tasks are run at the same time. Time-sharing
allows tasks to share a single CPU by giving each task a time-slice.

2.15Explain the difference between application software and system software.


ANSWER: System software provides the infrastructure required by the application software. It
includes the operating system and utilities. Application software provides the unique
functionality required to perform the particular tasks for with the computer is used. Examples
include word processors, spreadsheet systems, database systems, and image processing
systems.

Chapter Four (Networks and the Internet)

2.16What are two basic differences between the transport level protocols named UDP and
TCP?

ANSWER: 1. TCP establishes a logical connection between initiating computer and


responding computer while UDP just sends a message with no initial contact. 2. The origin and
destination computers use acknowledgements and retransmissions to insure that all sent
segments are received in full. UDP does no such checking.

2.17What is the main purpose of a DNS name server?

ANSWER: The main purpose of a name server is to translate a domain name into an
IP-address.

2.18Many people use the terms Internet and world-wide web interchangeably. What is the
difference between the Internet and the world-wide web?

ANSWER: The Internet is the infrastructure used by the world-wide web. That is, the world-
wide web is only one application of the Internet. Other applications include email, ftp, and
telnet.

2.19Write the entire URL required by a webb browser to retrieve the Web document named
bulldogs.html from the Web server at animals.org assuming that the document is stored in
the directory named dogs.

ANSWER: http://animals.org/dogs/bulldogs.html

2.20What is the difference between HTML and HTTP?

ANSWER: HTTP (HyperText Transfer Protocol) is a protocol used mainly to transfer files
containing HTML-coded (HyperText Markup Language). HTML-tags are inserted into the
text file to tell the web-browser how to display the text.

Chapter Five (Algorithms)

2.21What sequence of values will be printed when the following instructions are executed?

X ← 7;
while (X < 7) do
(print the value of X;
X ← X + 1)
print the value of X;
while (X > 2) do
(print the value of X;
X ← X - 2)

ANSWER: 7, 7, 5, 3

2.22Identify a flaw in the control of the following loop.

X ← 9
while (X > 8) do
(X ← X + 2)

ANSWER: X will never be smaller than 8 and the loop will never termination.

2.23Suppose the binary search algorithm was being used to search for the entry Feng in the list

Cheng, Fu, Hu, Li, Pan, Wang, Zheng

What would be the first entry in the list to be considered? What would be the second entry in
the list to be considered?

ANSWER: A. Li B. Fu

2.24What would be printed if the following instructions were executed?

X ← 5;
print the value of X;
Y ← 3;
if (X < Y) then (print the value 6)
else (print the value of X)

ANSWER: 5, 5

2.25Do the following instructions define an algorithm? Explain your answer!

Write down one hundred positive odd integers.


Select the last integer in the list.
Print the even integer that is one less than the selected odd integer.

ANSWER: Yes, the instructions are unambiguous and executable.


Section 3. Vocabulary (Matching) Questions (There are 25 questions in this
section each worth 1 point apiece.)
Answer these questions with the one letter of the word in the list that best
matches the description.
Chapter One (Data Storage)

3.1 AND, OR, XOR, NOT.


3.2 A segment of a track in a mass storage system.
3.3 A digital circuit capable of holding a single digit.
3.4 A storage area used to hold data on a temporary basis, often as a step in transfering the
data from one device to another.
3.5 The process of initially marking tracks and sectors on a magnetic hard disk.

A. bit B. buffer C. pixel


D. boolean operations E. ISO F. formating
G. address H. ANSI I. JPEG
J. hexadecimal notation K. ASCII L. Unicode
M. sector N. flip-flop O. MIDI
P. key field

ANSWER: 3.1: D, 3.2: M, 3.3: N, 3.4: B, 3.5: F

Chapter Two (Data Manipulation)

3.6 The part of a machine instruction that is not the op-code.


3.7 An apparatus (usually on a printed circuit board) that handles communication between a
computer and other devices.
3.8 Used by the CPU to keep its place in the program being executed.
3.9 A means of isolating particular bits within the CPU.
3.10 Used to synchronize the operations within a computer.

A. op-code B. pipeling C. clock


D. machine language E. stored-program concept F. status word
G. machine cycle H. program counter I. bps
J. register K. controller L. CISC
M. masking N. modem O. handshaking
P. bus Q. port R. bandwidth
S. memory-mapped I/O T. USB U. operand

ANSWER: 3.6: U, 3.7: K, 3.8: H, 3.9: M, 3.10: C


Chapter Three (Operating Systems)

3.11 Can be used to execute a program that is too large to fit into main memory.
3.12 The act of performing more than one activity at the same time.
3.13 The heart of an operating system.
3.14 A signal that suspends the CPU’s current activities.
3.15 A means of restricting the capabilities of different processes.

A. shell B. bootstrap C. multitasking


D. time sharing E. directory path F. interactive processing
G. process H. kernel I. deadlock
J. queue K. interrupt L. GUI
M. virtual memory N. auditing software O. mutual exclusion
P. ROM Q. privilege levels

ANSWER: 3.11: M, 3.12: L, 3.13: H, 3.14: K, 3.15: Q

Chapter Four (Networks and the Internet)

3.16A container for information that is routed through the Internet.


3.17 A means of connecting networks to form an internet.
3.18 Identifies a machine on the Internet.
3.19 A means of blocking undesired messages.
3.20 A governing set of rules.

A. internet B. dotted decimal C. ISP


D. domain E. URL F. firewall
G. protocol H. search engine I. packet
J. cloud K. Ethernet L. XML
M. IP address N. UDP O. FTP
P. HTML Q. IP R. router

ANSWER: 3.16: I, 3.17: R, 3.18: M, 3.19: F, 3.20: G

Chapter Five (Algorithms)

3.21 An informal notation for representing algorithms.


3.22 A basic building block.
3.23 A means of saving the result of a computation for future use.
3.24 A way for the instructions in a task to be repeated as a subtask of itself.
3.25 The fundamental concept in computer science.

A. algorithm B. stepwise refinement C. pretest loop


D. pseudocode E. loop invariant F. proof of correctness
G. assignment statement H. procedure I. sequential search
J. if-then-else statement K. recursion L. primitive

ANSWER: 3.21: D, 3.22: L, 3.23: G, 3.24: K, 3.25: A


Appendix 1: language description table
Op-
code Operand Description
1 RXY LOAD the register R with the bit pattern found in the memory cell whose address is
XY. Example: 14A3 would cause the contents of the memory cell located at
address A3 to be placed
in register 4.
2 RXY LOAD the register R with the bit pattern XY.
Example: 20A3 would cause the value A3 to be placed in register 0.
3 RXY STORE the bit pattern found in register R in the memory cell whose address is XY.
Example: 35B1 would cause the contents of register 5 to be placed in the memory
cell whose
address is B1.
4 0RS MOVE the bit pattern found in register R to register S.
Example: 40A4 would cause the contents of register A to be copied into register 4.
5 RST ADD the bit patterns in registers S and T as though they were two’s complement
representations
and leave the result in register R.
Example: 5726 would cause the binary values in registers 2 and 6 to be added and
the sum placed
in register 7.
6 RST ADD the bit patterns in registers S and T as though they represented values in
floating-point
notation and leave the floating-point result in register R.
Example: 634E would cause the values in registers 4 and E to be added as floating-
point values
and the result to be placed in register 3.
7 RST OR the bit patterns in registers S and T and place the result in register R.
Example: 7CB4 would cause the result of ORing the contents of registers B and 4
to be placed in
register C.
8 RST AND the bit patterns in register S and T and place the result in register R.
Example: 8045 would cause the result of ANDing the contents of registers 4 and 5
to be placed in
register 0.
9 RST EXCLUSIVE OR the bit patterns in registers S and T and place the result in register
R.
Example: 95F3 would cause the result of EXCLUSIVE ORing the contents of
registers F and 3 to
be placed in register 5.
A R0X ROTATE the bit pattern in register R one bit to the right X times. Each time place
the bit that
started at the low-order end at the high-order end.
Example: A403 would cause the contents of register 4 to be rotated 3 bits to the
right in a circular
fashion.
B RXY JUMP to the instruction located in the memory cell at address XY if the bit pattern
in register R
is equal to the bit pattern in register number 0. Otherwise, continue with the
normal sequence of
execution. (The jump is implemented by copying XY into the program counter
during the execute
phase.)
Example: B43C would first compare the contents of register 4 with the contents of
register 0. If
the two were equal, the pattern 3C would be placed in the program counter so that
the next
instruction executed would be the one located at that memory address. Otherwise,
nothing would
be done and program execution would continue in its normal sequence.
C 000 HALT execution.
Example: C000 would cause program execution to stop.