CS 111 - Program Design I

Spring 2015

Exam 1 Results
  • Count: 104
  • Max: 100 (x2)
  • Min: 26
  • Average: 76.73
  • Median: 81
  • St. Dev.: 15.3
Grade Distribution
  • 100's: 2
  • 90's: 19
  • 80's: 33
  • 70's: 23
  • 60's: 11
  • 50's: 9
  • 40's: 5
  • 30's: 1
  • 20's: 1
Multiple Choice Answers:
  1. A
  2. D
  3. C
  4. A
  5. D
  6. A
  7. D
  8. B
  9. B
  10. C
  11. B
  12. C
  13. D
  14. B
  15. D
  16. B
  17. A
  18. D
  19. C
  20. E
Write Code Solutions

Note: Wiki loses indentation

// Question 21
public static void main (String[] args)
{
System.out.println("Begin Java Exection");
System.out.println("");

Picture p = new Picture (500, 500);
Turtle t = new Turtle (p);

t.setPenColor (Color.RED);
int i = 0;
while ( i < 4 )
{
t.forward (100);
t.turn (90);
i = i + 1;
}

t.penUp();
t.forward (20);
t.turn (90);
t.forward (20);
t.turn (-90);
t.penDown();

t.setPenColor (Color.BLUE);

i = 0;
while ( i < 4 )
{
t.forward (60);
t.turn (90);
i = i + 1;
}

p.show();

System.out.println("");
System.out.println("End Java Exection");
}

// Question 22
public static void drawStar (Turtle t, int length, Color c)
{
Color original = t.getPenColor();
t.setPenColor (c);

int i = 0;
while ( i < 15 )
{
t.forward (length);
t.turn (720/15);
i = i + 1;
}

t.setPenColor (original);
}

-- Main.troy - 2015-03-09

Topic attachments
I Attachment Action Size Date Who Comment
Java source code filejava Exam1S15.java manage 1.4 K 2015-03-09 - 12:54 UnknownUser  
Topic revision: r1 - 2015-03-09 - 12:54:42 - Main.troy
 
Copyright 2016 The Board of Trustees
of the University of Illinois.webmaster@cs.uic.edu
WISEST
Helping Women Faculty Advance
Funded by NSF