You are on page 1of 14

Note! Answer sheet!

Computers and Software Engineering A, 15 credits, DV006A
Midterm Exam
Time: Wednesday, January 16, 2008
Place: 51:525A
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 Representation)

1.1 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

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

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

ANSWER: C

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

10Which of the following instructions falls into the category of data transfer instructions? A. 37BB ANSWER: C 1. 2 ANSWER: D Chapter Two (Data Manipulation) 1. 00011111 ANSWER: D 1.5 How many bytes are there in a Unicode character? A. JUMP B. 1A00 B.8 Which of the following instructions (as described in the Appendix 1: language description table) places 00000000 in register A? A.9 Which of the following instructions (as described in the Appendix 1: language description table) changes the contents of register 7? A. an address C. 12 C. the instruction register contents ANSWER: B 1. 45 ANSWER: B 1. 5. A.75 D.6 When a STORE operation is performed. 16 D.625 C. what information besides the data to be stored must be sent over the bus to main memory by the CPU? A. 5. 00001111 C. 4057 D. LOAD D. 200A ANSWER: B 1. 5. 8 B. 00010110 D. 00011010 B. ROTATE C. AND ANSWER: C . 10AB B. the contents of register 0 D. 4075 C. 40AB ANSWER: B 1. the program counter contents B. 4077 B.4 What is the base ten value of the binary fraction 101. 2A00 C. 30AB C.101? A. 20AB D.7 Which of the following instructions (as described in the Appendix 1: language description table) changes the contents of a memory cell? A. 3A00 D.101 B.

12Which 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. gateway B. Memory manager ANSWER: A 1. Whether the process is ready or waiting D. An interrupt B. Passwords B. File manager C. Device drivers ANSWER: A 1. The machine language instructions being executed by the process ANSWER: D 1. Device drivers C.Chapter Three (Operating Systems) 1. A semaphore C.16What is an alternative model to the client/server model used for interprocess communication? A. File manager B. The location of the memory area assigned to the process B.14The end of a time slice is indicted by the occurrence of a signal called A.11Which of the following components of an operating system maintains the directory system? A. Multitasking ANSWER: C Chapter Four (Networks and the Internet) 1.15Which of the following is not an attempt to provide security? A. peer-to-peer ANSWER: C .13Which of the following items of information would not be contained in an operating system’s process table? A. proxy C. A login ANSWER: A 1. Memory manager B. Privilege levels C. The priority of each process C.

Application B. Domain D.19Which of the following is not a means of connecting networks? A.20Which of the following identifies the application to which a message arriving from the Internet should be given? A. do-while B. X ← 3.18Which layer of the TCP/IP hierarchy directs message segments through the Internet so that they get closer and closer to their destination? A. X ← 3.23Which of the following Java statements is guaranteed to loop at least one time? A. X ← 3. Process ANSWER: C 1. B. Transport ANSWER: D 1. Bridge ANSWER: B 1. for . Port number C. strict sense? A. Network D. Server C. Switch B. Hop count ANSWER: B Chapter Five (Algorithms) 1. Algorithm B. Protocol B. Router D. Program C.21Which of the following is an activity? A.17Which layer of the TCP/IP hierarchy reassembles messages as their pieces arrive at the destination? A. C. Application B. Link ANSWER: C 1. Transport C.1) ANSWER: B 1. while C. Network D.1.22Which of the following set of instructions defines an algorithm in the formal. Link C. while (X < 5)do while (X < 5) do while (X < 5) do (X ← X) (X ← X + 1) (X ← X .

Oliver ANSWER: B . Maurice B. Maurice B.25When searching within the list Lewis. Oliver ANSWER: C 1. Maurice. Oliver. Quincy. Roger which of the following entries will take the most time to find using the binary search algorithm? A. Nathan C. Pat. Quincy. Roger which of the following entries will take the most time to find using the sequential search algorithm? A.ANSWER: A 1. Oliver. Pat. Nathan C. Nathan.24When searching within the list Lewis. Maurice. Nathan.

8 Encode each of the following commands in terms of the machine language described in Appendix 1: language description table. However.) Answer these questions with words.777. the largest numeric value is 999.215. Fill-in-the-blank/Short-answer Questions (There are 25 questions in this section each worth 2 points apiece. you do not need to calculate the actual value. 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. How many photographs could be stored in the camera if each consisted of 1024 pixels per row and 1024 pixels per column if each pixel required three bytes of storage? ANSWER: If each pixel required one byte.4 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.2 A7DF is the hexadecimal representation for what bit pattern? ANSWER: 1010 0111 1101 1111 2. numbers and/or sentences.Section 2. Chapter One (Data Representation) 2.5 Suppose a digital camera has a storage capacity of 256MB. 2. 256MB/3MB = 85 pictures (with 1MB to spare). ANSWER: B49E 2.3 How many different bit patterns can be formed if each must consist of exactly 10 bits? ANSWER: 1024 (2**10) 2. With binary notation. Chapter Two (Data Manipulation) 2. 2. since each pixel requires 3 bytes then each picture requires 3MB of storage. a single picture would require 1024 X 1024 = 1MB.1 Represent the bit pattern 1011010010011110 in hexadecimal notation. The only operations that can be performed on memory cells are LOAD (from memory cell to register) and STORE (from register to memory cell). . 2.) ANSWER: With ASCII.7 Can AND-operations be performed directly on memory cells? Explain your answer! ANSWER: No.6 If register 0 contains the pattern 01101001 before executing the instruction A503 (see the language description table). Data must reside in a register before it can be manipulated by a binary operation such as AND. the largest value is 2**24 = 16.

In contrast. B. a ________________ is the activity of executing those instructions. 7456 (or 7465) 2. decode. C.12Suppose an operating system allocates time slices in 10 millisecond units and the time required for a context switch is negligible.13What is the difference between time-sharing and multitasking? ANSWER: Multitasking means that a number of tasks are run at the same time. process 2. How many processes can obtain a time slice in one second if half of them use only half of their slice? ANSWER: A. 100 B. write a sequence of instructions that will place the pattern FF in the memory cell at address A0. 2. OR the contents of registers 5 and 6. A. LOAD register 7 with the contents of the memory cell at address A5. ANSWER: A. 17A5 C.11 A ______________ is a set of instructions. D.9 What are the three operations performed during each machine cycle? ANSWER: Fetch. A. execute 2.14What is the difference between a process that is waiting as opposed to a process that is ready? . LOAD register 7 with the value A5. 5456 (or 5465) D.10Using the machine language described in the language description table. Time-sharing allows tasks to share a single CPU by giving each task a time-slice. ANSWER: program. ANSWER: 2XFF. 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. 27A5 B. leaving the result in register 4. 150 2. How many processes can obtain a time slice in one second? B. 3XA0 (where X can be any register but must be the same in both instructions) Chapter Three (Operating Systems) 2.

That is. 2. database systems.html 2. mail server. and telnet. What is the difference between the Internet and the world-wide web? ANSWER: The Internet is the infrastructure used by the world-wide web.16Write the entire URL required to retrieve the Web document named bulldogs.17What are two basic differences between the transport level protocols named UDP and TCP? ANSWER: 1. file server. . ftp. UDP does no such checking. Application software provides the unique functionality required to perform the particular tasks for with the computer is used. and image processing systems. Other applications include email.18Name three kinds of servers. 2. HTML-tags are inserted into the text file to tell the web-browser how to display the text.org assuming that the document is stored in the directory named dogs. Chapter Four (Networks and the Internet) 2. ANSWER: System software provides the infrastructure required by the application software.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. spreadsheet systems.15Explain the difference between application software and system software.html from the Web server at animals. ANSWER: http://animals. Examples include word processors. It includes the operating system and utilities. The origin and destination computers use acknowledgements and retransmissions to insure that all sent segments are received in full. ANSWER: Possible answers include: name server.org/dogs/bulldogs. 2.19Many people use the terms Internet and world-wide web interchangeably. TCP establishes a logical connection between initiating computer and responding computer while UDP just sends a message with no initial contact. 2. the world- wide web is only one application of the Internet. etc.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). Web server. 2.

22Suppose the binary search algorithm was being used to search for the entry Feng in the list Cheng. Print the even integer that is one less than the selected odd integer. Wang. Fu.25Identify a flaw in the control of the following loop. ANSWER: Yes. while (X < 7) do (print the value of X. while (X > 2) do (print the value of X. 4 2. 6. if (X < Y) then (print the value 6) else (print the value of X) ANSWER: 5.24Do the following instructions define an algorithm? Explain your answer. 2. Fu 2. print the value of X. 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. .21What sequence of values will be printed when the following instructions are executed? X ← 10.Chapter Five (Algorithms) 2. Li. Li B. X ← 9 while (X > 8) do (X ← X + 2) ANSWER: The loop will never termination. 5 2. X ← X + 1) print the value of X. Y ← 3. Write down one hundred positive odd integers. 8. 10.2) ANSWER: 10.23What would be printed if the following instructions were executed? X ← 5. X ← X . the instructions are executable. Pan. Select the integer in the middle of the list. Hu.

3. CISC M. often as a step in transfering the data from one device to another. status word G. 3. USB U. pipeling C. memory-mapped I/O T.5 A means of encoding music in terms of notes and instruments rather than actual audio. 3.9: H. XOR. buffer C. 3.2 A digital circuit capable of holding a single digit. program counter I. GIF G.1: M. 3.4: D.4 AND. 3.6: U. port R.3: B. modem O. boolean operations E.) Answer these questions with the one letter of the word in the list that best matches the description.5: O Chapter Two (Data Manipulation) 3.2: N. address H. hexadecimal notation K. 3.9 Used by the CPU to keep its place in the program being executed. bus Q. JPEG J. ISO F. 3.8: J. Unicode M.7: M. A. 3. ANSI I. bandwidth S.1 A segment of a track in a mass storage system. A. op-code B. Vocabulary (Matching) Questions (There are 25 questions in this section each worth 1 point apiece. stored-program concept F. ASCII L. machine cycle H. masking N. 3. bps J.10 Used to synchronize the operations within a computer. clock D.3 A storage area used to hold data on a temporary basis. controller L. OR. key field ANSWER: 3. MIDI P. Chapter One (Data Representation) 3. handshaking P.7 A means of isolating particular bits within the CPU. flip-flop O. NOT.Section 3. 3. register K. 3.10: C .6 The part of a machine instruction that is not the op-code. operand ANSWER: 3. 3. 3. 3. sector N. pixel D. machine language E. bit B. 3.8 A location within a CPU for temporary data storage.

20 A governing set of rules. protocol H. 3. 3. cloud K.19 Identifies a machine on the Internet. 3.Chapter Three (Operating Systems) 3.12 The act of performing more than one activity at the same time. 3. mutual exclusion P. 3.18 A means of connecting networks to form an internet. interactive processing G. 3. directory path F. search engine I.24: D. 3.21: L. 3. 3.22: G. if-then-else statement K. 3.19: M. stepwise refinement C.21 A basic building block. assignment statement H.14 The heart of an operating system. GUI M. router ANSWER: 3. bootstrap C. IP R. FTP P.13 A means of restricting the capabilities of different processes.17: F.12: C. 3. 3.11: P. 3. privilege levels ANSWER: 3. UDP O. interrupt L. A.25 The fundamental concept in computer science. XML M. sequential search J.11 Memory area whose contents cannot be altered. shell B. 3. 3. procedure I. internet B. dotted decimal C. A. virtual memory N. HTML Q. 3.15 A signal that suspends the CPU’s current activities.25: A .16 A network of networks.23 A means of producing different actions depending on a condition. deadlock J. 3. proof of correctness G. URL F. 3. process H.14: H.17 A means of blocking undesired messages.13: Q.24 An informal notation for representing algorithms. 3. primitive ANSWER: 3. pretest loop D.20: G Chapter Five (Algorithms) 3. A. 3.18: R.22 A means of saving the result of a computation for future use. ISP D. ROM Q. recursion L. kernel I. 3. queue K. packet J. 3. 3. multitasking D. domain E.16: A. IP address N.23: J.15: K Chapter Four (Networks and the Internet) 3. pseudocode E. Ethernet L. auditing software O. firewall G. algorithm B. time sharing E. 3. loop invariant F.

Appendix 1: language description table .

Otherwise. Example: A403 would cause the contents of register 4 to be rotated 3 bits to the right in a circular fashion. 7 RST OR the bit patterns in registers S and T and place the result in register R. (The jump is implemented by copying XY into the program counter during the execute phase. Example: C000 would cause program execution to stop. 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. If the two were equal. 9 RST EXCLUSIVE 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. A R0X ROTATE the bit pattern in register R one bit to the right X times. nothing would be done and program execution would continue in its normal sequence.) Example: B43C would first compare the contents of register 4 with the contents of register 0. Example: 20A3 would cause the value A3 to be placed in register 0. Example: 35B1 would cause the contents of register 5 to be placed in the memory cell whose address is B1. Otherwise. 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. Example: 5726 would cause the binary values in registers 2 and 6 to be added and the sum placed in register 7. continue with the normal sequence of execution. . 3 RXY STORE the bit pattern found in register R in the memory cell whose address is XY. 4 0RS MOVE the bit pattern found in register R to register S. Example: 14A3 would cause the contents of the memory cell located at address A3 to be placed in register 4. C 000 HALT execution. 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: 8045 would cause the result of ANDing the contents of registers 4 and 5 to be placed in register 0. Each time place the bit that started at the low-order end at the high-order end. 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. Example: 95F3 would cause the result of EXCLUSIVE ORing the contents of registers F and 3 to be placed in register 5. Op- code Operand Description 1 RXY LOAD the register R with the bit pattern found in the memory cell whose address is XY. 8 RST AND the bit patterns in register S and T and place the result in register R. Example: 40A4 would cause the contents of register A to be copied into register 4. 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. 2 RXY LOAD the register R with the bit pattern XY.