LG Electronics - Software Analysis Course

LG Electronics - Software Analysis Course

<p>17-654/17-754: Analysis of Software Artifacts Class Participation Sheet For Lecture 10, ESC/Java Date: February 14, 2008</p><p>Name: ______Andrew ID: ______</p><p>Question 1. For each of the following loops, is the given variant function correct? If not, why not?</p><p>A) Loop: n := 256; while (n > 1) do n := n / 2</p><p>Variant Function: log2 n</p><p>B) Loop: n := 100; while (n > 0) do if (random()) then n := n + 1; else n := n – 1;</p><p>Variant Function: n</p><p>C) Loop: n := 0; while (n < 10) do n := n + 1;</p><p>Variant Function: -n Question 2. Consider the following function: int subtract(int x, int y) { return x + y; }</p><p>This code clearly does not correctly implement subtraction. However, if you run ESC/Java on it, you will not get any errors. Why not?</p><p>Question 3. Consider the following function: void getF(FHolder fHolder) { return fHolder.f; }</p><p>ESC/Java will give an error of the form “Warning: Possible null dereference (Null).” What is the best way to eliminate this warning?</p><p>Optional: Ask a question, make a suggestion, or provide feedback to the instructor/TAs</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us