Understanding the Mastery Test
The Mastery Test for Unit 6 Lesson 3.2 on Code.org evaluates your understanding of the following key programming concepts:

- Constants and Variables
- Data Types
- Arithmetic Operators
- Input and Output
Tips for Success:
- Review the Lesson: Carefully go through the materials from Unit 6 Lesson 3.2, taking notes and practicing the concepts.
- Understand the Concepts: Make sure you thoroughly grasp the concepts of constants, variables, data types, arithmetic operators, and input/output.
- Practice with Code: Write and execute code snippets to reinforce your understanding of these concepts.
- Study Sample Questions: Utilize the provided sample questions to familiarize yourself with the types of questions you will encounter on the Mastery Test.
Questions and Answers:
Question 1: What is the difference between a constant and a variable?
Answer: A constant’s value cannot be changed during the execution of a program, while a variable’s value can be modified.
Question 2: Name the different data types used in JavaScript.
Answer: JavaScript uses the following data types: Boolean, null, undefined, number, string, BigInt, symbol, and object.
Question 3: What is the result of the arithmetic expression 5 + 10 * 2?
Answer: 25
Question 4: Write a code snippet to prompt the user for their name and display it in the console.
Answer:
const input = prompt("What is your name?");
console.log("Hello, " + input + "!");
Question 5: What is the purpose of the parseInt()
function?
Answer: The parseInt()
function converts a string representation of an integer into an integer value.
Table 1: Data Types in JavaScript
Data Type | Description |
---|---|
Boolean | Represents true or false |
null | Represents an empty or null value |
undefined | Represents a value that has not been assigned |
number | Represents numerical values |
string | Represents sequences of characters |
BigInt | Represents integers with arbitrary precision |
symbol | Represents unique and immutable values |
object | Represents complex data structures |
Table 2: Arithmetic Operators in JavaScript
Operator | Description |
---|---|
+ | Addition |
– | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus (remainder) |
** | Exponentiation |
Table 3: Input and Output Functions in JavaScript
Function | Description |
---|---|
prompt() |
Prompts the user for input and returns a string |
console.log() |
Prints a value to the console |
alert() |
Displays a message to the user |
Troubleshooting Tips:
- If you encounter errors, carefully review your code for syntax errors or logical mistakes.
- Utilize the JavaScript console in your browser for debugging purposes.
- Seek assistance from the Code.org community or online forums if needed.
Creative Application Ideas:
Engage in Real-World Applications:
- Use constants and variables to store important information, such as names, addresses, or account balances.
- Employ arithmetic operators to perform calculations, such as computing discounts, calculating interest, or finding averages.
- Create interactive programs that accept user input and provide tailored responses.
Innovate with Imaginative Concepts:
- Design a program that generates random numbers and challenges users to guess the correct number.
- Develop a simple budgeting application that allows users to track their expenses and income.
- Imagine a game that uses input and output functions to create a virtual dialogue between the player and a non-player character.