Ask your own question, for FREE!
Computer Science 6 Online
kekeman:

When running code, select the example that would most likely result in an exception. Dividing by zero Missing parentheses Missing quotes Opening a file

Timmyspu:

Which 2 do you think could be wrong?

kekeman:

Ummm i am thinking C.) and D.) but idk for sure

Vocaloid:

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.

Vocaloid:

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.

kekeman:

Yes i see so i think that answer is Dividing by zero which makes it a exception

Vocaloid:

yep

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!