2) JavaScript - Programming Fundamentals (Checkpoints 11-17)

Description

Quiz on 2) JavaScript - Programming Fundamentals (Checkpoints 11-17), created by Sanny Lin on 24/03/2016.
Sanny Lin
Quiz by Sanny Lin, updated more than 1 year ago
Sanny Lin
Created by Sanny Lin about 8 years ago
26
1

Resource summary

Question 1

Question
What is (6 * 4 + 7) % 3?
Answer
  • 1
  • 3
  • 10
  • 28

Question 2

Question
Which string will throw an error?
Answer
  • '"The best preparation for tomorrow is doing your best today.'"
  • "I believe in living today.\nNot in yesterday, nor in tomorrow."
  • "Nothing is impossible, the word itself says 'I'm possible'!"
  • 'Believe you can and you\'re halfway there.'

Question 3

Question
True or false: 10 % 3 == true
Answer
  • True
  • False

Question 4

Question
True or false: (22 - 6 * 2) % 5 === false
Answer
  • True
  • False

Question 5

Question
What is the default value of a variable that is not initialized with a value? e.g. `var myVar;` instead of `var myVar = 6;`
Answer
  • undefined
  • null
  • 0
  • false

Question 6

Question
function double(x) { return x * 2; } var x = 7; double(5); What is the value of `x` after the above code executes?
Answer
  • 2
  • 5
  • 7
  • 14

Question 7

Question
var banana = { color: ""yellow"" } In the above object, `color` is known as a __________. (select all that apply)
Answer
  • property
  • tag
  • key
  • value

Question 8

Question
Which methods *add* elements to an array? (select all that apply)
Answer
  • push()
  • unshift()
  • pop()
  • shift()

Question 9

Question
We use a `for` loop when...
Answer
  • we know the exact number of times to execute a block of code
  • we want to iterate through all enumerable properties
  • we don't know how many times to execute a block of code
  • we want to iterate through all numbered properties

Question 10

Question
Select the correct example of a `for` loop header:
Answer
  • (var k = 33; k >= 23; k--)
  • (var i = 0, i < 8, i++)
  • (x = 0; x == 10; x++)
  • (i = 10, i > 1, i - 1)

Question 11

Question
What does this loop do? var array = [3, 4, 6, 23, 23, 9]; var number = 0; for (var i = 0; i < array.length; i++) { if (array[i] > number) { number = array[i]; } } console.log(number);​
Answer
  • It finds the largest number in the array
  • It finds the smallest number in the array
  • It does nothing; there is an error in the code
  • It finds if a number occurs more than once in the array
Show full summary Hide full summary

Similar

Plate Tectonics
eimearkelly3
Food Technology - Functions of ingredients
evie.daines
Geography Coasts Questions
becky_e
AQA GCSE Biology B1 unit 1
Olivia Phillips
STEM AND LEAF DIAGRAMS
Elliot O'Leary
AQA AS Biology Unit 2 DNA and Meiosis
elliedee
Biology (B2)
anjumn10
The Digestive system
Elena Cade
IGCSE Chemistry Revision
sachakoeppen
Highway Code Road Signs for Driving Test
Sarah Egan
Get your grammar right!
Sarah Holmes