16. Program B displays one more value than program A. umber of values, but the values wordList. A student wrote the following program to remove all occurrences of the strings "the" and "a" from the list Line 1: index LENGTH (wordList) Line 2: REPEAT UNTIL (index < 1) Line 3: { Line 4: Line 5: Line 6: Line 7: Line 8: } IF ((WordList[index] = "the") OR (wordList[index] = "a")) { } REMOVE (wordList, index) While debugging the program, the student realizes that the loop never terminates. Which of the following changes can be made so that the program works as intended? (A) Inserting index (B) Inserting index (C) Inserting index (D) Inserting index index + 1 between lines 6 and 7 index + 1 between lines 7 and 8 index - 1 between lines 6 and 7 index - 1 between lines 7 and 8

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Please show work for both problems and how you got the answer!!
16.
(A)
(B)
Which of the following best compares the values displayed by programs A and B
(A) Program A and program B display identical values in the same order.
(B)
Program A and program B display the same values in different orders.
Program A and program B display the same number of values, but the values differ.
Program B displays one more value than program A.
(C)
(D)
wordList.
A student wrote the following program to remove all occurrences of the strings "the" and "a" from the list
IF ((wordList[index]
{
(A) Inserting index
Inserting index
(B)
(C) Inserting index
(D) Inserting index
DISPLAY
}
Line 1: index + LENGTH (wordList)
Line 2: REPEAT UNTIL (index < 1)
Line 3: {
Line 4:
Line 5:
Line 6:
Line 7:
Line 8: }
While debugging the program, the student realizes that the loop never terminates. Which of the following changes
can be made so that the program works as intended?
= "the") OR (wordList[index] = "a"))
REMOVE (wordList, index)
-
index + 1 between lines 6 and 7
between lines 7 and 8
index + 1
index 1
index 1 between lines 7 and 8
between lines 6 and 7
Which of the following can be represented by a sequence of bits? -
I.
An integer
II. An alphanumeric character
III. A machine language instruction
I only
III only
J
m
1
k
alt
Transcribed Image Text:16. (A) (B) Which of the following best compares the values displayed by programs A and B (A) Program A and program B display identical values in the same order. (B) Program A and program B display the same values in different orders. Program A and program B display the same number of values, but the values differ. Program B displays one more value than program A. (C) (D) wordList. A student wrote the following program to remove all occurrences of the strings "the" and "a" from the list IF ((wordList[index] { (A) Inserting index Inserting index (B) (C) Inserting index (D) Inserting index DISPLAY } Line 1: index + LENGTH (wordList) Line 2: REPEAT UNTIL (index < 1) Line 3: { Line 4: Line 5: Line 6: Line 7: Line 8: } While debugging the program, the student realizes that the loop never terminates. Which of the following changes can be made so that the program works as intended? = "the") OR (wordList[index] = "a")) REMOVE (wordList, index) - index + 1 between lines 6 and 7 between lines 7 and 8 index + 1 index 1 index 1 between lines 7 and 8 between lines 6 and 7 Which of the following can be represented by a sequence of bits? - I. An integer II. An alphanumeric character III. A machine language instruction I only III only J m 1 k alt
14.
which of the following CANNOT be determined from the
(A) The total number of books borrowed in a given year
(B)
The total number of books that were never borrowed in a given year
(C)
(D)
The total number of books that were returned past their due date in a given year
The total number of people who borrowed at least one book in a given year
The following algorithm is intended to take a positive integer as input and display its individual digits in order from
right to left. For example, if the input is 512, the algorithm should produce the output 2 1 5. Step 3 of the
algorithm is missing.
number 30.S
Step 1: Input a positive integer from the user and store it in the variable number.
Step 2: Divide number by 10 and record the integer quotient and the remainder. The integer quotient is the quotient
with any part after the decimal point dropped. For example, when 127 is divided by 10, the quotient is 12.7, the
integer quotient is 12 and the remainder is 7.
number =
52 51 95 56
Step 3: (missing step)
Step 4: Repeat steps 2 and 3 until number is 0. 215 512710 = 51.2
v: 15
B
Which of the following can be used as step 3 so that the algorithm works as intended?
(A) Step 3: Display the remainder of the number divided by 10
(B) Step 3: Display the remainder of the number divided
and store the remainder in number.
10 and store the integer quotient in number.
Step 3: Display the integer quotient of the number divided by 10 and store the remainder in number.
Step 3: Display the integer quotient of the number divided by 10 and store the integer quotient in number.
Transcribed Image Text:14. which of the following CANNOT be determined from the (A) The total number of books borrowed in a given year (B) The total number of books that were never borrowed in a given year (C) (D) The total number of books that were returned past their due date in a given year The total number of people who borrowed at least one book in a given year The following algorithm is intended to take a positive integer as input and display its individual digits in order from right to left. For example, if the input is 512, the algorithm should produce the output 2 1 5. Step 3 of the algorithm is missing. number 30.S Step 1: Input a positive integer from the user and store it in the variable number. Step 2: Divide number by 10 and record the integer quotient and the remainder. The integer quotient is the quotient with any part after the decimal point dropped. For example, when 127 is divided by 10, the quotient is 12.7, the integer quotient is 12 and the remainder is 7. number = 52 51 95 56 Step 3: (missing step) Step 4: Repeat steps 2 and 3 until number is 0. 215 512710 = 51.2 v: 15 B Which of the following can be used as step 3 so that the algorithm works as intended? (A) Step 3: Display the remainder of the number divided by 10 (B) Step 3: Display the remainder of the number divided and store the remainder in number. 10 and store the integer quotient in number. Step 3: Display the integer quotient of the number divided by 10 and store the remainder in number. Step 3: Display the integer quotient of the number divided by 10 and store the integer quotient in number.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY