Skip to the content.
Home Notes Replit Create Task Code Snippets Test Corrections Study Plan Test 3 Corrections Quiz 5 Corrections Documentation

Quiz 3 Corrections

Score: 41/50

image

An undecidable problem is one for which no algorithm can be constructed that is always capable of providing a correct yes-or-no answer. Some instances of an undecidable problem may have an algorithmic solution, but there is no algorithmic solution that could solve all instances of the problem.

image

The procedure initially sets result to 1 and j to 2. In the REPEAT UNTIL loop, result is first assigned the sum of result and j, or 1 + 2. The value of j is then increased to 3. In each subsequent iteration of the loop, result is increased by each successive value of j (3, 4, 5, etc.) until j exceeds n. Therefore, the procedure returns the sum of the integers from 1 to n.

image

If the number of units of electricity used is 25 or less, the cost is 5 times the number of units. Otherwise, the cost is 5 times the first 25 units plus 7 times the number of units above 25. For examples, if a customer used 32 units of electricity, they should be charged $5 for the first 25 and $7 for the additional 7 units (32 – 25 = 7 units), for a total charge of $174.

image

The procedure will not display the correct value of foundIndex if the targetName is “Ben”. In the FOR EACH loop, when the value of name is “Andrea”, the ELSE statement sets foundIndex to 0. When the value of name is “Ben”, the ELSE statement sets foundIndex to 1. But as the loop continues, and the value of name is “Chris”, the ELSE statement sets foundIndex to 0. The procedure displays 0, even though the correct answer is 1.

image

The procedure returns the first number it encounters that is less than the first number in the list. For the list open bracket, 30, 40, 20, 10, close bracket, the procedure returns 2 0, which is not the least value in the list.

image

A strong password is something that is easy for a user to remember but would be difficult for someone else to guess based on knowledge of that user. Weak passwords can often be guessed based on publicly available information about a user. Other weak passwords (such as “password” or “1234”) can often be guessed because they are commonly used.

image

As this algorithm has a factorial efficiency, it does not run in a reasonable amount of time. A heuristic approach can be used to find an approximate solution than can run in a reasonable amount of time.

image

The total number of registered users appears to be increasing by about 0.5 million each year, so in year 12, the number of users can be approximated at 31.2 million (30.2 + 0.5 + 0.5).

image

In public cryptography, a message is encrypted with a recipient’s public key and decrypted with the recipient’s private key.