CS1150 (Spring 2013): Midterm 1

Variables and Expressions


Part 1

  1. (15 points) Describe the various parts of a computer (from the internal perspective). Indicate how they work together and what the significance of each is. This may best take the form of a picture. (This should not show e.g. tower, printer, keyboard, mouse, but rather things like memory and processor).
  2. (15 points) Discuss the differences between if...else and switch constructs.
  3. (15 points) What does Scanner provide for us? What is the difference between next(), nextInt(), and nextDouble(). What happens if you enter a word when an integer is expected?
  4. (30 points) Write a program called Quadratic. It should ask the user for (double) values for a, b, and c. After computing the discriminant (part under the square root in the quadratic formula), determine whether the specified quadratic has real roots. If it does, compute them (only print one if it only has one). If not, indicate that it has no real roots.

Deliverables

Send your answers in a PDF (do not send a Word Document) to bparks AT uccs DOT edu.