Given an array of integers of length 7 called INTEGERS, the following pseudocode has been written to output the two biggest integers it contains. The algorithm should handle both negative and positive values as well as repeated values.
biggestNumber = INTEGERS secondBiggestNumber = INTEGERS if biggestNumber < secondBiggestNumber biggestNumber = INTEGERS secondBiggestNumber = INTEGERS end if loop x from 2 to 6 num = INTEGERS[x] if num > biggestNumber INSERT_CODE_HERE biggestNumber = num else if num > secondBiggestNumber secondBiggestNumber = num end if end loop
Choose the pseudocode snippet below to replace "INSERT_CODE_HERE" in order to have the above procedure function correctly.
secondBiggestNumber = biggestNumber
secondBiggestNumber = INTEGERS[x+1]
secondBiggestNumber = INTEGERS[x]
x = x + 1
Multiple Choice1 MarkPremium
31 Uses44 Views2 Likes
Login or Create an Account to view the mark scheme, comment, and add to a test