The querySelector() method returns the first element that matches a specified CSS selector(s) in the document.

 

Group of answer choices

True

False
 
Flag question: Question 2
Question 26.9 pts
_________ event handler invokes when the mouse clicks on an element.
Group of answer choices

onmouseover

onclick

onmouseleave

onmousedown
 
Flag question: Question 3
Question 36.9 pts
Modern JavaScript is a “safe” programming language. It does not provide low-level access to memory or CPU, because it was initially created for browsers which do not require it.

 

True or False?

Group of answer choices

True

False
 
Flag question: Question 4
Question 46.9 pts
We can use the ___________ method of the Document object, which returns a collection of all elements in the document with the specified tag name as a NodeList object
Group of answer choices

getElementsByTagName()

getElementsByID()

getElementsByHtml()

getElementsByClass()
 
Flag question: Question 5
Question 56.9 pts
What is the console output of the following JavaScript code?

let arr = [1, 2, 3, 4, 5, ];
arr.forEach(function(value, index, array) {
    array[index] = value * value
});
console.log(arr.reverse().filter(function(x) {
    return x % 5
}));
Group of answer choices

[16, 9, 4, 1]

[25, 16, 9, 4, 1]

[4, 3, 2, 1]

Error
 
Flag question: Question 6
Question 66.9 pts
What is the console output of the following JavaScript code?

let a = "Per Scholas";

let x = a.lastIndexOf("l");
console.log(x);
Group of answer choices

7

8

6

Error
 
Flag question: Question 7
Question 76.9 pts
What is the console output of the following JavaScript code?
let a = "Per Scholas";
let result = a.substring(4, 5);

console.log(result);
Group of answer choices

M

Me

s

S
 
Flag question: Question 8
Question 86.9 pts
What is the console output of the following JavaScript code?

let date = new Date("Thu Jan 29 2009 17:31:44");
let now = new Date("2019-01-24 18:31:44");

console.log(now.getMonth() === date.getMonth());
Group of answer choices

True

False

1

Jan
 
Flag question: Question 9
Question 96.9 pts
What is the console output of the following JavaScript code?

let person = {
    firstName: "John",
    lastName: "Doe",
    age: 50,
    eyeColor: "blue"
};

for (let i in person) {
    console.log(i);
}
Group of answer choices

"ﬁrstName" "lastName" "age" "eyeColor"

"John" "Doe" 50 "blue"

undeﬁned undeﬁned undeﬁned undeﬁned
 
Flag question: Question 10
Question 106.9 pts
What are 2 ways of registering an event listener? (Select all that apply)
Group of answer choices

Using an inline event handler like onClick="myEventListener()"

Add an button listener to the html tag

use "addEventListener" to register the event handler

Add prototypes using HTML tag
 
Flag question: Question 11
Question 116.9 pts
What is the console output of the following JavaScript code?

console.log("Hello" - " World");

Group of answer choices

NaN

"Hello" + " World"

Error

Hello World
 
Flag question: Question 12
Question 126.9 pts
What is the correct syntax for adding comments in JavaScript?
Group of answer choices

//This is a comment

<!–This is a comment–&gt

–This is a comment

**This is a comment**
 
Flag question: Question 13
Question 136.9 pts
What is one diﬀerence between the Array.slice() and the Array.splice() methods in JavaScript?
Group of answer choices

The Array.splice() changes the original array whereas Array.slice() does not

The Array.slice() changes the original array whereas Array.splice() does not .

The Array.slice() returns all elements of the array starting at the indicated index until the end of the array, whereas the Array.splice() returns all elements of the array starting at the beginning of the array until the indicated index.

The Array.splice() returns all elements of the array starting at the indicated index until the end of the array, whereas the Array.slice() returns all elements of the array starting at the beginning of the array until the indicated index.
 
Flag question: Question 14
Question 146.9 pts
What does a number data type represent in JavaScript?
Group of answer choices

integers and ﬂoats

integers only

ﬂoats only

none of the mentioned
 
Flag question: Question 15
Question 156.9 pts
Which function of an Array object calls a function for every element in the array?
Group of answer choices

forEach()

forEvery()

callForEach()

callForEvery
 
Flag question: Question 16
Question 166.9 pts
What is the console output of the following JavaScript code?

var name = "Per Scholas";
var name = "JavaScript";

console.log(name);
Group of answer choices

JavaScript

Per Scholas

Error

name
 
Flag question: Question 17
Question 176.9 pts
What is the console output of the following JavaScript code?

let name = "Per Scholas";
let name = "JavaScript";

console.log(name);
Group of answer choices

Error

Per Scholas

JavaScript

name
 
Flag question: Question 18
Question 186.9 pts
What is the console output of the following JavaScript code?

a = 8 + "8";
console.log(a);
Group of answer choices

88

Run Time Error

Compilation Error

16
 
Flag question: Question 19
Question 196.9 pts
What is the console output of the following JavaScript code?

numbers = "12345";
for (let i = 0; i < 5; i++) {
    if (numbers[i] == 3) {
        continue;
    }
    console.log(numbers[i]);
}
Group of answer choices

1 2 4 5

1 2

1 2 3 4 5

5
 
Flag question: Question 20
Question 206.9 pts
What is JavaScript?

 

In Strongly typed languages once a type is assigned to a variable - say at run time or compile time, it retains that type and can’t be intermingled in expressions with other types easily.

In Weakly typed languages, once a type is assigned to a variable - say at run-time or compile-time, it can be intermingled in expressions with other types easily.

Group of answer choices

A high-level and weakly typed scripting programming language

A high-level and strongly typed compiled programming language

A low-level and strongly typed compiled programming language

A low-level and weakly typed compiled programming language
 
Flag question: Question 21
Question 216.9 pts
What is the console output of the following JavaScript code?

console.log("Hello" + " World");

 

Group of answer choices

Hello World

NaN

"Hello" + " World"

Error
 
Flag question: Question 22
Question 226.9 pts
What is the console output of the following JavaScript code?

numbers = "12345";
for (let i = 0; i < 5; i++) {
    if (numbers[i] == 3) {
        break;
    }
    console.log(numbers[i]);
}
Group of answer choices

1 2

1 2 4 5

1 2 3 4 5

5
 
Flag question: Question 23
Question 236.9 pts
In a dynamic Web app, elements and text are often added with JavaScript. The _______  and _______ methods are used to create new nodes or elements and content in the DOM. (Select all that apply)
Group of answer choices

createElement()

new Paragraph()

doument.Element()

createTextNode()
 
Flag question: Question 24
Question 246.9 pts
What will be the result of the following statement in Javascript? (True / False)

8 === "8"

Group of answer choices

True

False
 
Flag question: Question 25
Question 256.9 pts
What is the correct syntax for referring to an external script called “script.js”?
Group of answer choices

<script src="script.js">

<script href="script.js">

<script ref="script.js">

<script name="script.js">
 
Flag question: Question 26
Question 266.9 pts
Which of the following is the correct syntax to display “Hello JS!” in an alert box using JavaScript?
Group of answer choices

alert("Hello JS!");

alertbox(“Hello JS!”);

msg(“Hello JS!”);

msgbox(“Hello JS!”);
 
Flag question: Question 27
Question 276.9 pts
Which of the following pieces of Javascript code would display "true" if a variable "i" is not equal to 5?
Group of answer choices

console.log(i!=5);

var x = function () {

    if (i != 5) {

        x = true

    } else {

        x = false

    }

};

console.log(x());


console.log(function () {

    if (i != 5) {

        return true

    } else {

        return false

    }

});


var x = function () {

    if (i === 5) {

        return true

    } else {

        return false

    }

};

console.log(x());

 
Flag question: Question 28
Question 286.9 pts
What is the console output of the following JavaScript code?

let x = 5;
let y = 6;
let res = ("x*y");

console.log(res);
Group of answer choices

x*y

"x*y"

5*6

Error
 
Flag question: Question 29
Question 296.9 pts
The external JavaScript ﬁle must contain HTML tags. True or False?
Group of answer choices

True

False