wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

QUIZ 1 - HTML & Javascript

Total questions: 30

Worksheet time: 22mins

Name
Class
Date
1.

Which is used to create a submission button?

a)

<button type="submit">Submit Here</button>

b)

There is no way to make a submission button.

c)

<input type="submit">

2.
Consider the following code for a text box in a Web form:
<input type="text" name="UserName"/>
Which modified tag should you use if you want the text box to appear with default text that reads "Enter Name Here"?
a)
<input type="text" name="UserName" value="Enter Name Here"/>
b)
<input type="name" text="Enter Name Here" value="text"/>
c)
<input type="area" value="default" text="UserName"/>
d)
<input type="text" name="UserName" default="Enter Name Here"/>
3.
Which line of HTML code creates a scrolling text box that can display three rows of text that are each 30 characters long?
a)
<input type="textarea" name="comments" width="30" rows="3"/>
b)
<input type="text" name="comments" chars="30" rows="3"/>
c)
<text name="comments" width="30" rows="3">
d)
<textarea name="comments" cols="30" rows="3">
4.
In the Web form you are creating, you want a multiple-option select list to appear with five options. Which line of HTML code will help accomplish this?
a)
<input type="select" name="work" multiple="yes" default="5"/>
b)
<select name="work" multiple="multiple" size="5">
c)
<select name="work" size="5">
d)
<input type="multiselect" name="work" default="5"/>
5.
In an HTML form, what is the purpose of the name attribute in an <input> tag?
a)
It identifies the form input received in a name=value pair by the site's administrator.
b)
It is required for the form to render in all browsers.
c)
It labels the form field so the user knows the type of input expected.
d)
It identifies the type of field or button that will appear in the form.
6.
<input type="checkbox"> is used
a)
for selecting zero or more of many choices
b)
for selecting one of many choices
c)
for submitting the form
d)
for selecting all of the choices
7.
The ___________ element is used to group related data in a form.
a)
<option>
b)
<fieldset>
c)
<input type>
d)
<form>
8.
Which form element will send all the data entered into the form to the processing script?
a)
radio button
b)
submit button
c)
button
d)
select menu
9.

The <th> tag marks what in a data table?

a)

column cell

b)

row

c)

heading cell

d)

table title

10.

Pieces of a web page; basic features that most Web pages have in common (such as paragraphs, headings, images, and lists) are called:

a)

Elements

b)

Tags

c)

Characteristics

d)

Designs

11.
After the following code runs, what is the value of b?
var a = true; 
var b = a || false;
a)
true
b)
false
c)
"b"
d)
"a || false"
12.
A store has 20 apples in inventory.How can you store this information in a JavaScript variable?
a)
var numApples == 20;
b)
20 = numApples;
c)
var numApples = 20;
d)
var num apples = 20;
13.
Why do we write functions?
a)
Make our code easier to understand 
b)
Avoid writing repeated code
c)
Make our code reusable
d)
All of these
14.
How can we check if a variable num is even?
a)
num.isEven() will be true
b)
(num % 2 == 0) will be true
c)
(num % 2 == 0) will be false
d)
(num / 2 == 0) will be true
15.
Which of the following formatting tags are HTML and DO NOT need to be inside of the <script> </script> tags?
a)
<div>
b)
<h1>
c)
<h3>
d)
all
16.
How do we count the number of characters in a string?
a)
.length
b)
.numberOfCharacters
c)
.textLength()
d)
String.characters()
17.
What character do we use for multiplication?
a)
#
b)
x
c)
*
d)
/
18.
A piece of code that combines commands and that you can easily call over and over again.
a)
A function
b)
A variable
c)
A loop
d)
A parameter
19.
How do we convert a string to all caps?
a)
.allCaps
b)
.AllCaps()
c)
.allCaps()
d)
.toUpperCase()
20.
How do we generate a random number?
a)
Math.random()
b)
random.number()
c)
number.random()
d)
Random.math()
21.
NaN is a datatype with a meaning of Not a Noun
a)
TRUE
b)
FALSE
22.

alert(“5 + 6”);


The code above will result in which output:

a)

syntax error

b)

11

c)

10

d)

5 + 6

23.

The code below would result in which answer?

var x = 1;

var y = 2;

vary z = 3;


z = x + y;

x = z + x;

alert(z);

a)

3

b)

4

c)

5

d)

syntax error

24.

for (var i = 0; i < 10; i++){

text("A", 40, i+40);

}

How many "A"s would be printed on screen?

a)

0

b)

9

c)

10

d)

11

25.

Which is a correct example of a JavaScript function?

a)

function run()

{

alert("Here is a message")

}

b)

run()

{

alert("Here is a message")

}

c)

run function()

{

alert("Here is a message")

}

d)

run() function

{

alert("Here is a message")

}

26.
What will be displayed after executing document.write("4" + 400/4);?
a)
101
b)
104
c)
4100
d)
undefined
27.

What does the following represent?


var colors = ['red', 'white', 'blue'];

a)

a string

b)

an array

c)

a function

d)

an object

28.

What will the alert say?


myNum = 0;

function getThis() {

var myNum = 15;

return;

}


getThis();

alert("This is my number " + myNum);

a)

This is my number 0

b)

This is my number 15

c)

This is my number

d)

This is my number undefined

29.

If today was Wednesday, what would the output of the following be?


switch (new Date().getDay()) {

case 4:

case 5:

text = "Soon it is the Weekend";

break;

case 0:

case 6:

text = "It is the Weekend";

break;

default:

text = "Looking forward to the Weekend";

}

a)

Looking forward to the Weekend

b)

Soon it is the Weekend

c)

It is the Weekend

d)

Nothing will output

30.
Are variables containing multiple values
a)
Arrays
b)
Character
c)
Number Variables
d)
Variable