Learn with Yasir

Share Your Feedback

Review Questions


Review Questions

The Basics of JavaScript

  1. Describe the operation of the alert method in JavaScript.

  2. Describe the operation of the prompt() method in JavaScript.

  3. Write a program to execute a JavaScript function using HTML onclick Event Attribute

  4. write function to add two numbers in javascript

  5. Describe briefly three major uses of JavaScript on the client side?

  6. What are the two categories of properties in JavaScript?

  7. Why does JavaScript have two categories of data variables, namely, primitives and objects?

  8. Describe the two ways to embed a JavaScript script in an HTML document?

  9. What are the two forms of JavaScript comments?

  10. Why are JavaScript scripts sometimes hidden in HTML documents by putting them into HTML comments?

  11. What are the five primitive data types in JavaScript?

  12. Do single-quoted string literals have any characteristics different from those of double-quoted string literals?

  13. In what circumstances would a variable have the value undefined?

  14. If the value undefined is used as a Boolean expression, is it interpreted as true or false?

  15. What is the usual end-of-line punctuation for the string operand passed to document.write?

  16. What is the usual end-of-line punctuation for the string operand passed to alert?

  17. Describe the operation of the prompt method.

  18. write program to display multiplication table using for, while do while loops in javascript. (15)

10 * 1 = 10

10 * 2 = 20

………………

………………

10 * 10 = 100

  1. What would be the output of the following script?
<html> <head><title>JavaScript</title></head> 
<body> 
<script language="JavaScript"> document.write((125/5)%12); </script> </body> </html> 
  1. Error Detection. Find 3 errors in the code sample.
<html> <body> <script type="text/js">  document.print("Hello")  </script> </html>