wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Cuestionario de Certificación JS 2024

Total questions: 17

Worksheet time: 17mins

Name
Class
Date
1.

Variable x has a value of 5, variable y has a value of 8. 

Select True if the expression evaluates to true, or False if it does not. 

x < 4 || y > 8

a)

True

b)

False

2.

Your instructor has the following exception handling requirements. 

  • The displayInfo() function must use exception handling. 

  • The display() function must always run, regardless of whether an exception occurs. 

  • If there is an exception, the script must call the logDisplayInError() and correctDisplayInfo() functions.

What is the correct opction for complete the code?

a)

catch

b)

catch(msg)

3.

You are writing JavaScript code that manipulate dates. 

You need to initialize a Date object with the date January 1, 2021 by using the year, month, and date parameters. 

Complete the code by selecting the correct option.

var date = new Date( 2021 , _______ , ________) 

a)

0

b)

1

c)

01

4.

What is the correct syntax to determine if a string called str is empty?

a)

str == null

b)

str == "null"

c)

str == ""

d)

str == "empty"

5.

You are creating a JavaScript program for an accounting system. 

You evaluate the code to ensure that it follows JavaScript best practices. 

Which two lines of code contain reserved words? (Choose 2)

a)

01

b)

02

c)

03

d)

04

e)

05

6.

You are helping a coworker test the following form. 

The form will submit to a script named contact.   

a)

True

b)

False

7.

Complete the code by selecting the correct option from each dropdown list.

The page allows users to create a problem ticket and send an email to help@societyrugby.com. The email contains a problem description, the user’s name and user’s phone number. 

You need to perform custom validation of the user’s phone number (yourPhoneNumber) when the page attempts to send the problem ticket (problemTicket). 

Which property, method, or event of the form object should you use? 

a)

target

b)

onclick

c)

onsubmit

d)

setCustomValidity

8.

You are using JavaScript to develop a Tic - Tac – Toe program, You write the following code. 

Which array element contains the “0”?  ____________ 

a)

grid[1][3]

b)

grid[2][1]  

c)

grid[0][2]  

d)

grid[3][1]  

9.

A web page displays the following image element. 

 

<img src=”images/cottage.jpg” id=”cottage” alt=”Vacation Cottage” style=”width:150px; height=100px”>; 

 

When the user hovers over the image element, the page should call a displayText function. You are writting the code to call the function. 

a)

document.getElementById(“cottage”).onmouseover = displayText(); 

b)

document.getElementById(“cottage”).addEventListener(“mouseover”, displayText()); 

c)

document.getElementById(“cottage”). addEventListener(“mouseover”, displayText); 

d)

document.getElementById(“cottage”). addEventListener(“onmouseover”, displayText()); 

10.

You write the following code. Line numbers are included for reference only.

You need to ensure that the function returns true only if the amount is equal to or less than the currentBalance. 

a)

if (amount >= currentBalance) { 

b)

if (amount < currentBalance) {

c)

if (amount <= currentBalance) {

d)

if (amount > currentBalance) {

11.

You run the following code displayed in the image.

What value is stored in the variable chain after the code runs? 

a)

3  4  5  6  7

b)

0 1

c)

0  1  3  4  5  6  7  8 

d)

1  3  4  5  6  7  8 

e)

0  1  3  4  5  6  7 

12.

Which JavaScript code fragment will store only the number 42 in the variable iNum as a number? 

a)

var iNum = “42fred”;

b)

var iNum = ”42fred”; 

     iNum = iNum.substr(1,2); 

c)

var iNum = “42fred”; 

     iNum = iNum.substr(2,2); 

d)

var iNum = parseInt(“42fred”);

13.

The window.document.getElementById(elementName)  

             method returns the element that has the name attribute with the  

             value specified in the elementName parameters. 

a)

True

b)

False

14.

Several HTML documents need to reference the same JavaScript code. Where should the JavaScript code reside?

a)

In a .css file

b)

Inside the head tags of each document

c)

In a .js file

d)

Inside the body tags of each document

15.

What will be the output of the following code snippet?
console.log(typeof null);

a)

object

b)

null

c)

undefined

d)

number

16.

Which of the following methods can be used to convert a string to a number in JavaScript?

a)

Number()

b)

parseFloat()

c)

parseInt()

d)

All of the above

17.

In JavaScript, which operator is used to compare both value and type?

a)

==

b)

===

c)

!=

d)

!==