Fina Review Questions 2 Omit 1. How many bytes are in a gigabyte? 2. Give the rgb color codes for these colors: aqua, gray, maroon, yellow. 3. What is the difference between resizing and cropping images with MS Paint? 4. Write an image tag to display the image mouse.jpg, resized to 180 by 240 pixels. 5. What is the HTML source code that displays literally this end tag: 6. Rewrite this HTML code using an inline style instead: abc def ghi 7. Write a document-level style that sets the style for the each paragraph of an HTML page with these specifications: a) Arial font b) Blue text color c) 10 point font size d) Background color beige e) First line indented by 10 millimeters omit 8. Write a user defined class named angry in a document-level style that displays text in red, Forte font and 130% larger than usual. Here is an example of the tag's usage: I am very upset with you.

9. Write an HTML/JavaScript application that inputs the height in feet and inches, then converts this height to centimeters. The conversion factor is 2.54cm per inch. You will need two input textboxes, one output textbox and a submit button. 10. Write a JavaScript script that displays the following on an HTML page: Your lucky number is 45. 45 is a random number in the range 1, 2, ..., 99, 100. Use document.write to write to the page. 11. Write a JavaScript statement that changes the background color of the page to AliceBlue. 12. Write a JavaScript statement that displays 2 to the 30th power in the status bar of the browser. 13. Write HTML code for these two controls: a. A button with text Push Me, width 1.5 inches, height 0.75 inches, background color silver, text color maroon and event handler function ButtonEventHandler. b. A textbox with width 1.5 inches, height 0.75 inches, background color beige, text color navy and font Verdana. 14. Construct the variable trace and predict the output: var a = 4, b = 7, c = "s"; a = a + 3 * b; b = 2 * a + b; c = c + b + a; a = 2 * a; b = b + 3; c = c + c; document.write(a + " " + b + " " + c); 15. Find the mistakes in the following code: body = "backColor:130, 255, 60; color:White; font:ariel; } <script> function FF { documents.frmMain.RV = Math.Random( ); <head> <body> <p> <img sourc="lotto.GIF " > </p> <p> <input type="textbox" name="txtRV" value='' size=10 > <p/> <p> <input type="button" name="btnSubmit" value='Show Random' onclick="ShowRandom( );" /> <p/> </script> <body /> </html> 16. What color is close to this: rgb(252, 239, 237) 17. For this problem, use rgb color codes for all colors. You do not need to include the <style> tags. Write a document-level style that will set the following for all size 2 headings: a. Set the background color to green, b. the text color to dark green, c. the font to Cooper Black. 18. For this problem, use hex color codes for all colors. You do not need to include the <style> tags. Write a document-level style that will set the following for all controls (textboxes and buttons): a. Set the background color to maroon, b. the text color to yellow, c. the font to Chiller. 19. Write a user defined class .tb that sets the background color of a textbox to pink, the text color to maroon, the font to the same size as the body, and the border to none. Ans: .tb { background-color:maroon; font-size:100%; border:none; } 20. Construct the variable trace and predict the output: var x = 3, y = 5, s = false, t = false; x = x * 3; y = y + 4; document.write(x + " " + y + " " + t); s = 3 * x > 2 * y; t = x == y; document.write((x + y) + " " + s + "<br />"); Ans: Output: x y s t 9 4 false 18 true -----+-----+-----+----- 3 5 false false 9 9 true true 22. Perform the variable trace and predict the output: var a = 2, b = 5; if (a + b >= 7) { a = a + 3 * b; document.write(a + b + "<br>"); b = 2 * a + b; } else { a = a + 2 * b; document.write(a * b + "<br>"); b = 3 * a + b; } document.write(a + " " + b); 23. What is written on the document? document.write(1 + 2 + "3" + 4 + 5); 24. Perform the variable trace and predict the output: var x = 51, y = 0; while (x > 0) { x = Math.floor(x / 3); y = y + 2; document.write(y + " " + x + "<br />"); } document.write(x + y); 25. What does this script do? <script type="css/javascript"> var x; x = document.frmMain.txtInput.value; if (x / 2 == Math.floor(x / 2)) { document.frmMain.txtOutput.value = "Is Even"; } else { document.frmMain.txtOutput.value = "Is Odd"; } </script> 26. Write a JavaScript function that will display mars.gif in the image named imgPlanet if the name in the textbox txtPlanetName is "Mars". It should display venus.gif in imgPlanet if the name in txtPlanetName is "Venus". 27. Write the HTML tag that defines imgPlanet in the preceding problem. 28. Write a JavaScript function that obtains the check amount from the textbox txtCheckAmount and displays the amount of tip in the textbox txtTipAmount. The tip is calculated as 20% of the check unless the check is less than $5.00, in which case the tip amount is $1.00. 29. Write a JavaScript statement that will display one of the values {1, 2, 3, 4, 5} randomly in the textbox txtOutcome. (The textbox is on the form frmRandom.) 30. A handy man charges according to the type of service performed: $50 per hour for painting, $70 per hour for plumbing and $80 per hour for electric work. Find the errors in the following HTML/JavaScript code: <html> <head> <title>Handy Man Total Bill