When JUnit testing with exceptions, which of the following is true? Group of answer choices   A successful test happens whenever an exception is not thrown. Exceptions and tests should not be used together. A failed test results when you catch an exception on valid input. If you give an illegal argument to a method the JUnit test will fail.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter11: Exception Handling
Section: Chapter Questions
Problem 5E
icon
Related questions
Question

Q#

 

When JUnit testing with exceptions, which of the following is true?

Group of answer choices

 

  1. A successful test happens whenever an exception is not thrown.
  2. Exceptions and tests should not be used together.
  3. A failed test results when you catch an exception on valid input.
  4. If you give an illegal argument to a method the JUnit test will fail.

 

Q#

 

When you want a method to return nothing, what do you put for the return type?

Group of answer choices

  1. boolean
  2. false
  3. void
  4. null

 

 

Q#

 

Which of the following statements are true?

Group of answer choices

  1. All of the options are true.
  2. Methods can take multiple primitives as arguments.
  3. Methods can take objects of other classes as arguments.
  4. A method for a class can take an object of that class as an argument.

 

 

 

Q#

 

What does Java guarantee is part of every class?

Group of answer choices

  1. AtoString() 
  2. A set of Getter methods to retrieve class variables.
  3. A method to get the binary representation of the class.
  4. A set of private class variables.

 

 

Q#

 

What of the following is true?

Group of answer choices

  1. A constructor is optional for most classes.
  2. A method is not a term used in Java, instead we use the term function.
  3. A constructor is for the creation of a new instance of an object, and a (non-static) method is for carrying out an operation involving an existing object.
  4. A constructor is part of an object class, while a method is defined outside of a class but will take objects as parameters.

 

 

 

                

 

Q#

 

Assume you are using a method that can throw an exception. In order to properly handle the cases when that exception is thrown what is best to use in your code?

Group of answer choices

 

  1. JUnit tests to see if the exception is thrown.
  2. Use a play-grab block.
  3. Use a try-catch block.
  4. Exceptions are not possibly to recover from.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning