Understanding Arrays and Loops in JavaScript

Quiz
•
Information Technology (IT)
•
11th Grade
•
Hard
Tiffany Hale
Used 4+ times
FREE Resource
7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the index of the first element in an array in most programming languages?
1
0
-1
2
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In JavaScript, which method is used to add an element to the end of an array?
add()
append()
push()
insert()
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Consider the following JavaScript code: `var numbers = [1, 2, 3, 4]; console.log(numbers[4]);`. What will be the output?
4
3
undefined
Error
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following statements correctly initializes an empty array in JavaScript?
`var myArray = {};`
`var myArray = [];`
`var myArray = new Object();`
`var myArray = new Array();`
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the result of the following JavaScript expression: `'5' == 5`?
true
false
undefined
Error
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Given the array `var fruits = ['apple', 'banana', 'cherry'];`, write a JavaScript `for` loop to print each fruit in the array.
`for (var i = 0; i < fruits.length; i++) { console.log(fruits[i]); }`
`for (var i = 1; i <= fruits.length; i++) { console.log(fruits[i]); }`
`for (var i = 0; i <= fruits.length; i++) { console.log(fruits[i]); }`
`for (var i = 1; i < fruits.length; i++) { console.log(fruits[i]); }`
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following operators is used to check strict equality in JavaScript?
==
===
!=
!==
Similar Resources on Wayground
8 questions
Intro to JS: Functions, Scope & Objects

Quiz
•
11th Grade - University
12 questions
Aula07 - Matrizes

Quiz
•
University
10 questions
Web 3.4-3.5 Quiz

Quiz
•
11th Grade
10 questions
Web Development Quiz

Quiz
•
9th - 12th Grade
10 questions
General ExpressJS Quiz

Quiz
•
University
8 questions
Intro to JS: JS and the Browser

Quiz
•
11th Grade
8 questions
3TDS - Programação Backend - Aula 12

Quiz
•
12th Grade
8 questions
Javascript Intro Parte II

Quiz
•
12th Grade
Popular Resources on Wayground
50 questions
Trivia 7/25

Quiz
•
12th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
11 questions
Negative Exponents

Quiz
•
7th - 8th Grade
12 questions
Exponent Expressions

Quiz
•
6th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade
20 questions
One Step Equations All Operations

Quiz
•
6th - 7th Grade
18 questions
"A Quilt of a Country"

Quiz
•
9th Grade