A store has 20 apples in its inventory. How can you store this information in a JavaScript
variable?
let numApples == 20;
20 = numApples;
let numApples = 20;
let num apples = 20; - Answers let numApples = 20;
You want to read input from the user to know how many apples they would like to buy. Which
statement should you use to read in a number from the user?
let applesToBuy = readLine("How many apples would you like? ");
let applesToBuy = console.log("How many apples would you like? ");
let applesToBuy = readInt("How many apples would you like? ");
let applesToBuy = nextInt("How many apples would you like? "); - Answers let applesToBuy =
readInt("How many apples would you like? ");
You are splitting up all of your apples equally between 3 people. Which statement below will
calculate how many apples will be left over?
let leftOver = numApples / 3;
let leftOver = 3 / numApples;
let leftOver = numApples % 3;
let leftOver = 3 % numApples; - Answers let leftOver = numApples % 3;
What is the output of the following program: (Assume the user enters 'Florence' then
'Fernandez'.)
let firstName = readLine("What is your first name? ");
, let lastName = readLine("What is your last name? ");
let wholeName = firstName + lastName;
console.log(wholeName);
Fernandez Florence
Florence
Fernandez
FlorenceFernandez
Florence Fernandez - Answers FlorenceFernandez
Which of the following choices is a properly formed JavaScript variable name, meaning it is both
legal in the JavaScript language and considered good style?
user_age
UserAge
userAge
User age - Answers userAge
If you were given the following variables:
let distance = 2; let time = 30;
What line of code would print the speed in km/hr if the distance is given in km and the time is
given in minutes? (Speed = distance / time)