Deck 8: Manipulating Data in Strings and Arrays
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/41
Play
Full screen (f)
Deck 8: Manipulating Data in Strings and Arrays
1
Regular expression patterns in JavaScript must begin and end with backward slashes.
False
2
Characters contained in a set of parentheses within a regular expression are referred to as a subexpression or ____.
A) subpattern
B) substring
C) subrule
D) subset
A) subpattern
B) substring
C) subrule
D) subset
A
3
The JavaScript String class includes the ____ method, which creates a new string by combining strings that are passed as arguments.
A) strcpy()
B) strcat()
C) strpst()
D) concat()
A) strcpy()
B) strcat()
C) strpst()
D) concat()
D
4
The fromCharCode()method is called a ____ method because it is not used as a method of any string objects (which can be literal strings or variables)in your scripts.
A) local
B) static
C) global
D) dynamic
A) local
B) static
C) global
D) dynamic
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
5
The ____ method converts a text string to uppercase.
A) toUpperCase()
B) toMaxCase()
C) toHigherCase()
D) toTitleCase()
A) toUpperCase()
B) toMaxCase()
C) toHigherCase()
D) toTitleCase()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
6
The length property counts escape sequences such as \n as two characters.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
7
The replace()method is case sensitive.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
8
The ____ method returns the position number in a string of the first instance of the first character in the pattern argument.
A) charAt( pattern )
B) indexOf( pattern )
C) slice( pattern )
D) search( pattern )
A) charAt( pattern )
B) indexOf( pattern )
C) slice( pattern )
D) search( pattern )
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
9
You use ____ classes in regular expressions to treat multiple characters as a single item.
A) expression
B) character
C) pattern
D) metarule
A) expression
B) character
C) pattern
D) metarule
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
10
To manipulate arrays in your scripts, you use the methods and length property of the ____ class.
A) Array
B) String
C) Matrix
D) Vector
A) Array
B) String
C) Matrix
D) Vector
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
11
To convert a JSON string to a JavaScript object, you use the parse()method of the JSON object.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
12
A pattern that matches the beginning or end of a line is called a(n)____.
A) tail
B) metacharacter
C) metastring
D) anchor
A) tail
B) metacharacter
C) metastring
D) anchor
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
13
To allow a string to contain an alternate set of substrings, you separate the strings in a regular expression pattern with the ____ metacharacter.
A) $
B) /
C) |
D) &
A) $
B) /
C) |
D) &
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
14
Regular expression patterns consist of literal characters and ____.
A) metacharacters
B) metadata
C) metabytes
D) supercharacters
A) metacharacters
B) metadata
C) metabytes
D) supercharacters
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
15
The String class ____ property returns the number of characters in a string.
A) elements
B) size
C) length
D) maxIndex
A) elements
B) size
C) length
D) maxIndex
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
16
You can use a text string as a literal value or assign it to a variable.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
17
The ____ method of the String class returns the position number in a string of the first character in the argument.
A) search()
B) charAt()
C) indexOf()
D) substring()
A) search()
B) charAt()
C) indexOf()
D) substring()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
18
The ____ object contains methods and properties for working with regular expressions in JavaScript.
A) Expression
B) RegExp
C) StrExp
D) StringExp
A) Expression
B) RegExp
C) StrExp
D) StringExp
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
19
The ____ method constructs a text string from Unicode character codes that are passed as arguments.
A) fromCharCode()
B) fromUniCode()
C) fromLangCode()
D) fromStrCode()
A) fromCharCode()
B) fromUniCode()
C) fromLangCode()
D) fromStrCode()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
20
The ____ method converts a text string to lowercase.
A) toMinCase()
B) lowerCase()
C) toLowerCase()
D) toUpperCase()
A) toMinCase()
B) lowerCase()
C) toLowerCase()
D) toUpperCase()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
21
All literal strings and string variables in JavaScript are represented by a(n)____________________ class, which contains methods for manipulating text strings.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
22
Match between columns
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
23
The ____ method adds one or more elements to the end of an array.
A) pop()
B) push()
C) shift()
D) unshift()
A) pop()
B) push()
C) shift()
D) unshift()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
24
To sort elements of an array alphabetically, you use the ____ method.
A) arrange()
B) order()
C) list()
D) sort()
A) arrange()
B) order()
C) list()
D) sort()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
25
To convert a JavaScript object to a JSON string, you use the ____ method.
A) convertToString()
B)json()
C)parse()
D)stringify()
A) convertToString()
B)json()
C)parse()
D)stringify()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
26
List and describe three metacharacters that you can use with JavaScript regular expressions.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
27
What are the toString()and toLocaleString()methods used for, and what is the difference between them?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
28
The ____________________ method of the String class creates a new string with the first instance of a specified pattern replaced with the value of the text argument.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
29
When applied to text strings, the term ____________________ refers to the act of extracting characters or substrings from a larger string.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
30
The ____ method removes and returns the first element from the beginning of an array.
A) split()
B) unshift()
C) shift()
D) slice()
A) split()
B) unshift()
C) shift()
D) slice()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
31
You use the ____ method of the String class to split a string into an indexed array.
A) toArray()
B) slice()
C) split()
D) shift()
A) toArray()
B) slice()
C) split()
D) shift()
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
32
Provide two different regular expressions that return true only when tested against a string consisting of exactly 5 characters.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
33
Explain how to change the case of a variable's valueusing the toLowerCase() or toUpperCase()method.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
34
Explain the difference between the shift()and unshift()methods of the Array object.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
35
_________________________ are patterns that are used for matching and manipulating strings according to specified rules.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
36
__________ is a data format that represents a JavaScript object as a string.
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
37
What is the primary difference between the search()method and the indexOf()method?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
38
How can you combine text strings with JavaScript?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
39
How can you match any metacharacters as literal values in a regular expression?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
40
What is the difference between the slice()and substring()methods?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck
41
How do you create a character class with JavaScript?
Unlock Deck
Unlock for access to all 41 flashcards in this deck.
Unlock Deck
k this deck