Certiport Practice for CS Exam with
Complete Solutions
for - correct Answer-The _________ loop executes a statement, or a block
of statements, based on the value of a control
variable (also called a counter).
while - correct Answer-The ___________ loop executes a statement or block of
statements repetitively based on a Boolean expression.
You can think of it as a repeating if statement.
do..while - correct Answer-The ____________ loop is similar to a while loop,
but the Boolean expression is not checked until
after the code executes.
exception - correct Answer-An ____________ is an object that contains information
about an error.
thrown - correct Answer-Developers use the terms THROW and CATCH when talking
about exceptions. When an exception
occurs it is ____________.
catch - correct Answer-You should _____________ any exceptions your program may
encounter.
try - correct Answer-Think of a ______________ statement as a warning to the
computer that you're about to try something that
may not work. "I'm going to do some division, and it might result in a
DivideByZeroException!"
catch - correct Answer-The ____________ block executes if the exception does occur.
You can leave this block empty but
generally it's good to put your "backup plan" in the catch block.
try-catch - correct Answer-A ___________________ structure doesn't prevent the
exception from being thrown, it simply the developer a chance to keep the program from
crashing.
object - correct Answer-Represents something from the real world
field - correct Answer-a variable declared within a class
Complete Solutions
for - correct Answer-The _________ loop executes a statement, or a block
of statements, based on the value of a control
variable (also called a counter).
while - correct Answer-The ___________ loop executes a statement or block of
statements repetitively based on a Boolean expression.
You can think of it as a repeating if statement.
do..while - correct Answer-The ____________ loop is similar to a while loop,
but the Boolean expression is not checked until
after the code executes.
exception - correct Answer-An ____________ is an object that contains information
about an error.
thrown - correct Answer-Developers use the terms THROW and CATCH when talking
about exceptions. When an exception
occurs it is ____________.
catch - correct Answer-You should _____________ any exceptions your program may
encounter.
try - correct Answer-Think of a ______________ statement as a warning to the
computer that you're about to try something that
may not work. "I'm going to do some division, and it might result in a
DivideByZeroException!"
catch - correct Answer-The ____________ block executes if the exception does occur.
You can leave this block empty but
generally it's good to put your "backup plan" in the catch block.
try-catch - correct Answer-A ___________________ structure doesn't prevent the
exception from being thrown, it simply the developer a chance to keep the program from
crashing.
object - correct Answer-Represents something from the real world
field - correct Answer-a variable declared within a class