# 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: 343
Questions: 17 | Attempts: 343

Settings

This quiz will test your knowledge of JavaScript.

Good Luck!
-Ron

• 1.

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

• A.

Array

• B.

Function

• C.

Object

• D.

Method

A. Array
Explanation
An array is a special variable which can hold more than one value at a time.

Rate this question:

• 2.

### Var = myName is an example of a

• A.

Variable

• B.

String

• C.

Object

• D.

Method

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

Rate this question:

• 3.

### Select which of the options below are data types

• A.

Number

• B.

String

• C.

Function

• D.

Boolean

A. Number
B. String
D. Boolean
Explanation
The three data types are number, string and Boolean.

Rate this question:

• 4.

### I++

• A.

Incrementor

• B.

Operator

• C.

Iterator

• D.

Decrementor

A. Incrementor
Explanation
Incrementors/Decrementors are used to increase/reduce the value of a variable by 1

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

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

Rate this question:

• 6.

### is an example of a

• A.

Method

• B.

Object

• C.

Function

• D.

Variable

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

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

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

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

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

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

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.

Rate this question:

• 10.

### is an example of

• A.

If statement

• B.

If...Else Statement

• C.

Switch Statement

• D.

Ternary Operator

D. Ternary Operator
Explanation
Ternary operators are a shorthand way of writing if else statements.

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

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:

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

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:

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

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:

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

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.

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

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.

Rate this question:

• 16.

### is an example of a:

• A.

Method

• B.

Variable

• C.

Object

• D.

Function

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.

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

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)

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

Related Topics