Key for Gold Exam
A.
Origin B.
Base C.
Increment D.
Start |
||||
var yell=”Woo-Hoo”; document.write(yell);
A.
How many
times, if any, will the loop run?
Explain why for full credit. B.
What prints
at the end of the code shown?
|
||||
3. ______________________
can include none, one or many ____________________.
|
||||
<html> <head><title>Conversion
Tables</title> <script type =
“text/javascript”> function convertC2F(tempInC) C D { //convert to farenheit var tempInF; E tempInF = (9/5)*tempInC
+32; return tempInF; } document.bgColor = “pink”; F //this break is
only here to make room for the box document.write(“<H2>Table of
Celsius – Fahrenheit Equivalents </H2>”); G document.write(“<table><th>C
</th> <th> H </th>”); document.write(“<tr><td>-10
</td> <td>” + convertC2F(-10)
+ “</td> </tr>”); H document.write(“<tr><td>20
</td> <td>” + convertC2F(20)
+ “</td> </tr>”); I document.write(“</table>”);
J </script> |
||||
[6 points]
A bus comes to one
of the stops on its route. There are
50 people waiting, of all different ages.
Riding the bus costs $1 if you are 18 or over and .50 cents for
passengers under 18 (but any passenger also under the age of 2 rides
free). The bus driver never leaves
behind a single passenger and will not pull away as long as people are
waiting to board. Of course, if they
don’t have the bus fare, the driver will kick them off and go on to the next
person. At the end of the day, the driver writes down on a piece of paper the
amount of money collected from fares to turn in to the central base. The amount of money should be the
equivalent of all the fares of the 18 and over passengers plus the fares of
the under 18 passengers (those under 2 aren’t counted). ·
Identify what in the story could be an example of a variable and
explain why: ·
Identify what in the story could be an example of a conditional and
explain why: ·
Identify what in the story could be an example of iteration and
explain why: ·
Identify what in the story could be an example of assignment and
explain why: ·
Identify what in the story could be an example of an expression and
explain why: ·
Identify what in the story could be an example of an array and
explain why: |
||||
|
||||
[3 points]
price = total * tax 1)___________________ 2)_____________________ 3)______________________ |
||||
<script
type=“text/javascript”> function Suess (fish1, fish2)
{ var fishes; fishes = “One fish, two fish ” + fish2 + “ fish, ” +
fish1 + “fish!” return fishes; } </script> <!--somewhere in the HTML
Document --> ……. document.write
(Suess(“red”, “blue”)); ……… What is written to
the document at this point? |
||||
A.
2 = num + 1; B.
zero = “zero”; C.
“zero” =
zero; D.
zero = 0; E.
zero + num =
1; |
||||
|
||||
A.
Are declared
inside of functions B.
Can have
their values changed from anywhere in the program C.
Are a way to
get input to a function D.
Can only be
changed inside functions |
||||
Relational/Comparison
Operator Logical
Operator |
||||
Example: 900,897,894….etc. |
||||
if (num1 == num2){ account = “balanced” } How is this part: num1 == num2 best described? Pick oneà |
||||
a)
Using Linear Search, what is the most students the program will have to
check? _______ b)
Using Binary Search, what is the most students the program will have to
check? ________ Space
for calculations (show your work!)[In both cases, the answer can be
approximate: off by 1 is OK.] |
||||
[3 points]
Assume that there are 2 global variables, DemoTally and
RepubTally. There is a text box named
“party” on a form named “vote” where a voter enters in their part
affiliation. They have three choices:
“Democrat”, “Republican” or “Independent”. Write a function that will add 4 to the RepubTally if the text box
shows “Republican”, add 3 to DemoTally if the text box holds “Democrat” and add
2 to RepubTally if the box shows “Independent” . |
||||
<HTML><HEAD> <script
type="text/javascript"> <!-- function bmiM ( weightKg,
heightM ) { return weightKg / (heightM * heightM); } //--> </script> </HEAD> <BODY> <script type="text/javascript"> <!-- document.write(bmiM(60, 2)) //--> </script></BODY></HTML>
Answer |
EXTRA CREDIT: (2 points each, total of 4 points)
1. Declare an array called wines with 3 elements. Initialize the array with these values:
“Riesling”
“Merlot”
“Pinot Noir”
2. In the context of Value Sensitive Design research, what does “informed consent” actually mean?