Deck 17: Fundamental Concepts Expressed in Javascript

Full screen (f)
exit full mode
Question
In programming, names for values are called variables .
Use Space or
up arrow
down arrow
to flip the card.
Question
The letter sequence that makes up a variable name is called a label .
Question
In JavaScript, variables must be declared at the top of the program .
Question
A JavaScript variable cannot be initialized in the same statement in which it is declared .
Question
In JavaScript strings must be enclosed in either single quotes (' . . . ') or double quotes (" . . . ") .
Question
The statement terminator in JavaScript is a colon (:) .
Question
The flow of an assignment statement is always right to left .
Question
Relational operators cannot be used on strings .
Question
The outcome of a relational expression is always either true or false .
Question
The <then-statement> of an if statement only executes when the predicate is true .
Question
When the <Boolean expression> of an if/else statement is false, the <else-statement> of the expression is executed .
Question
A correct solution to a programming problem is always an elegant solution .
Question
In JavaScript, all variables must be initialized immediately following their declarations .
Question
In programming the statement x = x + 1; makes no sense since no value can be the same as itself plus one .
Question
Programming languages

A) automate the process of writing a program
B) allow for only one possible solution to a problem
C) are written in English sentences
D) are precise
Question
Which of the following is a valid JavaScript variable name?

A) br549
B) Tax Rate
C) 37AB
D) 0123
Question
While specifics may vary from language to language, in general an identifier

A) must be made up only of letters
B) starts with two digits followed by an underscore and letters
C) cannot contain numbers, spaces, or special characters
D) starts with a letter and is followed by letters, numbers, or underscores
Question
In JavaScript the escape symbol is the

A) colon (:)
B) backslash (\)
C) slash (/)
D) semicolon (;)
Question
Which of the following is NOT a valid assignment statement, assuming length, width, and area are valid variables?

A) area = length * width;
B) area = 12345;
C) length * width = area;
D) area = "The area is 12,345 square feet . ";
Question
In JavaScript, the statement 17 % 5 results in

A) 3
B) 0 . 175
C) 3 . 4
D) 2
Question
In JavaScript an empty string

A) is not valid
B) is written as ""
C) is the same an an undefined value
D) contains a single space enclosed in double quotes
Question
In JavaScript a string constant or string literal

A) cannot be a number
B) is surrounded by quotes in the code
C) cannot include a tab character
D) is stored in memory with the surrounding quotes included
Question
Which of the following is NOT a JavaScript data type?

A) Booleans
B) numbers
C) strings
D) All of these are JavaScript data types .
Question
If the JavaScript variable myAge has the value 5, what will be the result of the following statement?
MyAge == 23;

A) an error will occur since this statement is not true
B) true
C) false
D) myAge will be updated to have the value 23
Question
What is the result of the following expression, assuming B = 5 and D = 3?
(B != D) || (B > D)

A) false
B) (5 != 3) is not the same as (5 > 3)
C) true
D)None of these, relational and logical operators cannot be combined in one expression .
Question
What is the value of the variable result after the following statements execute?
FirstName = "Martha";
LastName = "Jones";
Result = firstName + lastName;

A) Martha Jones
B) MarthaJones
C) Martha + Jones
D) None of these; you cannot add two strings .
Question
What is the value of the variable result after the following statements execute?
Age = 23;
Name = "Howard";
If (age >= 23 && name == "Johnny")
Result = "At last! I found you, "+ name;
Else
Result = "Sorry, "+name+" . You're not my long lost cousin . ";

A) At last! I found you, Howard
B) Sorry, Howard . You're not my long lost cousin .
C) At last! I found you, Johnny
D) Sorry, Johnny . You're not my long lost cousin .
Question
What is the value of the variable result after the following statements execute?
Card_1 = 10;
Card_2 = 11;
If (card_1 + card_2 == 21)
Result = "You win! Your score is "+ (card_1 + card_2);
Else
Result = "Sorry, You lose . Score is "+ (card_1 + card_2);

A) You win! Your score is 10 + 11
B) You win! Your score is 21
C) Sorry, You lose . Score is + 10 + 11
D) Sorry, You lose . Score is 21
Question
Select all that apply . In JavaScript the + sign represents

A) addition or string concatenation, depending on the values it is used with
B) addition
C) string concatenation
D) None of these
Question
Select all that apply . Which of the following are valid variable declarations?

A) myName = "Snoopy";
B) var myName = 23;
C) var x;
D) var 1stName;
Question
Select all that apply . Which of the following are examples of JavaScript expressions?

A) var myName = "Joey";
B)a * (b + c) / d
C) length = 14;
D) 3 . 14 * radius * radius
Question
Select all that apply . Which of the following are relational expressions?

A) A && B || C && D
B) A < B
C) A * B >= C * D
D) C != C
Question
________ is a programming language used for web applications .
Question
In programming a(n) ________ is used to change the value of a variable .
Question
The JavaScript declaration command used to create a variable is the keyword ________ .
Question
The angle brackets (< >) used to describe the syntax of a programming command are called ________ .
Question
The single equals sign (=) in JavaScript indicates a(n) ________ of a value to a variable .
Question
The double equals operator (==) asks the question, "is this value ________ another value?"
Question
The logical AND operator is denoted by ________ .
Question
A(n) ________ value is a sequence of keyboard characters surrounded by single or double quotes . .
Question
The letter sequence that makes up a variable's name is called the ________ .
Question
________ is the act of formulating an algorithm or program .
Question
________ are memory locations in the computer .
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/43
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 17: Fundamental Concepts Expressed in Javascript
1
In programming, names for values are called variables .
True
2
The letter sequence that makes up a variable name is called a label .
False
3
In JavaScript, variables must be declared at the top of the program .
False
4
A JavaScript variable cannot be initialized in the same statement in which it is declared .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
5
In JavaScript strings must be enclosed in either single quotes (' . . . ') or double quotes (" . . . ") .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
6
The statement terminator in JavaScript is a colon (:) .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
7
The flow of an assignment statement is always right to left .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
8
Relational operators cannot be used on strings .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
9
The outcome of a relational expression is always either true or false .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
10
The <then-statement> of an if statement only executes when the predicate is true .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
11
When the <Boolean expression> of an if/else statement is false, the <else-statement> of the expression is executed .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
12
A correct solution to a programming problem is always an elegant solution .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
13
In JavaScript, all variables must be initialized immediately following their declarations .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
14
In programming the statement x = x + 1; makes no sense since no value can be the same as itself plus one .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
15
Programming languages

A) automate the process of writing a program
B) allow for only one possible solution to a problem
C) are written in English sentences
D) are precise
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
16
Which of the following is a valid JavaScript variable name?

A) br549
B) Tax Rate
C) 37AB
D) 0123
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
17
While specifics may vary from language to language, in general an identifier

A) must be made up only of letters
B) starts with two digits followed by an underscore and letters
C) cannot contain numbers, spaces, or special characters
D) starts with a letter and is followed by letters, numbers, or underscores
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
18
In JavaScript the escape symbol is the

A) colon (:)
B) backslash (\)
C) slash (/)
D) semicolon (;)
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
19
Which of the following is NOT a valid assignment statement, assuming length, width, and area are valid variables?

A) area = length * width;
B) area = 12345;
C) length * width = area;
D) area = "The area is 12,345 square feet . ";
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
20
In JavaScript, the statement 17 % 5 results in

A) 3
B) 0 . 175
C) 3 . 4
D) 2
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
21
In JavaScript an empty string

A) is not valid
B) is written as ""
C) is the same an an undefined value
D) contains a single space enclosed in double quotes
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
22
In JavaScript a string constant or string literal

A) cannot be a number
B) is surrounded by quotes in the code
C) cannot include a tab character
D) is stored in memory with the surrounding quotes included
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following is NOT a JavaScript data type?

A) Booleans
B) numbers
C) strings
D) All of these are JavaScript data types .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
24
If the JavaScript variable myAge has the value 5, what will be the result of the following statement?
MyAge == 23;

A) an error will occur since this statement is not true
B) true
C) false
D) myAge will be updated to have the value 23
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
25
What is the result of the following expression, assuming B = 5 and D = 3?
(B != D) || (B > D)

A) false
B) (5 != 3) is not the same as (5 > 3)
C) true
D)None of these, relational and logical operators cannot be combined in one expression .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
26
What is the value of the variable result after the following statements execute?
FirstName = "Martha";
LastName = "Jones";
Result = firstName + lastName;

A) Martha Jones
B) MarthaJones
C) Martha + Jones
D) None of these; you cannot add two strings .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
27
What is the value of the variable result after the following statements execute?
Age = 23;
Name = "Howard";
If (age >= 23 && name == "Johnny")
Result = "At last! I found you, "+ name;
Else
Result = "Sorry, "+name+" . You're not my long lost cousin . ";

A) At last! I found you, Howard
B) Sorry, Howard . You're not my long lost cousin .
C) At last! I found you, Johnny
D) Sorry, Johnny . You're not my long lost cousin .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
28
What is the value of the variable result after the following statements execute?
Card_1 = 10;
Card_2 = 11;
If (card_1 + card_2 == 21)
Result = "You win! Your score is "+ (card_1 + card_2);
Else
Result = "Sorry, You lose . Score is "+ (card_1 + card_2);

A) You win! Your score is 10 + 11
B) You win! Your score is 21
C) Sorry, You lose . Score is + 10 + 11
D) Sorry, You lose . Score is 21
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
29
Select all that apply . In JavaScript the + sign represents

A) addition or string concatenation, depending on the values it is used with
B) addition
C) string concatenation
D) None of these
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
30
Select all that apply . Which of the following are valid variable declarations?

A) myName = "Snoopy";
B) var myName = 23;
C) var x;
D) var 1stName;
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
31
Select all that apply . Which of the following are examples of JavaScript expressions?

A) var myName = "Joey";
B)a * (b + c) / d
C) length = 14;
D) 3 . 14 * radius * radius
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
32
Select all that apply . Which of the following are relational expressions?

A) A && B || C && D
B) A < B
C) A * B >= C * D
D) C != C
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
33
________ is a programming language used for web applications .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
34
In programming a(n) ________ is used to change the value of a variable .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
35
The JavaScript declaration command used to create a variable is the keyword ________ .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
36
The angle brackets (< >) used to describe the syntax of a programming command are called ________ .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
37
The single equals sign (=) in JavaScript indicates a(n) ________ of a value to a variable .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
38
The double equals operator (==) asks the question, "is this value ________ another value?"
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
39
The logical AND operator is denoted by ________ .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
40
A(n) ________ value is a sequence of keyboard characters surrounded by single or double quotes . .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
41
The letter sequence that makes up a variable's name is called the ________ .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
42
________ is the act of formulating an algorithm or program .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
43
________ are memory locations in the computer .
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 43 flashcards in this deck.