CMSC 104, Spring 2001

Midterm Exam Master List


True or False

Circle the word TRUE or the word FALSE. If neither is circled, both are circled, or it impossible to tell which is circled, your answer is considered wrong.

  1. TRUE or FALSE
    The CPU is considered the "brain" of the computer.
  2. TRUE or FALSE
    The bus is a group of parallel wires that carry control signals and data between the other components.
  3. TRUE or FALSE
    Main memory is often referred to as RAM.
  4. TRUE or FALSE
    Main memory is often referred to as ROM.
  5. TRUE or FALSE
    A peripheral device is an integral part of the computer.
  6. TRUE or FALSE
    A peripheral device is not an integral part of the computer.
  7. TRUE or FALSE
    The operating system gives the illusion of several jobs executing simultaneously through the use of time sharing.
  8. TRUE or FALSE
    The operating system is considered applications software.
  9. TRUE or FALSE
    The operating system is considered systems software.
  10. TRUE or FALSE
    UNIX filenames are case sensitive.
  11. TRUE or FALSE
    The UNIX command to copy a file is copy .
  12. TRUE or FALSE
    The UNIX command to copy a file is cp .
  13. TRUE or FALSE
    All computers store values using the hexadecimal number system.
  14. TRUE or FALSE
    All computers store values using the decimal number system.
  15. TRUE or FALSE
    All computers store values using the binary number system.
  16. TRUE or FALSE
    Only one program can be stored in memory at a time.
  17. TRUE or FALSE
    Many programs can be stored in memory at the same time.
  18. TRUE or FALSE
    Getting the data held at a particular memory address is known as a READ.
  19. TRUE or FALSE
    Getting the data held at a particular memory address is known as a WRITE.
  20. TRUE or FALSE
    Putting data into a particular memory address is known as a READ.
  21. TRUE or FALSE
    Putting data into a particular memory address is known as a WRITE.
  22. TRUE or FALSE
    It is possible to have more than one operating system available to run on a single machine.
  23. TRUE or FALSE
    Two operating systems can run simultaneously on the same machine.
  24. TRUE or FALSE
    In UNIX we can combine commands using the pipe, | .
  25. TRUE or FALSE
    Directories and subdirectories are heirarchichal in nature.
  26. TRUE or FALSE
    The Instruction Register contains the instruction currently being executed.
  27. TRUE or FALSE
    The Program Counter contains the address in memory of the next instuction to be executed.
  28. TRUE or FALSE
    The Program Counter always contains the address in memory of the first instuction of a program.
  29. TRUE or FALSE
    To begin running a program, the address of the first instruction of that program is placed in the Program Counter.
  30. TRUE or FALSE
    Logical operations are defined by their truth tables.
  31. TRUE or FALSE
    The study of algorithms began in the 1900's when electronic computers began to be used.
  32. TRUE or FALSE
    Typically, the longest phase of the software development life cycle is implementation.
  33. TRUE or FALSE
    The result of the logical operation 1 OR 1 is 1 .
  34. TRUE or FALSE
    The result of the logical operation 0 OR 0 is 1 .
  35. TRUE or FALSE
    The result of the logical operation 1 XOR 0 is 1 .
  36. TRUE or FALSE
    The result of the logical operation 1 XOR 1 is 0 .
  37. TRUE or FALSE
    The result of the logical operation 0 AND 0 is 1 .
  38. TRUE or FALSE
    The UNIX command to list the files in a directory is ls .
  39. TRUE or FALSE
    The UNIX command to list the files in a directory is lst .
  40. TRUE or FALSE
    The UNIX command to create a new directory is mk .
  41. TRUE or FALSE
    The UNIX command to create a new directory is mkdir .
  42. TRUE or FALSE
    The UNIX command to delete a directory is del .
  43. TRUE or FALSE
    The UNIX command to delete a directory is rmdir .
  44. TRUE or FALSE
    The UNIX command to display the contents of a file is cat .
  45. TRUE or FALSE
    The UNIX command to display the contents of a file is ls .
  46. TRUE or FALSE
    When a computer is booted, startup instructions are read from ROM.
  47. TRUE or FALSE
    When a computer is booted, startup instructions are read from RAM.
  48. TRUE or FALSE
    A machine cycle consists of three steps: fetch, decode, and execute.
  49. TRUE or FALSE
    A machine cycle consists of three steps: fetch, execute, and store.
  50. TRUE or FALSE
    The ALU performs operations as directed by the Control Unit.
  51. TRUE or FALSE
    The ALU performs operations as directed by RAM.
  52. TRUE or FALSE
    The Control Unit performs all logic operations.
  53. TRUE or FALSE
    The Control Unit activates the circuitry in the ALU to perform arithmetic and logic operations.
  54. TRUE or FALSE
    The ALU decodes the instruction currently held in the instruction register.
  55. TRUE or FALSE
    Algorithms are developed in the Design phase of the software development life cycle.
  56. TRUE or FALSE
    Algorithms are developed in the Implementation phase of the software development life cycle.
  57. TRUE or FALSE
    RAM is volatile memory.
  58. TRUE or FALSE
    ROM is volatile memory.
  59. TRUE or FALSE
    Registers are located in the CPU.
  60. TRUE or FALSE
    Registers are located in RAM.
  61. TRUE or FALSE
    The three categories of machine instructions are: data transfer, arithmetic/logic, and control.
  62. TRUE or FALSE
    The three categories of machine instructions are: fetch, decode, and execute.

Multiple Choice

Circle the letter of the best choice.
  1. Main memory is considered volatile because
  2. [a.] it may change at any time without warning.
    [b.] the contents of memory are lost when the computer is turned off.
    [c.] the contents of memory are the same each time the computer is turned on.
    [d.] the memory may be easily removed from the computer.

  3. A bus is
  4. [a.] part of the computer that decides if a value should be stored as an integer or floating point.
    [b.] a group of parallel wires that carry control signals and data between the computer's components.
    [c.] a logical operation that can be performed by the ALU.
    [d.] a series of tests that is performed on all of the computer's components during machine startup.

  5. Secondary storage is considered persistent because
  6. [a.] it may change at any time without warning.
    [b.] the contents of memory are lost when the computer is turned off.
    [c.] unless problems occur, the information isn't corrupted when the computer is turned off.
    [d.] the memory may be easily removed from the computer.

  7. The coordination of a computer's activities is handled by
  8. [a.] the operating system.
    [b.] peripheral devices.
    [c.] the computer operator.
    [d.] the keyboard.

  9. Which of the following machine cycle steps retrieves the next instruction from memory, then increments the Program Counter?
  10. [a.] decode
    [b.] execute
    [c.] fetch
    [d.] store

  11. Which of the following is an operating system?
  12. [a.] pico
    [b.] emacs
    [c.] UNIX
    [d.] pine

  13. Which of the following is NOT part of the operating system?
  14. [a.] dispatcher
    [b.] memory manager
    [c.] text editor
    [d.] scheduler

  15. Pseudocode
  16. [a.] is English phrases or formulas used to express each step of a problem.
    [b.] could include code structures such as If/Else or While.
    [c.] is a notation used to express an algorithm.
    [d.] is all of the above.
    [e.] is none of the above.

  17. Which of the following is NOT part of the CPU?
  18. [a.] ALU
    [b.] Control Unit
    [c.] main memory
    [d.] registers

  19. The best definition of an algorithm is
  20. [a.] a step by step solution to a problem.
    [b.] a finite set of unambiguous executable instructions that directs a terminating activity.
    [c.] a general solution to a problem.
    [d.] a finite set of steps that solve a problem.

  21. The boot process is:
  22. [a.] the process that decides if a value should be stored as an integer or floating point.
    [b.] a logical process that can be performed by the ALU.
    [c.] the process of grouping control signals and data.
    [d.] a series of tests that is performed on all of the computers components during machine startup followed by the loading of the operating system.

  23. Which of the following is NOT a step in the software development life cycle?
  24. [a.] requirements specification
    [b.] selecting the right computer system
    [c.] documentation
    [d.] implementation

  25. Machine language
  26. [a.] is made up entirely of 0's and 1's.
    [b.] uses mnemonics for easier human comprehension.
    [c.] uses high-level statements.
    [d.] all of the above.
    [e.] none of the above.

  27. Each cell of memory is numbered and that number is referred to
    as the cell's
  28. [a.] block.
    [b.] identity.
    [c.] address.
    [d.] size.

  29. A byte is composed of
  30. [a.] 2 bits.
    [b.] 4 bits.
    [c.] 8 bits.
    [d.] 16 bits.

  31. Main memory is called RAM because
  32. [a.] it is volatile, like a ram's temper.
    [b.] the computer starts at address 0 and reads every byte until it reaches the correct address.
    [c.] it can Read All Memory.
    [d.] the memory is accessible randomly.

  33. When booting the computer, start-up instructions are read from
  34. [a.] ROM.
    [b.] RAM.
    [c.] the keyboard.
    [d.] the user.

  35. When a computer boots up,
  36. [a.] instructions are read.
    [b.] the instructions perform a test of the components.
    [c.] the operating system is loaded from disk.
    [d.] all of the above happen.
    [e.] a & b

  37. Secondary storage refers to:
  38. [a.] swap or virtual memory, which creates the illusion of more RAM on the system.
    [b.] RAM.
    [c.] ROM.
    [d.] devices such as hard disks, tapes, or floppy disks.

  39. The UNIX command that renames a file is
  40. [a.] mv
    [b.] rn
    [c.] ls
    [d.] pwd
    [e.] none of the above.

  41. The concept of the stored program is attributed to
  42. [a.] Charles Babbage.
    [b.] John Von Neumann.
    [c.] Bill Gates.
    [d.] Steven Jobs.

  43. pine is an example of a(n)
  44. [a.] text editor.
    [b.] operating system.
    [c.] e-mail utility.
    [d.] word processor.

  45. UNIX is an example of a(n)
  46. [a.] text editor.
    [b.] operating system.
    [c.] e-mail utility.
    [d.] word processor.

  47. emacs and pico are examples of
  48. [a.] text editors.
    [b.] operating systems.
    [c.] e-mail utilities.
    [d.] word processors.

  49. Which of the following is NOT a category of machine instructions?

    [a.] arithmetic/logic
    [b.] data transfer
    [c.] control
    [d.] file movement

  50. Time sharing
  51. [a.] is when many peripheral devices are controlled by the same computer.
    [b.] creates the illusion of several jobs executing simulataneously.
    [c.] is when many programmers work on the same computer program at the same time.
    [d.] allows multiple hard drives to be accessed at the same time.

  52. Which type of sotware extends the capabilities of the operating system?
  53. [a.] utility
    [b.] applications
    [c.] programming languages
    [d.] compilers

  54. The UNIX command to delete a file is
  55. [a.] mv
    [b.] del
    [c.] rm
    [d.] pwd

  56. The study of algorithms began
  57. [a.] when the first computer was invented.
    [b.] as a subject in mathematics.
    [c.] in the 1800's.
    [d.] in the 1940's.

  58. In a time-sharing environment, the operating system rotates among jobs, giving each job a predetermined
  59. [a.] run time.
    [b.] execution time.
    [c.] time piece.
    [d.] time slice.

  60. A Windows GUI and the UNIX command line are examples of operating system

    [a.] shells.
    [b.] windows.
    [c.] kernels.
    [d.] utilities.

  61. Which of the following is NOT a component of an operating system kernel?
  62. [a.] file monitor
    [b.] device driver
    [c.] dispatcher
    [d.] scheduler

  63. ADD, STORE, and LOAD are examples of
  64. [a.] opcodes.
    [b.] operands.
    [c.] operators.
    [d.] options.

  65. The concept or meaning represented by an algorithm is known as its
  66. [a.] control structure.
    [b.] sequence.
    [c.] semantics.
    [d.] syntax.

  67. The Program Counter contains the address of the
  68. [a.] current instruction in memory.
    [b.] last instruction in memory.
    [c.] next instruction in memory.
    [d.] fastest instruction in memory.

  69. An IF statement in pseudocode is an example of a
  70. [a.] repetition control structure.
    [b.] looping control structure.
    [c.] sequential control structure.
    [d.] selection control structure.

  71. A text file that can be used to store repeated command sequences is called a
  72. [a.] document.
    [b.] script file.
    [c.] command file.
    [d.] sequence file.

  73. The notation .. (dot-dot) refers to the
  74. [a.] parent directory.
    [b.] current directory.
    [c.] child directory.
    [d.] home directory.

  75. The notation . (dot) refers to the
  76. [a.] parent directory.
    [b.] current directory.
    [c.] child directory.
    [d.] home directory.

Short Answer

  1. Two types of secondary storage are __________________ and ________________.
  2. The computer's start-up procedure is called ____________________.
  3. Two types of software are _____________________ and _____________________.
  4. The internal part of the operating system is often called _______________________.
  5. The person who is credited with the stored program concept that places the program and data into RAM for execution is ________________________.
  6. Change the binary number 11011 to decimal ______________________.
  7. Change the binary number 11011 to hexadecimal __________________.
  8. Change the decminal number 49 to binary ________________________.
  9. Change the hexadecimal number A048 to binary ___________________.
  10. The sum of the binary numbers 101011 and 101110 is _____________.
  11. Two special purpose registers in the CPU that are used for program execution are the
  12. ___________________________ and the ____________________________.

  13. Name two of the three logical operations that can be performed by the ALU.
  14. a. _____________________________

    b.______________________________

  15. In the software development life cycle, inputs, outputs and special constraints are investigated in the ___________________ phase.
  16. The semi-formal, English-like language used to represent an algorithm is called ___________________________.
  17. All algorithms can be represented by just three control structures. List them.
  18. a. ______________________

    b. ______________________

    c._______________________

  19. Give the UNIX command that would create a new directory called cmsc104 underneath the current directory.
  20. _________________________________________________

  21. In the octal numbering system, base 8, the digits used are in
  22. the range of _______________ to ________________.

  23. Explain what each of the following UNIX commands does.
  24. ls _____________________________________________

    cat sample.c ____________________________________

    cd ____________________________________________

    cp example.c proj2.c _____________________________

    rm example.c ___________________________________

    man passwd ____________________________________

  25. Special high-speed memeory cells located in the CPU are known
  26. as ________________________.

  27. The interface between the operating system and the user is called the __________________.
  28. The UNIX command that when typed will return what directory you are currently in is ________________________.
  29. The concept of breaking complex steps into smaller and smaller easier to solve steps is called ______________________________.
  30. Machine language instructions are made up of two parts, the
  31. ____________________ and the ____________________.

  32. The part of the CPU that performs +, -, /, *, AND, and OR operations is the ___________________________.
  33. A subprogram returns a single value to the main program is called a ____________________________.
  34. A machine cycle consists of three steps, ___________________,
  35. ___________________ and _____________________.

  36. What exact UNIX command would be used to copy a file called Project1.c to a new file called Project3.c ? (Assume Project1.c does exist in the current directory.)
  37. _________________________________________.

  38. Inputs, outputs, constraints, and assumptions are considered in the ______________________ phase of the software development life cycle.

  39. A grouping of files ia called a ___________________________________ .

  40. A ___________________ file contains a sequence of commands (similar to a DOS batch file).

  41. Programs that are executed sequentially with no interaction from the user are called ______________________ jobs.

  42. An example of a wildcard character used by UNIX commands is _____________________ .

  43. For logical operations, we consider a 1 to be _____________ and a 0 to be ________________ .

Algorithms

First solve the following specific problems, then write an algorithm in pseudocode for general problems of the same type. Be sure your pseudocode is clear, consistent, and properly indented.

  1. A manufacturer sells a certain article to dealers at a rate of $10.00 each if less than 20 are ordered. If 20 or more are ordered, the price of each article is reduced by 50 cents. What is the total cost of 100 units?
  2. The algorithm should allow for changes in the $10 price and for purchases under 20 units. The algorithm should allow for changes in the 50 cents reduced rate.

  3. A cylindrical tank is 4 feet tall and the bottom's diameter is 2 feet. What is its volume in cubic feet ? Use 3.14 as pi.
  4. The algorithm should allow for changes in the height of the cylindrical tank and the diameter of the bottom.

  5. Employers are responsible for paying half of each employee's FICA. The total payment for each employee is 6% (the FICA rate) of their gross income, so the employer withholds 3% of the gross pay from each employee's check and the employer must pay a matching amount. The employer is responsible for making the full payment to the Social Security Administration. If the total gross income of all of the company's employees this month was $500,000, what is the amount that needs to be paid to FICA this month and how much was covered by the deductions from the employees' pay checks.
  6. The algorithm should allow for changes in the FICA rate and the gross income per month. The employer will always be responsible for half of the payment and the employee for the other half.

  7. You have just purchased a car and you would like to see what your actual gas mileage is. To determine the number of miles per gallon that your car uses, you need to write down the number of miles on the odometer and fill the tank, drive the car as you normally would until you are almost out of gas, then fill the tank again recording both the odometer reading and the number of gallons that it took to fill the tank from the gas pump.
  8. If the initial odometer reading was 40,550 and the second reading was 40,800, how many miles did you travel between fills ? If it took 10 gallons of gas to fill the tank, what was your mileage in miles per gallon ?

    The algorithm should allow for changes in the first and second odometer readings and the number of gallons needed to fill the tank.

  9. Determine the surface area of a box, in square inches, that is 12 inches long, 8 inches wide and 5 inches high.
  10. The algorithm should allow for changes in the length, width, and height of the box.

  11. Write an algorithm which will properly charge a customer based on the following billing schedule,
  12. The Eureka Water Company charges the homeowner one of the following:

    - A flat Rate of $15.00 for usage up to an including, 1000 cubic feet.

    - $.0175 per cubic foot for usage over 1000 cubic feet and up to and including 2000 cubic feet.

    - $.02 per cubic foot for usage over 2000 cubic feet and up to and including 3000 cubic feet.

    - a flat rate of $70 for usage over 3000 cubic feet.

    Your Algorithm should allow the customer to purchase any amount of water.

    Your Algorithm should allow the user to input different rates for the:

    - lower than 1000 cubic feet purchase

    - 1000 to 2000 cubic feet purchase

    - 2000 to 3000 cubic feet purchase

    - over 3000 cubic feet purchase

  13. Mr. Rodin kept 2 firecrackers for himself, then divided the others equally among his 14 children. If each child got 4 firecrackers, how many did Mr. Rodin have to begin with?
  14. Your Algorithm should allow Mr. Rodin to keep any number of firecrackers for himself. The user should be allowed to specify any number of children. The user should be allowed to specify any number of firecrackers per child.

  15. A guitar company pays it employees as:
  16. - Managers (receive a fixed weekly salary)

    - Hourly Workers (receive a fixed hourly wag for up to the first 40 hours they work, and time-and-a-half ie 1.5 times their hourly wage, for overtime worked)

    Your Algorithm should prompt the user (ie payroll clerk) to enter the appropriate facts to calculate the weekly payroll for the company.

    For example: 3 Managers at $X per week, 6 hourly workers at $Y per week. Create various pay scales based on realistic pay values (X & Y) you feel the guitar producers are worth.

  17. Write pseudo-code for a program that keeps asking the user to input integers until the user enters zero, and determines and outputs the largest integer.
  18. Sample input/output for your program is listed below. Your program's output is in bold.

    Please input an integer, 0 to end: 6
    Please input an integer, 0 to end: 19
    Please input an integer, 0 to end: -4
    Please input an integer, 0 to end: 0

    The largest integer entered was 19.

  19. A painter wants to know the amount of paint needed to paint only the walls and the interior side of the door in a room. The chosen paint covers 100 square feet per gallon. There are no windows in the room. Develop an algorithm that will determine amount of pant that is needed. Use the following data to obtain an answer, then develop a generic algorithm for any size room. The room is 10 feet long, 10 feet wide and 10 feet tall.

Answer to Problem: ____________ gallons.

The algorithm should obtain the length, height, and width of the room from the user.