wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript (Jquery) Quiz#1

Total questions: 30

Worksheet time: 16mins

Name
Class
Date
1.

Indicates the beginning and the end of a JavaScript section.

a)

<html> </html>

b)

<style> </style>

c)

<article> </article>

d)

<script> </script>

2.

What is one key characteristic of an id?

a)

It must be capitalized

b)

It must be unique to one tag

c)

It cannot include numbers

d)

It must go in the closing tag

3.

Which of the following is the proper way to call the testFunction() function when a button is clicked?

a)

onclick=testFunction

b)

when button clicked = "testFunction()"

c)

onclick="testFunction()"

d)

onclick="testFunction"

4.

DOM get element by id is?

a)

Document.Getelementbyid()

b)

document.getElementById()

c)

Document.getElementByID()

d)

DOM.getElmentById()

5.

What do "purple", "green" in this code refer to?


var x1= document.getElementById("purple")

var x2= document.getElementById("green")

a)

They are the IDs

b)

They are the names of the HTML

c)

They are the names of <h1> tags

d)

They are the names of <p> tags

6.

What does the acronym DOM stand for?

a)

Document Object Model

b)

Document Output Method

c)

Data Object Management

d)

Direct Object Manipulation

7.

Which property is used to change the CSS style of a DOM element in JavaScript?

a)

class

b)

style

c)

textContent

d)

innerHTML

8.
Which of the following function of String object returns the calling string value converted to upper case?
a)
toLocaleUpperCase()
b)
toUpperCase()
c)
toString()
d)
substring()
9.

Which method retrieves the corresponding value of an attribute?

a)

getAttribute

b)

setAttribute

c)

removeAttribute

d)

innerHTML

10.

Which method allows you to delete entire HTML attributes from an element?

a)

getElementById

b)

setAttribute

c)

innerHTML

d)

removeAttribute

11.

Which of the following tags are used in creating a list

a)

<lu> </lu>

b)

<ol> </ol>

c)

<ul> </ul>

d)

<li> </li>

12.

Which of the following are HTML tags that can be put inside the Head Section

a)

<title></title>

b)

<script></script>

c)

<style></style>

d)

<body></body>

13.

Which of the following are types of Arithmetic Operators

a)

x

b)

+

c)

%

d)

*

14.

With jQuery, you can hide and show HTML elements with the hide() and show() methods?

a)

True

b)

False

15.
How do we generate a random number?
a)
Math.random()
b)
random.number()
c)
number.random()
d)
Random.math()
16.

Which of the following is the correct CSS link tag?

a)

<link rel="styles" href="stylesheet.css">

b)

<link href="stylesheet">

c)

<link rel="stylesheet" src="styles.css"/>

d)

<link rel="stylesheet" href="styles.css">

17.

What will be the output of the following code snippet?

<script type="text/javascript">
var a = 5;
var output = 5 + "9";
document.write(output);
</script>
a)

error

b)

14

c)

59

d)

non of these

18.

<H1 STYLE=”font-size: 48pt; font-family: Arial; color: green”> CSS Test Text

</H1>

What type of css is used by the above code.

a)

Inline

b)

Embedded

c)

External

d)

Non of the above

19.

Which web development tools would I use if I wanted my web page to have specific colors and style?

a)

HTML

b)

CSS

c)

Javascript

d)

PHP

20.
which attribute is used to refer to the source file and its location in img tag
a)
href
b)
src
c)
ref
d)
rel
21.

Which of the below options is correct to change the background color to blue in CSS?

a)

body {

background-colour: lightblue;

}

b)

body {

background-color: lightblue;

}

c)

body {

background:color: lightblue;

}

d)

None of the above

22.

The "#" is used to select an html element by its:

a)

class

b)

id

c)

name

d)

data attribute

23.

Which of the following is selected by $('#bar')?

a)

<div class='bar'></div>

b)

<p data-bar='bar'></p>

c)

<h1>bar</h1>

d)

<img id='bar'></img>

24.

jQuery selectors allow you to ______?

a)

Style HTML element(s).

b)

Manipulate HTML element(s).

c)

Select HTML element(s).

d)

Select, Manipulate and Style HTML element(s).

25.

Which method is used to get or set the value of an input element?

a)

.val()

b)

.value()

c)

.input()

d)

.getValue()

26.

What is the purpose of the .ready() method?

a)

To run code when the DOM is fully loaded

b)

To hide elements

c)

To show elements

d)

To check if an element is visible

27.

Which sign does jQuery use as a shortcut for jQuery?

a)

$

b)

&

c)

=

28.

Which is the correct syntax for a link?

a)

<a href="url">link text</a>

b)

<a href="url" link text>

c)

<a href=url>link text</a>

d)

<a href="url" link text</a>

29.
Which of the following do you use to create a hyperlink in an HTML document?
a)
The <html> element
b)
The <hr> element
c)
The <img> element
d)
The <a> element
30.

Which of the following is the correct HTML syntax for inserting an image

a)

<img>apple.jpg</img>

b)

<img src="apple.jpg">

c)

<image src="apple.jpg">

d)

<img ="apple.jpg">