JAVASCRIPT MIDTERM STUDY
QUESTIONS & ANSWERS
Keywords - ANSWER-Terms in a programming language that are reserved for
special purposes by the programming language.
The three most common data types are: - ANSWER-numbers, strings,
boolean
Variables - ANSWER-Program data is stored at locations in memory while a
program is running. The data value stored in a variable can then be used,
and modified, by referencing its name.
Names can only contain - ANSWER-letters, numbers, underscores, and dollar
signs..
Names can only begin with - ANSWER-a letter, underscore, or dollar sign.
(generally, they always start with a letter)
Can not have the same name as a - ANSWER-JavaScript keyword
Spaces are - ANSWER-not allowed in variable names
Variable names should be - ANSWER-descriptive of the data they will
store.
Use camel case for variable names with - ANSWER-multiple words in the
name:
Operators - ANSWER-Operators are used to modify or compare data.
An operator is simply a symbol or word that is used to evaluate data in a
similar manner as common math.
There are 6 types of operators - ANSWER-Assignment Mathematical
(Arithmetic) Comparison Logical Bitwise Special
The Direct Assignment Operator (=) - ANSWER-The Direct Assignment
Operator (=)
Assignment operators are used to assign a value to a JavaScript variable.
, Constants - ANSWER-A constant is similar to a variable except that the value
doesn't change during program execution, it remains constant. A constant is
just a variable in JavaScript.
Mathematical Operators - ANSWER-The Mathematical operators are the
symbols used to add, subtract, multiply, and divide numbers in JavaScript.
Expressions - ANSWER-Expressions evaluate to values
Any piece of code that produces a value is an expression
What is a program statement? - ANSWER-It is an individual instruction for the
computer to process
the if statement - ANSWER-A selection control structure evaluates a
condition, which is an expression that's true or false. This allows the program
to choose between different courses of action.
Comparison Operators - ANSWER-Comparison Operators evaluate two values
as equal or different (the same, less-than or greater-than). They operate the
same way as relational operators in math.
The while loop - ANSWER-The repetition control structure, a loop, is a code
block that is executed one or more times
Comments - ANSWER-// and /* */
The JavaScript Console. It allows developers to: - ANSWER-Interactively
execute JavaScript on a
command line.
○ Log JavaScript messages and output that are
not visible outside of the console.
○ Troubleshoot, test, and debug code.
○ It is not part of JavaScript. It is provided as
part of the JavaScript runtime environment. In our case, the browser.
Language Level: Low-Level - ANSWER-Closest to machine language
Language Level: Lower Mid-Level - ANSWER-Human readable but able to
write at the machine level if necessary - slightly more abstracted from the
machine level.
Memory efficient Programmer still has to code mostly by hand
QUESTIONS & ANSWERS
Keywords - ANSWER-Terms in a programming language that are reserved for
special purposes by the programming language.
The three most common data types are: - ANSWER-numbers, strings,
boolean
Variables - ANSWER-Program data is stored at locations in memory while a
program is running. The data value stored in a variable can then be used,
and modified, by referencing its name.
Names can only contain - ANSWER-letters, numbers, underscores, and dollar
signs..
Names can only begin with - ANSWER-a letter, underscore, or dollar sign.
(generally, they always start with a letter)
Can not have the same name as a - ANSWER-JavaScript keyword
Spaces are - ANSWER-not allowed in variable names
Variable names should be - ANSWER-descriptive of the data they will
store.
Use camel case for variable names with - ANSWER-multiple words in the
name:
Operators - ANSWER-Operators are used to modify or compare data.
An operator is simply a symbol or word that is used to evaluate data in a
similar manner as common math.
There are 6 types of operators - ANSWER-Assignment Mathematical
(Arithmetic) Comparison Logical Bitwise Special
The Direct Assignment Operator (=) - ANSWER-The Direct Assignment
Operator (=)
Assignment operators are used to assign a value to a JavaScript variable.
, Constants - ANSWER-A constant is similar to a variable except that the value
doesn't change during program execution, it remains constant. A constant is
just a variable in JavaScript.
Mathematical Operators - ANSWER-The Mathematical operators are the
symbols used to add, subtract, multiply, and divide numbers in JavaScript.
Expressions - ANSWER-Expressions evaluate to values
Any piece of code that produces a value is an expression
What is a program statement? - ANSWER-It is an individual instruction for the
computer to process
the if statement - ANSWER-A selection control structure evaluates a
condition, which is an expression that's true or false. This allows the program
to choose between different courses of action.
Comparison Operators - ANSWER-Comparison Operators evaluate two values
as equal or different (the same, less-than or greater-than). They operate the
same way as relational operators in math.
The while loop - ANSWER-The repetition control structure, a loop, is a code
block that is executed one or more times
Comments - ANSWER-// and /* */
The JavaScript Console. It allows developers to: - ANSWER-Interactively
execute JavaScript on a
command line.
○ Log JavaScript messages and output that are
not visible outside of the console.
○ Troubleshoot, test, and debug code.
○ It is not part of JavaScript. It is provided as
part of the JavaScript runtime environment. In our case, the browser.
Language Level: Low-Level - ANSWER-Closest to machine language
Language Level: Lower Mid-Level - ANSWER-Human readable but able to
write at the machine level if necessary - slightly more abstracted from the
machine level.
Memory efficient Programmer still has to code mostly by hand