Deck 12: Text Processing

Full screen (f)
exit full mode
Question
If the following pseudocode were an actual program,what would it display? ??Declare String str = "a1b2c3d4"?Declare Integer index?Declare Integer num = 0?For index = 0 To length(str)- 1? If isDigit(str[index])Then? Set num = num + 1? End If?End For?Display num

A)3
B)0
C)5
D)4
E)None of the above.
Use Space or
up arrow
down arrow
to flip the card.
Question
Which of the following pseudocode statements uses substring notation to display the first character in a String variable named city?

A)Display city[0]
B)Display city[length - 1]
C)Display city[1]
D)All of the above
E)None of the above
Question
If the following pseudocode were an actual program,what would it display? ??Declare String str = "a1b2c3d4"?Declare Integer index?For index = 0 To length(str)- 1? If isLetter(str[index])Then? Set str[index] = "+"? End If?End For?Display str

A)+1+2+3+4+
B)+1+2+3+4
C)1+2+3+4
D)a+b+c+d+
E)None of the above.
Question
The insert library module automatically expands the size of the string to accommodate the inserted characters.
Question
If the following pseudocode were an actual program,what would it display? ??Declare String str = "uvwxyz"?delete(str,0,0)?delete(str,0,0)
Delete(str,0,0)?Display str

A)vwxyz
B)wxyz
C)xyz
D)uvwxyz
E)None of the above.
Question
What is the output of the following pseudocode???Declare String str = "ABC"?Display str[1]

A)A
B)B
C)C
D)ABC
E)Nothing.This is an error.
Question
Assuming the following variable declaration,??Declare String str = "ABC"??which of the following pseudocode statements displays the last character in the string?

A)Display str[0]
B)Display str[3]
C)Display str[length(str)]
D)Display str[length(str)- 1]
E)None of the above.
Question
Assuming the following variable declaration,??Declare String str = "bot"??which of the following pseudocode statements changes the variable's contents to "robot"?

A)Set str[0] = "ro"
B)Set str = str + "ro"
C)insert(str, 0, "ro")
D)insert(str, length(str), "ro")
E)None of the above.
Question
Most programming languages do not allow access to the individual characters in a string.
Question
If the following pseudocode were an actual program,what would it display? ??Declare String str = "morning"?insert(str,0,"Good")?Display str

A)Good morning
B)Goodmorning
C)Good
D)morning
E)None of the above.
Question
Assuming the following variable declaration,??Declare String str = "Miami"??which of the following pseudocode statements changes the variable's contents to "Mia"?

A)delete(str, 3, length(str))
B)delete(str, 3, 4)
C)Set str = str - "mi"
D)Set str[0] = "Mia"
E)None of the above.
Question
The stringToReal library function accepts a Real value as an argument and returns the String equivalent of the value.
Question
Assuming the following variable declaration,??Declare String str = "1234AB C"??which of the following pseudocode expressions will return True?

A)isDigit(str[3])
B)isDigit(str[4])
C)isLetter(str[3])
D)isWhiteSpace(str[7])
E)None of the above.
Question
Which of the following programs work extensively with text?

A)Word processors
B)Test messaging programs
C)Email applications
D)All of the above
E)None of the above
Question
The isWhiteSpace library function returns True if its argument is displayed on the screen using a white background color.
Question
Some programming tasks require that you access and/or manipulate the individual characters in a string.
Question
Assuming that a variable named ocean has been initialized with the string "Atlantic",which of the following library functions would return the first character in the string?

A)length(ocean)
B)toUpper(ocean)
C)substring(ocean, 0, 0);
D)contains(ocean, "A");
E)None of the above
Question
The expression isDigit("9")returns True.
Question
The isUpper library function converts a character to uppercase.
Question
If the following pseudocode were an actual program,what would it display? ??Declare String str = "royal"?delete(str,0,length(str)- 3)?Display str

A)yal
B)roy
C)al
D)oya
E)None of the above.
Question
A ____________ character is a space,a tab,or a newline.
Question
In pseudocode you can use the _________ library function to determine whether a character is lowercase.
Question
In pseudocode you can use the _________ library module to delete specific characters from a string.
Question
Some programming languages allow you to access a character within a string using _________ notation.
Question
When using subscript notation in most programming languages,the subscript of the last character would be one less than the string's _________.
Question
In pseudocode you can use the _________ library function to determine whether a character is an alphabetic letter.
Question
In pseudocode you can use the _________ library function to determine whether a character is whitespace.
Question
When using a programming language that supports subscript notation,an error will occur if you use a subscript on an ____________ String variable.
Question
In pseudocode you can use the _________ library module to insert a string into another string.
Question
In pseudocode you can use the _________ library function to determine whether a character is uppercase.
Question
In pseudocode you can use the _________ library function to determine whether a character is a numeric digit.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/31
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 12: Text Processing
1
If the following pseudocode were an actual program,what would it display? ??Declare String str = "a1b2c3d4"?Declare Integer index?Declare Integer num = 0?For index = 0 To length(str)- 1? If isDigit(str[index])Then? Set num = num + 1? End If?End For?Display num

A)3
B)0
C)5
D)4
E)None of the above.
D
2
Which of the following pseudocode statements uses substring notation to display the first character in a String variable named city?

A)Display city[0]
B)Display city[length - 1]
C)Display city[1]
D)All of the above
E)None of the above
A
3
If the following pseudocode were an actual program,what would it display? ??Declare String str = "a1b2c3d4"?Declare Integer index?For index = 0 To length(str)- 1? If isLetter(str[index])Then? Set str[index] = "+"? End If?End For?Display str

A)+1+2+3+4+
B)+1+2+3+4
C)1+2+3+4
D)a+b+c+d+
E)None of the above.
B
4
The insert library module automatically expands the size of the string to accommodate the inserted characters.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
5
If the following pseudocode were an actual program,what would it display? ??Declare String str = "uvwxyz"?delete(str,0,0)?delete(str,0,0)
Delete(str,0,0)?Display str

A)vwxyz
B)wxyz
C)xyz
D)uvwxyz
E)None of the above.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
6
What is the output of the following pseudocode???Declare String str = "ABC"?Display str[1]

A)A
B)B
C)C
D)ABC
E)Nothing.This is an error.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
7
Assuming the following variable declaration,??Declare String str = "ABC"??which of the following pseudocode statements displays the last character in the string?

A)Display str[0]
B)Display str[3]
C)Display str[length(str)]
D)Display str[length(str)- 1]
E)None of the above.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
8
Assuming the following variable declaration,??Declare String str = "bot"??which of the following pseudocode statements changes the variable's contents to "robot"?

A)Set str[0] = "ro"
B)Set str = str + "ro"
C)insert(str, 0, "ro")
D)insert(str, length(str), "ro")
E)None of the above.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
9
Most programming languages do not allow access to the individual characters in a string.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
10
If the following pseudocode were an actual program,what would it display? ??Declare String str = "morning"?insert(str,0,"Good")?Display str

A)Good morning
B)Goodmorning
C)Good
D)morning
E)None of the above.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
11
Assuming the following variable declaration,??Declare String str = "Miami"??which of the following pseudocode statements changes the variable's contents to "Mia"?

A)delete(str, 3, length(str))
B)delete(str, 3, 4)
C)Set str = str - "mi"
D)Set str[0] = "Mia"
E)None of the above.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
12
The stringToReal library function accepts a Real value as an argument and returns the String equivalent of the value.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
13
Assuming the following variable declaration,??Declare String str = "1234AB C"??which of the following pseudocode expressions will return True?

A)isDigit(str[3])
B)isDigit(str[4])
C)isLetter(str[3])
D)isWhiteSpace(str[7])
E)None of the above.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
14
Which of the following programs work extensively with text?

A)Word processors
B)Test messaging programs
C)Email applications
D)All of the above
E)None of the above
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
15
The isWhiteSpace library function returns True if its argument is displayed on the screen using a white background color.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
16
Some programming tasks require that you access and/or manipulate the individual characters in a string.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
17
Assuming that a variable named ocean has been initialized with the string "Atlantic",which of the following library functions would return the first character in the string?

A)length(ocean)
B)toUpper(ocean)
C)substring(ocean, 0, 0);
D)contains(ocean, "A");
E)None of the above
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
18
The expression isDigit("9")returns True.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
19
The isUpper library function converts a character to uppercase.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
20
If the following pseudocode were an actual program,what would it display? ??Declare String str = "royal"?delete(str,0,length(str)- 3)?Display str

A)yal
B)roy
C)al
D)oya
E)None of the above.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
21
A ____________ character is a space,a tab,or a newline.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
22
In pseudocode you can use the _________ library function to determine whether a character is lowercase.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
23
In pseudocode you can use the _________ library module to delete specific characters from a string.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
24
Some programming languages allow you to access a character within a string using _________ notation.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
25
When using subscript notation in most programming languages,the subscript of the last character would be one less than the string's _________.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
26
In pseudocode you can use the _________ library function to determine whether a character is an alphabetic letter.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
27
In pseudocode you can use the _________ library function to determine whether a character is whitespace.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
28
When using a programming language that supports subscript notation,an error will occur if you use a subscript on an ____________ String variable.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
29
In pseudocode you can use the _________ library module to insert a string into another string.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
30
In pseudocode you can use the _________ library function to determine whether a character is uppercase.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
31
In pseudocode you can use the _________ library function to determine whether a character is a numeric digit.
Unlock Deck
Unlock for access to all 31 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 31 flashcards in this deck.