CS100 M
Review Questions for Prelim 1

  1. Be sure to review all the lecture examples, section/lab exercises, and homework problems!

  2. Short Questions:   Smith textbook, pp110-111, questions 1-5, 7.
    Note that we have focused so far on the logical AND (&&) and OR (||) operators. We will use & and | later.

  3. The income tax code in Timbuktu works as follows: the first $30,000 of income is taxed at 25%, the next $30,000 at 30%, and any amount above $60,000 at 40%. Write a program that accepts as input an income amount and computes and prints the correct tax amount to be paid in Timbuktu.

  4. Questions from FVL:

  5. Given integers nBig and nSm where nBig > nSm, write a program fragment that lists the integers in decreasing order and annotates the integers that are prime numbers. Only print functions and rem are allowed. Assume nBig,nSm > 1. Example output for nBig=6 and nSm=3 is
            6
            5 is prime
            4
            3 is prime
          

  6. Write a fragment to plot the function f(x) = 0.2*(x^3-x)/(1.1+cos(x)) for -2pi <= x <= 2pi.