Solved

Case 1 You Have Just Starting Working at Quantum Company. as a Company

Question 46

Multiple Choice

Case 1

You have just starting working at Quantum Company. As a new programmer, you have been asked to review and correct various pseudocode.

-The following pseudocode checks if an item number is valid: start
Declarations
Num sub = 0
Num SIZE = 5
Num VALID_ITEM [5] = 27,53,84,89,95
String foundIt = "N"
Input item
While sub < SIZE
If item = VALID_ITEM[sub] then
FoundIt = "Y"
Endif
Sub = sub +1
Endwhile
If foundIt = "Y" then
Output "Valid item number"
Else
Output "Invalid item number"
Endif
Stop
Which while loop makes this more efficient?


A) while sub < SIZE AND foundIt = "N"
B) while sub < SIZE AND foundIt > "N"
C) while sub < SIZE AND foundIt = "Y"
D) The while loop is already efficient

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents