Sunday, October 18, 2009

Buddy better study

There is a midterm coming up in my software engineering class so I am posting up some review questions. See how many you can answer without using google.

1. Describe what a foreach loop does and give an example of a foreach loop.

2. List 3 consequences of multitasking.

3. Describe the concern companies have with using open source software in regards to derivative works and intellectual property rights.

4. How are coverage reports often misused?

5. What are the 3 best practices for using coverage reports according to "In pursuit of code quality: Don't be fooled by the coverage report"?

6. What does the acronym GNU stand for and what does it mean when it is said that the GNU General Public License is viral?

7. What is the difference between open source and source-available?

8. Describe the two approaches to defining equality and hash value according to "Java Theory and Practice: Hashing it out".

9. Which collection is most appropriate for a list of strings in alphabetical order with duplicates.

10. Write an ant target called "init" that creates an output directory for generated files called "build/classes".

Answers:
1. A foreach or a for/in loop is a new loop that was added in Java 5.0 that executes its body once for each element in an array or collection.
for(declaration : expression)
statement

int[] foo = {1, 2, 3, 4, 5};
for (int i : foo) {
System.out.println
(i);
{







Source: Java in a Nutshell pg 50

2. More stress
Less efficiency
More frustration
More pressure, etc.

Source: http://www.nytimes.com/2008/10/25/business/yourmoney/25shortcuts.html?pagewanted=2

3. If companies use the open source software as their base, their "value added" programs might be considered "derivative works" and would then need to make the source code available even to competitors.

Source: http://www.abanet.org/intelprop/opensource.html

4. High coverage rates means that a lot of code was exercised. It doesn't mean that the code was exercised well.

Source: http://www.ibm.com/developerworks/java/library/j-cq01316/index.html

5.
1)Estimating the time to modify existing code.
developers: To check code quality before attempting to modify it
managers: To get a better estimate of time a developer needs to do the work on that code.
2) Evaluating code quality
Shows where code lacks testing
3) Accessing functional testing
Use results to help facilitate risk mitigation

source: http://www.ibm.com/developerworks/java/library/j-cq01316/index.html

6. GNU = GNU's Not Unix
If the GPL software is modified, it must be distributed under GPL. The GPL spreads to any modified GPL software.

7. Source available software has the source available to be viewed but it cannot be modified or redistributed like open source software.

Source: http://en.wikipedia.org/wiki/Open_source_software

8. Identity-based: Two references are equal only if they refer to the same object.
State-based: Two objects are equal only if they contain the same value.

9. List

10.

<target name="init">
<
mkdir dir="build/classes" />
</
target>





Source: "Ant in Action: Java Development with Ant"

0 comments:

Post a Comment