Tests abgeschlossen
Anmeldung
Lernhilfen
Kontaktiere uns
Mit Facebook einloggen
7. Klasse
4. Klasse
Allgemeine Tests
JavaScript - Test 1
Programing skills - JavaScript - Math
1.
Between which HTML tags do we put the JavaScript?
<js>
<script>
<javascript>
<scripting>
2.
JavaScript and Java are the same.
False
True
3.
Where is the correct place to insert a JavaScript?
The <head> section.
The <body> section.
Both the <head> section and the <body> section are correct.
None of above.
4.
What is the correct syntax for including an external script called "sample1.js"?
<script href="sample1.js">
<script name="sample1.js">
<script src="sample1.js">
<#include "sample1.js">
5.
The external JavaScript file
must
contain the
<script>
tag.
True
False
6.
How to write "Hello World!" message in JavaScript?
alert("Hello World");
msgBox("Hello World");
alertBox("Hello World");
msg("Hello World");
7.
How to create a function in JavaScript?
function:MyFunction()
function MyFunction()
function = MyFunction()
function = New MyFunction()
8.
How to call a function named "myFunction"?
call function myFunction()
myFunction()
call myFunction()
9.
How can you write a comment in a JavaScript?
<!-- This is a comment. -->
' This is a comment.
// This is a comment.
10.
How to write an
IF
statement in JavaScript?
if i == 2 then
if i = 2
if i = 2 then
if (i == 2)
11.
How to execute some code if "i" is NOT equal to 2?
if (i != 2)
if (i <> 2)
if i != 2 then
if i <> 2
12.
How does a WHILE loop start?
while i = 1 to 7
while (i <= 7)
while (i <= 7; i++)
13.
How does a FOR loop start?
for (i <= 10; i++)
for i = 1 to 10
for (i = 0; i <= 10; i++)
for (i = 0; i <= 10)
14.
How to write a comment that has more than one line?
// This comment has
more than one line //
/* This comment has
more than one line */
<!-- This comment has
more than one line -->
15.
What is the correct way to write a JavaScript array?
var colors = "yellow", "purple", "blue"
var colors = ["yellow", "purple", "blue"]
var colors = 1 = ("yellow"), 2 = ("purple"), 3 = ("blue")
var colors = (1:"yellow", 2:"purple", 3:"blue")
16.
How to round the number 3.14, to the nearest integer?
round(3.14)
Math.round(3.14)
rnd(3.14)
Math.rnd(3.14)
17.
How to find which number has the highest value (x and y)?
ceil(x, y)
Math.ceil(x, y)
top(x, y)
Math.max(x, y)
18.
What is the correct JavaScript syntax for opening a new window?
myWindow = window.open("http://www.w3schools.com");
myWindow = New window("http://www.w3schools.com");
myWindow = window.new("http://www.w3schools.com");
19.
What is the correct JavaScript syntax to change the content of the HTML element below?
<p id="demo">This is a demo text.</p>
$demo.innerHTML = "Hello World!";
document.getElementById("demo").innerHTML = "Hello World!";
document.getElement("p").innerHTML = "Hello World!";
document.getElementByName("p").innerHTML = "Hello World!";
#demo.text = "Hello World!";
20.
How to detect the client's browser name?
browser.name
navigator.appName
client.navName