GoConqr has a new look! Let us know what you think.

Quiz

Chapter 12 multiple choice

Naina Minhas 13 questions

Take the quiz

Questions in this quiz (13)

  1. 1Which of the following pseudocode statements uses substring notation to display the first character in a String variable named city?
    1. AAll of the answers
    2. BNone of the answers
    3. CDisplay city[0]
    4. DDisplay city[length - 1]
    5. EDisplay city[1]
  2. 2If the str variable contains the string "Redmond", which pseudocode statement changes its contents to "Red"?
    1. Adelete(str, 3, length(str))
    2. Bdelete(str, 3, 6)
    3. CSet str = str - "mond"
    4. DSet str[0] = "Red"
  3. 3Which pseudocode statement displays the first character in the String variable str?
    1. ADisplay str[1]
    2. BDisplay str
    3. CDisplay str[first]
    4. DDisplay str[0]
  4. 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?
    1. Asubstring(ocean, 0, 0);
    2. Bcontains(ocean, "A");
    3. CNone of the answers
    4. DtoUpper(ocean)
    5. Elength(ocean)
  5. 5Assuming the following variable declaration, which of the following pseudocode statements displays the last character in the string?:
    Declare String str = "ABC"
    1. ADisplay str[length(str)]
    2. BDisplay str[length(str) - 1]
    3. CNone of the answers
    4. DDisplay str[3]
    5. EDisplay str[0]
  6. 6What is the output of the following pseudocode?
    Declare String str = "ABC"
    Display str[1]
    1. AB
    2. BA
    3. CABC
    4. DNothing. This is an error.
    5. EC
  7. 7If the following pseudocode were an actual program what would it display?
    Declare String str = "royal"
    Delete(str, 0, length(str) - 3)
    Display str
    1. ANone of the answers
    2. Byal
    3. Cal
    4. Droy
    5. Eoya
  8. 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
    1. A5
    2. B3
    3. C4
    4. D0
    5. ENone of the answers
  9. 9 Assuming the following variable declaration, which of the following pseudocode statements changes the variable's contents to "robot"?
    Declare String str = "bot"
    1. ASet str[0] = "ro"
    2. Binsert(str, 0, "ro")
    3. CNone of the answers
    4. DSet str = str + "ro"
    5. Einsert(str, length(str), "ro")
  10. 10If the following pseudocode were an actual program what would it display?
    Declare String str = "morning"
    Insert(str, 0, "Good")
    Display str
    1. ANone of the answers
    2. BGood
    3. CGood morning
    4. DGoodmorning
    5. Emorning

Information

Description
Computer Science Quiz on Chapter 12 multiple choice, created by Naina Minhas on 10/12/2022.
Language
English
Views
0
Tags
computer science
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?