Question: Quiz Question 1 (1 point) What will the array contain after the following code is executed? const list = ['item1', 'item2', 'item3'] list.unshift('newItem') Question 1
Quiz
Question 1 (1 point)
What will the array contain after the following code is executed?
const list = ['item1', 'item2', 'item3']
list.unshift('newItem')
Question 1 options:
|
| ['item2', 'item3'] |
|
| ['item1', 'item2'] |
|
| ['item1', 'item2', 'item3', 'newItem'] |
|
| ['newItem', 'item1', 'item2', 'item3'] |
Question 2 (1 point)
How would you access 'item2' from the following array?
const list = ['item1', 'item2', 'item3', 'item4']
Question 2 options:
|
| list[2] |
|
| list[1] |
|
| list[3] |
|
| list[4] |
Question 3 (1 point)
Which of the following is an array?
Question 3 options:
|
| const list = {'A', 'B', 'C'} |
|
| const list = 'A', 'B', 'C' |
|
| const list = ['A', 'B', 'C'] |
|
| const list = ('A', 'B', 'C') |
Question 4 (1 point)
What (if anything) will be displayed in the console after the following code is executed?
const list = ['item1', 'item2', 'item3']
console.log(list.join('-'))
Question 4 options:
|
| 'item1,item2,item3' |
|
| This code will not execute. |
|
| 'item1-item2-item3' |
|
| 'item1item2item3' |
Question 5 (1 point)
What will the array contain after the following code is executed?
const list = ['item1', 'item2', 'item3', 'item4']
list.splice(1, 1)
Question 5 options:
|
| ['item1', 'item3', 'item4'] |
|
| ['item2', 'item3', 'item4'] |
|
| ['item1', 'item4'] |
|
| [] |
Question 6 (1 point)
What (if anything) will be displayed in the console after the following code is executed?
const list = ['item1', 'item2', 'item3']
console.log(list.join())
Question 6 options:
|
| 'item1,item2,item3' |
|
| 'item1item2item3' |
|
| 'item1-item2-item3' |
|
| This code will not execute. |
Question 7 (1 point)
What (if anything) will be displayed in the console after the following code is executed?
const list = ['item1', 'item2', 'item3']
const newList = ['newItem']
console.log(list.concat(newList, newList))
Question 7 options:
|
| ['item1', 'item2', 'item3', 'newItem', 'newItem'] |
|
| ['item1', 'item2', 'item3'] |
|
| This code will not execute. |
|
| ['item1', 'item2', 'item3', 'newItem'] |
Question 8 (1 point)
What will the array contain after the following code is executed?
const list = ['item1', 'item2']
list.push('newItem')
Question 8 options:
|
| ['newItem', 'item1', 'item2'] |
|
| ['item1', 'item2', 'newItem'] |
|
| ['item1', 'newItem'] |
|
| ['newItem', 'item2'] |
Question 9 (1 point)
What will be displayed in the console after this code is executed?
const list = ['item1', 'item2', 'item3', 'item4']
console.log(list[4])
Question 9 options:
|
| undefined |
|
| item4 |
|
| item5 |
|
| item3 |
Question 10 (1 point)
What will be displayed in the console after this code is executed?
const list = ['item1', 'item2', 'item3', 'item4']
console.log(list[2])
Question 10 options:
|
| item1 |
|
| item3 |
|
| item2 |
|
| item4 |
Question 11 (1 point)
Which of the following is an array?
Question 11 options:
|
| const list = [0: 10, 1: 20, 2: 30] |
|
| const list = {10, 20, 30} |
|
| const list = [10, 20, 30] |
|
| const list = {0: 10, 1: 20, 2: 30} |
Question 12 (1 point)
Arrays are most appropriate for storing which type of data?
Question 12 options:
|
| Sets of elements. |
|
| Value/key pairs. |
|
| A number. |
|
| Key/value pairs. |
Question 13 (1 point)
Arrays are most appropriate for storing which type of data?
Question 13 options:
|
| Sets of key/value pairs. |
|
| Single numbers. |
|
| Lists of values. |
|
| Single values. |
Question 14 (1 point)
What will the array contain after the following code is executed?
const list = ['item1', 'item2', 'item3']
list.pop()
Question 14 options:
|
| ['item1', 'item3'] |
|
| ['item1', 'item2'] |
|
| [] |
|
| ['item2', 'item3'] |
Question 15 (1 point)
Saved
What will the array contain after the following code is executed?
const list = ['item1', 'item2', 'item3']
list.shift()
Question 15 options:
|
| ['item1', 'item2'] |
|
| [] |
|
| ['item2', 'item3'] |
|
| ['item1'] |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
