Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case. A student wrote the following code for a guessing game. Line 1: secretNumber RANDOM (1, 100) Line 2: win ← false Line 3: REPEAT UNTIL (win) Line 4: ( Line 5: DISPLAY ("Guess a number.") Line 6: guess INPUT ( ) Line 7: IF (guess = secretNumber) Line 8: ( Line 9: DISPLAY ("You got it right!") Line 10: } Line 11: Line 12: Line 13: ( ELSE IF (guess > secretNumber) Line 14: ( Line 15: DISPLAY ("Your guess is too high.") Line 16: } Line 17: ELSE Line 18: ( Line 19: DISPLAY ("Your guess is too low.") Line 20: } Line 21: } Line 22: } While debugging the code, the student realizes that the loop never terminates. The student plans to insert the instruction win true somewhere in the code. Where could win true be inserted so that the code segment works as intended? Between line 6 and line 7 Between line 9 and line 10 Between line 20 and 21 Between line 21 and 22
Directions: The question or incomplete statement below is followed by four suggested answers or completions. Select the one that is best in each case. A student wrote the following code for a guessing game. Line 1: secretNumber RANDOM (1, 100) Line 2: win ← false Line 3: REPEAT UNTIL (win) Line 4: ( Line 5: DISPLAY ("Guess a number.") Line 6: guess INPUT ( ) Line 7: IF (guess = secretNumber) Line 8: ( Line 9: DISPLAY ("You got it right!") Line 10: } Line 11: Line 12: Line 13: ( ELSE IF (guess > secretNumber) Line 14: ( Line 15: DISPLAY ("Your guess is too high.") Line 16: } Line 17: ELSE Line 18: ( Line 19: DISPLAY ("Your guess is too low.") Line 20: } Line 21: } Line 22: } While debugging the code, the student realizes that the loop never terminates. The student plans to insert the instruction win true somewhere in the code. Where could win true be inserted so that the code segment works as intended? Between line 6 and line 7 Between line 9 and line 10 Between line 20 and 21 Between line 21 and 22
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education