When running code, select the example that would most likely result in an exception. Dividing by zero Missing parentheses Missing quotes Opening a file
Which 2 do you think could be wrong?
Ummm i am thinking C.) and D.) but idk for sure
hm. trying to think of a good way to explain this. missing parentheses and missing quotes are examples of syntax errors. the code isn't written properly, so it won't run at all. however, if I set up a program to divide two numbers, but I try dividing by 0, that's an exception, because this mathematical operation is impossible. the code *runs* but it encounters a logical error and thus cannot provide a valid result.
I guess a better way to explain it is that exceptions are errors in the logic of the code, rather than the writing of the code. if you want to create a program that divides two numbers, you simply have to change the logic by adding a line saying that it will not accept 0 as an input for the denominator.
Yes i see so i think that answer is Dividing by zero which makes it a exception
yep
Join our real-time social learning platform and learn together with your friends!