Quiz
Chapter 12 multiple choice
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (13)
1Which of the following pseudocode statements uses substring notation to display the first character in a String variable named city?
- AAll of the answers
- BNone of the answers
- CDisplay city[0]
- DDisplay city[length - 1]
- EDisplay city[1]
2If the str variable contains the string "Redmond", which pseudocode statement changes its contents to "Red"?
- Adelete(str, 3, length(str))
- Bdelete(str, 3, 6)
- CSet str = str - "mond"
- DSet str[0] = "Red"
3Which pseudocode statement displays the first character in the String variable str?
- ADisplay str[1]
- BDisplay str
- CDisplay str[first]
- DDisplay str[0]
4Ch12-MC 13: 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?
- Asubstring(ocean, 0, 0);
- Bcontains(ocean, "A");
- CNone of the answers
- DtoUpper(ocean)
- Elength(ocean)
5Assuming the following variable declaration, which of the following pseudocode statements displays the last character in the string?:
Declare String str = "ABC"- ADisplay str[length(str)]
- BDisplay str[length(str) - 1]
- CNone of the answers
- DDisplay str[3]
- EDisplay str[0]
6What is the output of the following pseudocode?
Declare String str = "ABC"
Display str[1]- AB
- BA
- CABC
- DNothing. This is an error.
- EC
7If the following pseudocode were an actual program what would it display?
Declare String str = "royal"
Delete(str, 0, length(str) - 3)
Display str- ANone of the answers
- Byal
- Cal
- Droy
- Eoya
8If 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- A5
- B3
- C4
- D0
- ENone of the answers
9 Assuming the following variable declaration, which of the following pseudocode statements changes the variable's contents to "robot"?
Declare String str = "bot"- ASet str[0] = "ro"
- Binsert(str, 0, "ro")
- CNone of the answers
- DSet str = str + "ro"
- Einsert(str, length(str), "ro")
10If the following pseudocode were an actual program what would it display?
Declare String str = "morning"
Insert(str, 0, "Good")
Display str- ANone of the answers
- BGood
- CGood morning
- DGoodmorning
- Emorning
11Which of the following programs work extensively with text?
- AAll of the answers
- BEmail applications
- CNone of the answers
- DWord processors
- EText messaging programs
12If 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- Awxyz
- Buvwxyz
- Cvwxyz
- DNone of the answers
- Exyz
13Assuming the following variable declaration, which of the following pseudocode expressions will return True?
Declare String str = "1234AB C"- ANone of the answers
- BisWhiteSpace(str[7])
- CisDigit(str[4])
- DisDigit(str[3])
- EisLetter(str[3])
Information
- Description
- Computer Science Quiz on Chapter 12 multiple choice, created by Naina Minhas on 10/12/2022.
- Author
- Naina Minhas
- Language
- English
- Views
- 0
- Tags
- Rating
- No ratings yet Rate this quiz