< Back to Tests


JavaScript Basic Test

1. Inside which HTML element do we put the JavaScript ?

<js>
<scripting>
<script>
<javascript>

2. Which of the following is not a valid JavaScript variable name ?

_first_and_last_names
2names
FirstAndLast
None of the above

3. What is the correct JavaScript syntax to write "Hello World" ?

System.out.println("Hello World")
println ("Hello World")
document.write("Hello World")
response.write("Hello World")

4. What is the correct syntax for referring to an external script called " abc.js" ?

<script href=" abc.js">
<script src=" abc.js">
<script name=" abc.js">
None of the above

5. JavaScript is interpreted by _________ ?

Client
Server
Object
None of the above

6. Using _______ statement is how you test for a specific condition.

Select
If
Switch
For

7. Is it possible to nest functions in JavaScript ?

True
False

8. Which company developed JavaScript ?

Microsft
Sun Microsystem
Netscape
Google

9. What is mean by "this" keyword in javascript ?

It referes previous object
It refers current object
It is variable which contains value
None of the above

10. What is the output ?
<script language="javascript">
     function x()
     {
             document.write(2+5+"8");
     }
</script>

258
Error
7
78