Javascript Basics Quiz Review

Javascript Basics Quiz Review

12th Grade

15 Qs

quiz-placeholder

Similar activities

CodeHS JavaScript Control Functions

CodeHS JavaScript Control Functions

9th - 12th Grade

20 Qs

JavaScript and Graphics

JavaScript and Graphics

9th - 12th Grade

15 Qs

P5.js Variables and Conditional Statements

P5.js Variables and Conditional Statements

9th - 12th Grade

15 Qs

JavaScript Control Structures

JavaScript Control Structures

9th - 12th Grade

20 Qs

JavaScript and Graphics Quiz

JavaScript and Graphics Quiz

9th - 12th Grade

15 Qs

JavaScript Variable

JavaScript Variable

9th - 12th Grade

15 Qs

CodeHS Test

CodeHS Test

9th - 12th Grade

15 Qs

JavaScript Graphics

JavaScript Graphics

9th - 12th Grade

10 Qs

Javascript Basics Quiz Review

Javascript Basics Quiz Review

Assessment

Quiz

Computers

12th Grade

Hard

Created by

Katy Fleming

Used 6+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

If we want to generate a random number where 5 is the smallest number possible and 10 is the largest number possible, which line of code would be correct?

let rand = Randomizer.nextInt(5, 10);

let rand = Randomizer.nextInt(5, 11);

let rand = Randomizer.nextInt(4, 11);

let rand = Randomizer.nextInt(4, 10);

2.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

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;

3.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

What would be the correct way to name a function that tells us the day of the week?

function dayofweek() {

...

}

function day_of_week() {

...

}

function DayOfWeek() {

...

}

function dayOfWeek() {

...

}

Answer explanation

Good job! We use the camel case naming convention in JavaScript functions. Therefore the first letter of the first word is lower case and the first letter of the following words should be upper case.

4.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

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)

  1. console.log(distance / (time / 60));

console.log(distance / time);

  1. console.log(distance (time 60));

  1. console.log(distance * time);

5.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Which of the following is part of the navigator’s role in pair-programming?

  1. defining all of the functions

  1. focusing on the task at hand

  1. thinking of alternative ways to solve the problem

  1. initializing the variables

Answer explanation

Good job! It is the driver’s job to type out all of the code. The navigator’s job includes thinking of alternative, more efficient ways to solve the problem.

6.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

Media Image

What is the output of the following program: (Assume the user enters ‘Florence’ then ‘Fernandez’.)

  1. Fernandez Florence

  1. Florence
    Fernandez

  1. FlorenceFernandez

  1. Florence Fernandez

Answer explanation

Good job! We didn’t include a space between the first and last name in our wholeName variable or in the console.log command. Be careful when concatenating strings and make sure to double-check your spaces!

7.

MULTIPLE CHOICE QUESTION

2 mins • 1 pt

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;

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?