CMSC 104, Section 0101, Fall 2008

Exam 1 Sample Questions


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
    A GUI is a Graphical Utility Interface .
  8. TRUE or FALSE
    The UNIX operating system is command-driven.
  9. TRUE or FALSE
    UNIX filenames are case sensitive.
  10. TRUE or FALSE
    The UNIX command to copy a file is copy .
  11. TRUE or FALSE
    The UNIX command to copy a file is cp .
  12. TRUE or FALSE
    All computers store values using the decimal number system.
  13. TRUE or FALSE
    All computers store values using the binary number system.
  14. TRUE or FALSE
    Getting the data held at a particular memory address is known as a READ.
  15. TRUE or FALSE
    Getting the data held at a particular memory address is known as a WRITE.
  16. TRUE or FALSE
    Putting data into a particular memory address is known as a READ.
  17. TRUE or FALSE
    Putting data into a particular memory address is known as a WRITE.
  18. TRUE or FALSE
    Directories and subdirectories are heirarchichal in nature.
  19. TRUE or FALSE
    The study of algorithms began in the 1900's when electronic computers began to be used.
  20. TRUE or FALSE
    The UNIX command to list the files in a directory is ls .
  21. TRUE or FALSE
    The UNIX command to list the files in a directory is lst .
  22. TRUE or FALSE
    The UNIX command to create a new directory is mk .
  23. TRUE or FALSE
    The UNIX command to create a new directory is mkdir .
  24. TRUE or FALSE
    The UNIX command to delete a directory is del .
  25. TRUE or FALSE
    The UNIX command to delete a directory is rmdir .
  26. TRUE or FALSE
    The UNIX command to display the contents of a file is cat .
  27. TRUE or FALSE
    The UNIX command to display the contents of a file is ls .
  28. TRUE or FALSE
    RAM is volatile memory.

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 a computer.
    [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 is an operating system?
  10. [a.] C
    [b.] xemacs
    [c.] UNIX
    [d.] pine

  11. Pseudocode
  12. [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.

  13. The best definition of an algorithm is
  14. [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.

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

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

  19. Main memory is called RAM because
  20. [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.

  21. Secondary storage refers to:
  22. [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.

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

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

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

  29. xemacs in an example of a(n)
  30. [a.] text editor.
    [b.] operating system.
    [c.] e-mail utility.
    [d.] word processor.

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

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

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

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

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

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

  43. Which of the following commands would take you to the parent directory of the directory you are in?

    [a.] ..
    [b.] pwd
    [c.] cd .
    [d.] cd ..

Short Answer

  1. Two types of secondary storage are __________________ and ________________.
  2. Change the binary number 100112 to decimal ______________________.
  3. Change the decimal number 4710 to binary ________________________.
  4. The semi-formal, English-like language used to represent an algorithm is called ___________________________.
  5. All algorithms can be represented by just three control structures. List them.
  6. a. ______________________

    b. ______________________

    c._______________________

  7. Is the sentence below syntactically correct, semantically correct or both? ___________________________

    The dog drove the car home from the football game.

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

  10. Explain what each of the following UNIX commands does if typed exactly as shown at the linux prompt.
  11. ls ___________________________________________________

    cat sample.txt _______________________________________

    cd ___________________________________________________

    cp mybio.txt hw1.txt _________________________________

    rm example.txt _______________________________________

    man passwd ___________________________________________

  12. The UNIX command that shows you what directory you are currently in is ________________________.
  13. What exact UNIX command would be used to copy a file called apples.txt to a new file called oranges.txt ? (Assume apples.txt does exist in the current directory.)
  14. _________________________________________.

  15. A relative path is a path to a file, given in relation to the ___________________________________ directory.

  16. What is the difference between a GUI and a Command-driven Interface?

  17. What is an absolute path? Give an example of one.

  18. What is a relative path? Give an example of one.

  19. Name two ways to get to your home directory.

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. 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.
  6. 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.

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

  9. Write an algorithm that will properly charge a customer based on the billing fee schedule below.
  10. The Eureka Water Company charges the homeowner one of the following fees:

    Cubic Feet of Water UsedFee
    usage < 1000$15 Flat rate
    1000 <= usage < 2000$.0175 per cubic foot
    2000 <= usage < 3000$.02 per cubic foot
    usage >= 3000$70 Flat rate

    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

  11. 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?
  12. 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.

  13. 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.
  14. Sample input/output for your program is listed below. Your program's output is in bold. Sample numbers entered by the user are given. There is no specific solution for this problem.

    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.

  15. 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 paint 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. Note that your answer should be in whole gallons of paint.

  16. Jack is trying to figure out how much money he will receive in his paycheck before any deductions are taken. The company policy states that if an employee works more than 40 hours in a week, he receives overtime pay (time and a half) for the hours worked over 40. Jack worked a total of 45 hours for the week and his hourly pay rate is $12.00. How much money did he make?
  17. The algorithm should allow for changes in the number of hours worked and the hourly rate.



Last Modified: Tuesday, 07-Oct-2008 12:00:00 EDT