CSC103 Take-Home Final Exam Spring 2012

From dftwiki3
Revision as of 09:57, 8 March 2012 by Thiebaut (talk | contribs) (Submitting the Program (NEW SECTION))
Jump to: navigation, search


This final exam is take-home. It is open-books, open-notes, and open-Web. It is due a week after it is made available, at 10:20 a.m. on Wednesday March 14, 2012.

The work has to be done individually, not in a group. You cannot discuss the details of this exam with anyone except your prof. The TA is not allowed to help you out with exam material in any way. Questions will only be answered in two ways: if in person, in class only. If outside class time, only via email. If you have questions regarding the exam then you should send your question(s) via email to thiebaut@cs.smith.edu, and the question and its answer will be broadcast back to the whole class via email.

The exam is given under the rules of the Smith College Honor Code.

Make sure you reference all work/resources you use to answer the questions below.

Grading
Each problem is worth the same amount of points. You only need to answer three of the four problems. Three problems answered correctly will count as 4 points, or A. If you answer 4 problems, the 3 problems with the best grades will be added up.



What to submit

  • You will need to handout your answers on paper on the due date.
  • Use whatever word processor you like to write your answers. When copying/pasting the assembly language or processing code to your document, please use a non-proportional font, such as courrier for the code: it makes it look nicer, and it is easier to read that way.
  • If you cannot submit your work in person, email it to thiebaut@cs.smith.edu, and make sure the subject of your message reads "CSC103 Finall Exam".

Problem 1: Boolean Logic

  • What is the truth table of the boolean function f below, which is a function of three boolean variable a, b, and c?
  • What is the boolean expression of f?


CSC103Final2012BooleanLogic.png


Problem 2: Programming in Processing

CSC103ProcessingFinal2012.png

Initial Program

  • Copy/Paste this program into the Processing editor.


// declare a variable called diameter that will contain
// real numbers.
float diameter;

void setup() {
  size( 500, 500 );
  smooth();
}

void draw() {
   // put a random number less than 200 into variable diameter
   diameter = random( 200 ); 

   // pick a color with a random amount of red, 100 units of green, and 200 units of blue
   fill( random(255),100, 200 );  

   // draw 10 circles at random position in the window, with the same diameter.
   for ( int i=1; i<=10; i++ ) {
      ellipse( random( 500 ), random( 500 ), diameter, diameter );
   }
       
}


  • Run it and observe how it works.

Some Explanations

  • There are 2 new elements in the program:
    • float diameter, and
    • random( ).
  • float diameter simply says that diameter is used in the program as a variable that will contain a real number (real numbers are numbers with a decimal point).
  • random() is a function that returns a random number. If you call random(10), it will return a random number between 0 and 10, not inclusive. So, when we write:
  diameter = random( 200 );
we make the sketch store a random number into the variable diameter, and we force this random number to be larger than or equal to 0, and less than 200.
When we call ellipse() and write random(500) for both the x and y coordinates, we make the sketch put a circle in the window at a random position, but we force the center of the circle to remain inside the window.

Your Assignment

  1. make your sketch display circles on the window only when the mouse button is pressed. If the mouse isn't pressed, nothing happens in the window
  2. make the circles shrink in size if the mouse moves toward the left side of the window. The circles will grow in size if the mouse moves toward the right side of the window. The circles are still random in size, but their maximum size depends on the mouse position.
  3. make the circles more random in color and not with this strong blue tint. Moreover, instead of having 10 circles the same color every time draw() is called, make each of the 10 a different (random) color.

Example

  • Here is an example below showing the final sketch running. It is not possible to hear the mouse click but you will see that the generation of circles is interrupted regularly when the user releases the mouse button.



Submitting the Program (NEW SECTION)

(Section added on 3/8/12: --D. Thiebaut 09:56, 8 March 2012 (EST))

  • Please submit the code of your sketch the same way you did for Homework 5.
  • Go to this URL: http://maven.smith.edu/~103b/submitfinal.htm
  • Enter your 2-letter Id (same as the one you used in Homework 5)
  • Add your name in the top of the text area, prefixed with two slashes (to make it a comment)
  • Paste your code in the text area, and
  • Submit it!




You should still submit a copy of your sketch on paper with your final exam.





Problem 3: Assembly Language Program

  • Write a assembly language program that contains 1 variable, var1, and one loop, and that computes the sum of all the integers between 10 and 1 and stores this sum in var1.
  • When your program starts, var1 will contain 0.
  • When your program stops, var1 will contain 55.
  • Your program must compute this value by summing up 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 and storing the result in var1.
  • The following program is not acceptable:
  lod-c  55
  sto    var1
You must use a loop!

Problem 4: Essay Question

  • Pick a particular technological process, and a measure associated with it (computer speed, amount of data generated, size of a device, ability to process some quantity of information) and explain in a 1-page paper how it has evolved during your life time. Make sure you find several data points spanning your 20-year time scale and indicate if these points represent an exponential growth, and if not what kind of growth that is.
  • Please type your answer so that it fits one page of text, single spaced. You may include graphs to support your explanations.
  • Make sure you reference your sources.