Search Header Logo

JS-Exam

Authored by Dr Admin

Professional Development

Professional Development

Used 13+ times

JS-Exam
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

56 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

1.Given the following code:

document.body.addEventListener(‘ click ’, (event) => {

if (/* CODE REPLACEMENT HERE */) { console.log(‘button clicked!’); )

});

Which replacement for the conditional statement on line 02 allows a developer to correctly determine that a button on page is clicked?

Event.clicked

e.nodeTarget ==this

event.target.nodeName == ‘BUTTON’

button.addEventListener(‘click’)

2.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

function Tiger() {

this.Type = 'Cat';

this.size = 'large';

}

let tony = new Tiger();

tony.roar = () => { console.log('Theyre great1'); };

function Lion() {

this.type = 'Cat';

this.size = 'large';

}

17  //Insert code here

18// leo.roar();

Which two statements could be inserted at line 17 to enable the function call on line 18? Choose 2 answers.

leo.roar = () => { console.log(‘They\’re pretty good:’); };

Object.assign(leo,Tiger);

Object.assign(leo,tony);

Leo.prototype.roar = () => { console.log(‘They\’re pretty good:’); };

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

4. Consider type coercion, what does the following expression evaluate to?

True + 3 + ‘100’ + null

104

4100

‘3100null’

‘4100null’

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

// 5. Refer to the code below

const pi = 3.1415326;

// What is the data type of pi?

Double

Number

Decimal

Float

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

// 7. Which statement parses successfully?

JSON. parse ('"foo"')

JSON.parse (""foo'")

JSON.parse ("foo");

JSON.parse ("foo");

6.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

10. Given two expressions var1 and var2. What are two valid ways to return the logical AND of the two expressions and ensure it is data type Boolean? Choose 2 answers:

Boolean(var1 && var2)

var1 && var2

var1.toBoolean() && var2toBoolean()

Boolean(var1) && Boolean(var2)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

11. A developer has an ErrorHandler module that contains multiple functions. What kind of export leverages so that multiple functions can be used?

Named

All

Multi

Default

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?