NYC Codecademy Group - JavaScript Quiz

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Ronantopolski
R
Ronantopolski
Community Contributor
Quizzes Created: 1 | Total Attempts: 352
Questions: 17 | Attempts: 352

SettingsSettingsSettings
JavaScript Quizzes & Trivia

This quiz will test your knowledge of JavaScript.

Good Luck!
-Ron


Questions and Answers
  • 1. 

    Var numbers = [1, 2, 3] is an example of:

    • A.

      Array

    • B.

      Function

    • C.

      Object

    • D.

      Method

    Correct Answer
    A. Array
    Explanation
    An array is a special variable which can hold more than one value at a time.
    See Codecademy lesson

    Rate this question:

  • 2. 

    Var = myName is an example of a

    • A.

      Variable

    • B.

      String

    • C.

      Object

    • D.

      Method

    Correct Answer
    A. Variable
    Explanation
    variables are used to hold values or expressions

    See Codecademy lesson

    Rate this question:

  • 3. 

    Select which of the options below are data types

    • A.

      Number

    • B.

      String

    • C.

      Function

    • D.

      Boolean

    Correct Answer(s)
    A. Number
    B. String
    D. Boolean
    Explanation
    The three data types are number, string and Boolean.

    See Codecademy lesson

    Rate this question:

  • 4. 

    I++

    • A.

      Incrementor

    • B.

      Operator

    • C.

      Iterator

    • D.

      Decrementor

    Correct Answer
    A. Incrementor
    Explanation
    Incrementors/Decrementors are used to increase/reduce the value of a variable by 1
    See Codecademy lesson

    Rate this question:

  • 5. 

    Var i; for (i = 0; i < 2; i++) {   console.log("i is now equal to " + i);

    • A.

      Function

    • B.

      Object

    • C.

      For Loop

    • D.

      While Loop

    Correct Answer
    C. For Loop
    Explanation
    In JavaScript, there are two different kind of loops:
    for - loops through a block of code a specified number of times
    while - loops through a block of code while a specified condition is true
    See Codecademy lesson

    Rate this question:

  • 6. 

    is an example of a

    • A.

      Method

    • B.

      Object

    • C.

      Function

    • D.

      Variable

    Correct Answer
    C. Function
    Explanation
    A function contains code that will be executed by an event or by a call to the function.

    See Codecademy lesson:

    Rate this question:

  • 7. 

    Var i = 0; while ( i < 2 ) {   console.log( "i is now " + i );   i++; }

    • A.

      While Loop

    • B.

      Incrementor

    • C.

      For Loop

    • D.

      Function

    Correct Answer
    A. While Loop
    Explanation
    In JavaScript, there are two different kind of loops:

    for - loops through a block of code a specified number of times
    while - loops through a block of code while a specified condition is true

    See Codecademy lesson

    Rate this question:

  • 8. 

    if (name.length > 0) { console.log("Please enter your name."); } else { console.log("Hello " + name); } is an example of:

    • A.

      If Statement

    • B.

      If...Else Statement

    • C.

      Else If Statement

    • D.

      Switch Statement

    Correct Answer
    B. If...Else Statement
    Explanation
    If the condition (name.length>0) is true, statement1 will be executed. Otherwise, statement2 will be executed.
    See Codecademy lesson

    Rate this question:

  • 9. 

    switch (GPA){ case 90: letterGrade = "A+"; break; case 80: letterGrade = "A"; break; case 70: letterGrade = "C"; break; case 60: letterGrade = "D"; break; case 50: letterGrade = "E"; break; default: letterGrade = "F"; break; }

    • A.

      If...Else Statement

    • B.

      Ternary Operator

    • C.

      Else If Statement

    • D.

      Switch Statement

    Correct Answer
    D. Switch Statement
    Explanation
    Switch statements are a shorthand way to write if else statements when there are many different cases, and each case has a different outcome.
    See Codecademy lesson

    Rate this question:

  • 10. 

    is an example of

    • A.

      If statement

    • B.

      If...Else Statement

    • C.

      Switch Statement

    • D.

      Ternary Operator

    Correct Answer
    D. Ternary Operator
    Explanation
    Ternary operators are a shorthand way of writing if else statements.
    See Codecademy lesson

    Rate this question:

  • 11. 

    For the object below, what does the word 'name' represent? var dog = {name: "Daisy", age: 6};

    • A.

      Property

    • B.

      Variable

    • C.

      Value

    • D.

      String

    Correct Answer
    A. Property
    Explanation
    In this object, 'name' is a property. A property is a type of information that describes the object and is always paired with a value.
    Objects can written in two different ways, depending on how the properties are defined within them:

    1. Object Literal Notation:


    2. Object Constructor Notation



    In addition to representing properties in two different ways when creating an object, you can also access properties two different ways:

    1. Dot Notation


    2. Bracket Notation:



    See Codecademy lesson

    Rate this question:

  • 12. 

    Var dog = (); dog.name = "Daisy"; dog.age = 6; is an example of creating an object using:

    • A.

      Object Literal Notation

    • B.

      Object Constructor Notation

    • C.

      Dot Notation

    • D.

      Bracket Notation

    Correct Answer
    B. Object Constructor Notation
    Explanation
    Objects can written in two different ways, depending on how the properties are defined within them:

    1. Object Literal Notation:


    2. Object Constructor Notation



    In addition to representing properties in two different ways when creating an object, you can also access properties two different ways:

    1. Dot Notation


    2. Bracket Notation:



    See Codecademy lesson

    Rate this question:

  • 13. 

    is an example of creating an object using:

    • A.

      Dot Notation

    • B.

      Object Literal Notation

    • C.

      Bracket Notation

    • D.

      Object Constructor Notation

    Correct Answer
    B. Object Literal Notation
    Explanation
    Objects can written in two different ways, depending on how the properties are defined within them:

    1. Object Literal Notation:


    2. Object Constructor Notation



    In addition to representing properties in two different ways when creating an object, you can also access properties two different ways:

    1. Dot Notation


    2. Bracket Notation:



    See Codecademy lesson

    Rate this question:

  • 14. 

    Var dogName = dog.name is an example of accessing an object's property using:

    • A.

      Dot Notation

    • B.

      Bracket Notation

    • C.

      Object Literal Notation

    • D.

      Object Constructor Notation

    Correct Answer
    A. Dot Notation
    Explanation
    When you access a property, you are setting a variable equal to the the value of a property in a particular object.

    In this example, we are setting variable dogName equal to the value of the 'name' property of the 'dog' object.

    See Codecademy lesson

    Rate this question:

  • 15. 

    is an example of accessing an object's property using:

    • A.

      Object Literal Notation

    • B.

      Bracket Notation

    • C.

      Dot Notation

    • D.

      Object Literal Notation

    Correct Answer
    B. Bracket Notation
    Explanation
    When you access a property, you are setting a variable equal to the the value of a property in a particular object.

    In this example, we are setting variable dogName equal to the value of the 'name' property of the 'dog' object.

    See Codecademy lesson

    Rate this question:

  • 16. 

    is an example of a:

    • A.

      Method

    • B.

      Variable

    • C.

      Object

    • D.

      Function

    Correct Answer
    D. Function
    Explanation
    A function contains code that will be executed by an event or by a call to the function. In this case, we would call the function by writing a command: hello(); which would display the text "i am saying hello" in the console.

    See Codecademy lesson

    Rate this question:

  • 17. 

    In the function below, what does the text '(w, l)' represent? var area = function (w, l) {   return w * l; };

    • A.

      Variables

    • B.

      Parameters

    • C.

      Strings

    • D.

      Object

    Correct Answer
    B. Parameters
    Explanation
    A parameter is a variable that is processed by the function to generate a given result. In this case, if we run the function as follows: area(2,3); we will get a result of 6. To further clarify, parameters are the variables in the declaration of a function (w,l) while arguments are the specific values that get passed when running the function (2,3)

    See Codecademy lesson

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Jun 02, 2012
    Quiz Created by
    Ronantopolski
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.