1.Find five errors. Give letter of line and the error.
a. .
b.
c. Java Script Test1.____________________________
d.
e.
f. 2.____________________________
g.
h. var lengh = 10;
i. var width =3;3.___________________________
j. vararea = length * width;
k. document.write(“ Length is “,length, “
”);
l. document.write(“ Width is “,width, “
”)4. __________________________
m. document.write(“ Area is “,area,
);
n. // - ->
o. 5. ____________________________
p.
q.
2. Write the JavaScript Code (no need to use the HTML tags on any problem in this test) to find the surface area of a Cambell’sSoup can (two circles and the label )
Area of Circle = pi *Radius * Radius;Circumference = pi * Diameter; Diameter = 2* Radius, pi =3.14.
Input by a prompt (..) the Radius and Height ofthe can only. Output is the Radius , Height and Surface Area (top, bottom including the label).
Name _________________________________
3. Alumnae reunions invite all years that are a multiple of 10. For example this year would be 1950, 1960, 1970, . . .2010,2020. The MOD (symbol = %) function gives the remainder upon division by a certain number.
For example : 12 MOD 5 = 2,15 % 5 = 0,38 % 5 = 3 .
The problem here is to input all the years of Graduation (1950 to 2020 with a for loop ) and print out only the years that are invitedfor the reunion . If year =1995 thenyear % 10 = 5ètherefore is not invited . Use a FOR loop to generate all the years between 1950 and 2020. And print out “Class of“,year,” you are invited to a Summer reunion on July 9that the Metropolitan Museum(6 PM)”.
4. Write the code using a for loop to find and print out the ordered pair values of (x , y) =(#,#). For the first 10 values of x = 1, 2, . . .10 in the equationy = x*x + 3*x -5. Upon substituting x = 1, 2, 3 ..10 into the equation the out put should be ( 1,-1), (2,5) . . (10,125).
5.Given three test scores named test1, test2and test3 with a number grade in each. Your code is to sort them highest , middle and lowest( no Java Script Math functions are allowed to be used)
The input uses the prompt() function and for example let us say test1 = 75, test2 = 98 and test3 = 88. Your code should work for any combinations of inputs. The printed output will be in this particular case Highest = 98, Middle = 88 and Lowest = 75. For another set of grades the output would be Highest =83, Middle =81 and Lowest = 67 and so on.
6. What is the output of the following code:Answer to #6:
var n = 5;
var i = 3;
var j = 1;
document.write (“i*j*n =
”);
while(i
{
for (j=1; j
{document.write(i*j*n +”“);}
document.write (“
”);
i++;
}