100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
CSE 2221 Final. $9.79   Add to cart

Exam (elaborations)

CSE 2221 Final.

 4 views  0 purchase
  • Course
  • Institution

Exam of 11 pages for the course CSE 2221 - Midterm 1 - Set 1 at CSE 2221 - Midterm 1 - Set 1 (CSE 2221 Final.)

Preview 2 out of 11  pages

  • June 17, 2024
  • 11
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
avatar-seller
CSE 2221 Final

The Implements Relation - ANS-The implements relation may hold between a class and
an interface. If C implements I then class C contains code for the behavior specified in
interface I. This means that C has method bodies for instance methods whose contracts
are specified in I.
The code of C looks like this:
class C implements I {
// bodies for methods specified in I
}
The implements relation allows you to separate contracts from their implementations- a
best practice for component design.

The Extends Relation - ANS-The extends relation may hold between: 2 interfaces or 2
classes.
If B extends A then B inherits all the methods of A. This means B implicitly starts out
with all the method contracts (for an interface) or all the method bodies (for a class) that
A has. B can then add more method contracts (for an interface) or method bodies (for a
class).

Overloading - ANS-A method (name) is overloaded when 2 or more methods have the
same name, in which case methods must differ in the number and/or types of their
formal parameters (which the compiler uses to disambiguate them)

Interface Extension - ANS-If I1 and I2 are interfaces and I2 extends I1, then the code of
I2 looks like this:
interface I2 extends I1{
//contracts for methods added in I2
}
For interfaces all such methods are instance.

Testing - ANS-Testing is a technique for trying to refute the claim that a method body is
correct for the method contract. In other words, the goal of testing is to show that the
method body does not correctly implement the contract i.e. that it is defective

Tree Representation of Expression - ANS-Each operand (1,2,3,4,5,..) of an operator (+ -
* /) must be evaluated before that operator can be evaluated

, Unit Testing - ANS-Best practice to test individual units of components of software (one
class, one method at a time)

Integration Testing - ANS-Testing what happens when multiple components are put
together into a larger system

System testing - ANS-testing a whole end-user system

Method Correctness - ANS-Look at method's contract, which is a specification of its
intended behaviors. The actual behaviors of the method (see body) must be within the
allowed behaviors of the method (see contract).

Test Plan/Fixture - ANS-A set of test cases for a given unit is called a test plan or a test
fixture for that unit

Designing a test plan - ANS-To make testing most likely to succeed in revealing defects,
best practices include: (1) Test boundary cases: smallest, largest, and special values in
the contract (2) test routine cases (3) test challenging cases, ie ones that if you were
writing the code, you might find difficult or error prone

Test cases - ANS-Each input value and corresponding allowed/expected result is a test
case. Test cases that do not reveal a defect in the code do not help us to refute a claim
of correctness. Test cases exercises a single unit of code, normally a method. Test
cases should be small and independent of each other.

Replaces Mode - ANS-Upon return from a method call, a replaces-mode parameter has
a value that might be changed from its incoming value, but the method's behavior does
not depend on its incoming value. A replaces-mode parameter, e.g., x should not
appear in the requires clause, and #x should not appear in the ensures clause

Declared/Static Type - ANS-When a variable is declared using the name of an interface
as its type, e.g. NN k = new NN2(); then its declared/static type is said to be an interface
type (here declared type is NN). Best practice to declare vars this way.
When a variable is declared using the name of a class as its type, e.g. NN2 k = new
NN2() then its declared type (or static type) is said to be a class type.here declared type
is NN2)

Polymorphism - ANS-Java decides which method body to use for any call to an instance
method based on the object type of the receiver. This type because the class of the
constructor is always a class type.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller denicetho. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $9.79. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73243 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$9.79
  • (0)
  Add to cart