WGU C212 MARKETING CORRECT TEST PAPER
QUESTIONS AND ANSWERS SURE A+
✔✔What is the catch clause used for? - ✔✔When you throw an exception, processing
continue in an exception handler. Place the statements that can cause
an exception inside a try block and the handler inside a catch clause.
✔✔What are checked exceptions? - ✔✔Checked exceptions are due to external
circumstances that the programmer cannot prevent. The compiler checks that
your program handles these exceptions. A checked exception describes a problem that
can occur, no matter how careful
you are (e.g., an IOException can be caused by a disk error or a broken network
connection). The unchecked exceptions
on the other hand are your fault. The compiler does not check whether you handle an
unchecked exception (such as an
IndexOutOfBoundsException) since you should in fact check your index values rather
than install a handler for that
exception.
✔✔What is the catch clause used for? - ✔✔Contains the handler for an exception type.
Multiple catch clauses can be used to handle different exceptions.
, ✔✔What are checked exceptions? - ✔✔These exceptions indicate that something has
gone wrong for some external reason beyond your control.
✔✔When do you use the throws clause? - ✔✔If a method doesn't catch a checked
exception that can occur within it, the method must specify that it can throw these
exceptions. Throws clause comprises the throws keyword followed by a comma-
separated list of all the exceptions thrown by that method.
✔✔How (and why) do you design your own exception types? - ✔✔Sometimes none of
the standard exception types describe your particular error condition well enough. In
that case, you
can design your own exception class. To describe an error condition, provide a subclass
of an existing exception class.
✔✔Why is an ArrayIndexOutOfBoundsException not a checked exception? -
✔✔Because programmers should simply check that their array index values are valid
instead of trying to handle such an exception
✔✔Is there a difference between catching checked and unchecked exceptions? -
✔✔No, you can catch both exceptions type in the same way.
✔✔What does it mean: throw early, catch late? - ✔✔Throw an exception as soon as a
problem is detected. Catch it only when the problem can be handled.
✔✔What are all permutations of the word beat? - ✔✔N! There are 4! = 1 * 2 * 3 * 4 = 24
permutations in all: b followed by six permutations of eat,
e followed by six permutations of bat, a followed by six permutations of bet, and t
followed by
the six permutations of bea. So that means
beat
ta
aet
te
tea
ae
ebat
ta
abt
tb
tba
ab
abet
te
ebt
QUESTIONS AND ANSWERS SURE A+
✔✔What is the catch clause used for? - ✔✔When you throw an exception, processing
continue in an exception handler. Place the statements that can cause
an exception inside a try block and the handler inside a catch clause.
✔✔What are checked exceptions? - ✔✔Checked exceptions are due to external
circumstances that the programmer cannot prevent. The compiler checks that
your program handles these exceptions. A checked exception describes a problem that
can occur, no matter how careful
you are (e.g., an IOException can be caused by a disk error or a broken network
connection). The unchecked exceptions
on the other hand are your fault. The compiler does not check whether you handle an
unchecked exception (such as an
IndexOutOfBoundsException) since you should in fact check your index values rather
than install a handler for that
exception.
✔✔What is the catch clause used for? - ✔✔Contains the handler for an exception type.
Multiple catch clauses can be used to handle different exceptions.
, ✔✔What are checked exceptions? - ✔✔These exceptions indicate that something has
gone wrong for some external reason beyond your control.
✔✔When do you use the throws clause? - ✔✔If a method doesn't catch a checked
exception that can occur within it, the method must specify that it can throw these
exceptions. Throws clause comprises the throws keyword followed by a comma-
separated list of all the exceptions thrown by that method.
✔✔How (and why) do you design your own exception types? - ✔✔Sometimes none of
the standard exception types describe your particular error condition well enough. In
that case, you
can design your own exception class. To describe an error condition, provide a subclass
of an existing exception class.
✔✔Why is an ArrayIndexOutOfBoundsException not a checked exception? -
✔✔Because programmers should simply check that their array index values are valid
instead of trying to handle such an exception
✔✔Is there a difference between catching checked and unchecked exceptions? -
✔✔No, you can catch both exceptions type in the same way.
✔✔What does it mean: throw early, catch late? - ✔✔Throw an exception as soon as a
problem is detected. Catch it only when the problem can be handled.
✔✔What are all permutations of the word beat? - ✔✔N! There are 4! = 1 * 2 * 3 * 4 = 24
permutations in all: b followed by six permutations of eat,
e followed by six permutations of bat, a followed by six permutations of bet, and t
followed by
the six permutations of bea. So that means
beat
ta
aet
te
tea
ae
ebat
ta
abt
tb
tba
ab
abet
te
ebt