Menu

1. What is the result of the following?   const ingredients = [‘eggs’, ‘flour’, ‘chocolate’]; const poppedIngredient = ingredients.pop(); console.log(ingredients); What is the result of the following…

Question

Answered step-by-step

1. What is the result of the following? const ingredients =…

1. What is the result of the following?

 

const ingredients = [‘eggs’, ‘flour’, ‘chocolate’];

const poppedIngredient = ingredients.pop();

console.log(ingredients);

What is the result of the following?

const ingredients = [‘eggs’, ‘flour’, ‘chocolate’];

const poppedIngredient = ingredients.pop();

console.log(ingredients);

 

A) [‘eggs’]

 

B) [‘eggs’, ‘flour’]

 

C) [‘chocolate’]

 

D) [‘flour’, ‘chocolate’]

 

 

2. Values that evaluate to true are known as what? 

 

A) null

 

B) truthy

 

C) correct

 

D) valid

 

 

3. What scope can be used anywhere in the entire program?

 

A) variable

 

B) const

 

C) constant

 

D) global

 

 

4. What method of JavaScript arrays can be used to add one or more elements to the end of an array?

 

A) length

 

B) pop

 

C) pull

 

D) push

 

 

5. What is the output of the following? 

 

let lateToWork = true;

let oppositeValue = !lateToWork;

 

console.log(oppositeValue); 

 

A) true

 

B) undefined

 

C) false

 

D) null

 

 

6. What is the output of the following? 

 

const size = 10;

 

if (size > 100) {

  console.log(‘Big’);

} else if (size > 20) {

  console.log(‘Medium’);

} else if (size > 4) {

  console.log(‘Small’);

} else {

  console.log(‘Tiny’);

}

 

A) Medium

 

B) Small

 

C) Big

 

D) Tiny

 

 

7. What is the programming tool that is used to repeat a set of instructions?

 

a) again

 

B) “do” again

 

C) repeat again

 

D) loop

 

 

8. What is the result of the following?

 

const myArray = [100, 200, 300];

 

console.log(myArray[1]); 

 

A) 100

 

B) 0

 

C) 1

 

D) 200

 

 

9. What would be the result of the following? 

 

let message = ‘good nite’;

console.log(message.length);

 

A) 9

 

B) good nite length

 

C) good nite

 

D) message

 

 

10. What primitive data type is either true or false? 

 

A) boolean

 

B) string

 

C) variable

 

D) arithmetic operators

 

 

11. What is the syntax for a function expression does not require the function keyword?

A) (){

var;

};

 

B) .method;

 

C) var[];

 

D) =>

 

 

12. What is the concept that refers to where values and functions can be accessed?

 

A) retrieve 

 

B) scope

 

C) global

 

D) values

 

 

13. What is the result of the following? 

 

function sum(num1, num2) {

  return num1 + num2;

}

 

sum(3, 6);

 

A) 36

 

B) 18

 

C) 3+6

 

D) 9

 

 

14. What would be the output of the following?

 

for (let i = 0; i < 99; i += 1) {

  if (i > 5) {

     break;

  }

  console.log(i)

}

 

A) 0 99 1 5

 

B) 0 1 2 3 4 5

 

C) 0 5 99

 

D) 0 1 2 3 4 5 6 7 8 9

10 11 12 13 14 15 16 17 18 19

20 21 22 23 24 25 26 27 28 29

30 31 32 33 34 35 36 37 38 39

40 41 42 43 44 45 46 47 48 49

50 51 52 53 54 55 56 57 58 59

60 61 62 63 64 65 66 67 68 69

70 71 72 73 74 75 76 77 78 79

80 81 82 83 84 85 86 87 88 89

90 91 92 93 94 95 96 97 98 99

 

 

15. Array elements are arranged by what values that start at 0?

 

A) blank

 

B) index

 

C) undefined

 

D) null

 

 

16. What would be the result of the following? 

 

let number = 100;

 

number = number + 10;

number += 10;

 

console.log(number);

 

A) 1001010

 

B) 100

 

C) 120

 

D) 20

 

 

17. What would be the output of the following? 

 

for (let i = 0; i < 4; i += 1) {

  console.log(i);

};

 

A) 1, 2, 3, 4

 

B) 0, 1, 2, 3

 

C) 0, 4

 

D) 0, 4, 1

 

 

18. Which of the following are lists of ordered, stored data?

 

A) variables

 

B) loops

 

C) arrays

 

D) objects

 

 

19. What is the result of the following?

 

const numbers = [1, 2, 3, 4];

 

console.log(numbers.length);

 

A) 4

 

B) 10

 

C) 1234

 

D) 3

 

 

20. What would the values of the array change to?

 

const names = [‘Alice’, ‘Bob’];

 

names.push(‘Carl’);

 

 

A) [ ‘Carl’, ‘Alice’, ‘Bob’]

 

B) [‘Carl’]

 

C) [‘Bob’, ‘Carl’]

 

D) [‘Alice’, ‘Bob’, ‘Carl’]

 

OR

Leave a Reply

Your email address will not be published. Required fields are marked *