Difference between revisions of "CS1 2nd Quarter Exam"

From WLCS
(New page: Directions: This portion of the exam is open-book, open-note, and CLOSED-person. You may use and test your code in Python. Copy and paste your answer in the spaces below. Print out your an...)
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Directions: This portion of the exam is open-book, open-note, and CLOSED-person. You may use and test your code in Python. Copy and paste your answer in the spaces below. Print out your answers.  Be sure to put your name on your answer sheet.  Place your exam in the Period 6 tray.
+
Directions: This portion of the exam is open-book, open-note, and CLOSED-person. You may use and test your code in Python. Copy and paste your answer in the spaces below. Print out your answers.  Be sure to put your name on your answer sheet.  Place your exam in the Period 1 tray.
  
7. Write a '''loop''' that prints "OMG LOL ROFL!!!1" 100 times
+
7. Prompt the user for his/her age and store it in a variable named ''age''.  Check if the age is less than 18, and if it is, then print out "You are a minor."  If the age is equal to or greater than 18, then print "You are an adult."
  
  
Line 7: Line 7:
  
  
8. Write a loop that prints out the first N terms of the following sequence:  1, 4, 16, 64, 256, ...
+
8. Write a '''loop''' that prints "OMG LOL ROFL!!!1" 100 times
  
<nowiki>
 
### Assume that the variable N has a value ###
 
</nowiki>
 
  
  
9. Write a loop that prints out every other character in the following string such that "Washington-Lee r0x0rs" is printed
+
 
 +
 
 +
9. Write the set of '''loops''' that will print out the following:
  
 
<pre>
 
<pre>
s = "W a s h i n g t o n - L e e  r 0 x 0 r s"
+
WWWWWWWWWW
 +
LLLLLLLLLLLLLLLLLLLL
 +
WWWWWWWWWW
 
</pre>
 
</pre>

Latest revision as of 09:31, 14 January 2009

Directions: This portion of the exam is open-book, open-note, and CLOSED-person. You may use and test your code in Python. Copy and paste your answer in the spaces below. Print out your answers. Be sure to put your name on your answer sheet. Place your exam in the Period 1 tray.

7. Prompt the user for his/her age and store it in a variable named age. Check if the age is less than 18, and if it is, then print out "You are a minor." If the age is equal to or greater than 18, then print "You are an adult."



8. Write a loop that prints "OMG LOL ROFL!!!1" 100 times



9. Write the set of loops that will print out the following:

WWWWWWWWWW
LLLLLLLLLLLLLLLLLLLL
WWWWWWWWWW