Difference between revisions of "CSC103 Final Exam 2017"

From dftwiki3
Jump to: navigation, search
Line 14: Line 14:
 
<onlydft>
 
<onlydft>
 
=Problem 1: Logic Design (33%)=
 
=Problem 1: Logic Design (33%)=
 +
<br />
 +
In logic design, a ''majority voter'' is a circuit that has 3 boolean inputs, and outputs the value that appears on 2 or more of the inputs.  For example, if two of the inputs are 1 (or true), then the output is 1 (or true).  If two of the inputs are 0 (or false), then the output is 0 (or false).  Of course, if all three inputs are 1, then the output is 1.  If all inputs are 0, the output is 0.
 
<br />
 
<br />
 
The following three logic circuits are candidates for a majority voter.  
 
The following three logic circuits are candidates for a majority voter.  
  
 
<br />
 
<br />
[[Image:CSC103FinalCircuit1.png|300px|center]]
+
[[Image:CSC103FinalCircuit1.png|400px|center]]
 
<br />
 
<br />
 
<br />
 
<br />
[[Image:CSC103FinalCircuit2.png|300px|center]]
+
[[Image:CSC103FinalCircuit2.png|400px|center]]
 
<br />
 
<br />
 
<br />
 
<br />
[[Image:CSC103FinalCircuit3.png|300px|center]]
+
[[Image:CSC103FinalCircuit3.png|400px|center]]
 
<br />
 
<br />
 
<br />
 
<br />
 
 
Which circuit or circuits are majority voters?
 
Which circuit or circuits are majority voters?
 
+
<br />
 
* Circuit A?
 
* Circuit A?
 
* Circuit B?
 
* Circuit B?
Line 37: Line 38:
 
* Circuits B and C?
 
* Circuits B and C?
 
* all three?
 
* all three?
 
 
 
<br />
 
<br />
Submit your answer on Moodle, in the Problem 1 section.
+
Please answer in the Problem 1 Section of the Final Exam on Moodle.
 +
<br />
 
<br />
 
<br />
 
=Problem 2: Assembly (33%)=
 
=Problem 2: Assembly (33%)=

Revision as of 18:46, 17 October 2017

--D. Thiebaut (talk) 22:30, 16 October 2017 (EDT)



This exam is a take-home exam for CSC103, Fall 2017. The exam is open-books, open-notes, and open-Web. It is given under the rules of the Smith College Honor Code, and the work your turn in must reflect your individual work. You cannot discuss any of the details of this exam with anybody except your instructor (Dominique Thiebaut). If you have a question, please post it on Piazza.
You cannot work in pairs on this exam.
This exam is due on Moodle on 25 October 2017 at 11:55 p.m.




...




<onlydft>

Solutions


Problem 3


// CSC103
// Final Exam 
// Smith College
// Script creating a red window 
// with the caption "CSC103 2017"
// 
void setup() {
  // define the size of the window
  size( 400, 600 );
  smooth();
  
  // create red background
  background( 240, 19, 19 );
}

void draw() {
  strokeWeight( 1 );
  if ( mousePressed == true ) {
    if ( mouseY < 300 ) {
      fill( 196, mouseY/2, 219 );
      ellipse( mouseX, mouseY, mouseX/2, mouseX/2 );
    }
    else {
       fill( 211, 122, mouseY/2 );
       rect( mouseX, mouseY, mouseX/4, mouseX/4 );
    }
  }
  
  stroke( 0, 0, 0 );
  strokeWeight( 10 );
  fill(  240, 19, 19 );
  rect( 25, 50, 350, 70 );
  
  textAlign( CENTER );
  textSize( 48 );
  fill( 149, 77, 77 );
  text( "CSC103 2017", 200, 100 );
  
  textSize(24 );
  fill( 0, 0, 0 );
  text( "Mickey Mouse", width/2, height - 30 );
}