Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

if a program runs without any error messages, but doesnt do what you wa…

Question

if a program runs without any error messages, but doesnt do what you want it to do. what kind of error do you likely have in your code?
select one:
o a. logical error
o b. runtime exception
o c. syntax error
o d. any of these is possible

when do you normally see the effects of a logical error?
select one:
o a. when the program is running
o b. before the program starts
o c. after the program ends
o d. any of these times is possible

what happens when a runtime exception is encountered?
select one:
o a. your program halts completely with an error message
o b. your program hangs forever without any more input or output
o c. your program continues to run but may not behave the way you wanted
o d. an automatic error report is sent to the python software foundation

why are logical errors sometimes harder to find and fix?
select one:
o a. the logical error messages are more complicated than other error messages
o b. you do not see any error messages that give you hints about the problem
o c. you dont have any tools to help you find and fix those kinds of problems
o d. you have to keep re - starting your program after it crashes

when conducting a code review, in what order should you normally examine your statements?
select one:
o a. start with the longest and most complex statements first
o b. start with the shortest and easiest statements first
o c. from top to bottom, in the order they normally execute
o d. from bottom to top, working backwards

Explanation:

Brief Explanations
  • First question: A logical error occurs when the program runs without syntax or runtime errors but doesn't produce the expected output. A runtime exception would halt the program with an error message, and a syntax error would prevent the program from running.
  • Second question: Logical errors manifest during program execution as the program follows incorrect logic paths while running.
  • Third question: When a runtime exception is encountered, the program usually halts completely with an error message indicating the nature of the exception.
  • Fourth question: Logical errors don't generate error messages, so there are no direct hints about what's wrong, making them harder to detect compared to errors that provide error messages.
  • Fifth question: Code should be examined from top to bottom in the order of execution to follow the program's flow and easily identify where logic might be going wrong.

Answer:

a. Logical error
a. When the program is running
a. Your program halts completely with an error message
b. You do not see any error messages that give you hints about the problem
c. From top to bottom, in the order they normally execute