1. In the "Getting Answers" guide, 10 strategies were given. List 3 of these strategies.
A. Explain what doesn't work
Provide Everything up-front
Post your code
Do your research beforehand
Do your research during
Do your research afterwards
Don't post the same question repeatedly
Follow up after you get an answer
Treat the list like people
Always consider the answer
2. Give one good and one bad example of a post to ask for answers. (include subject line and body).
A. (Bad)
Subject: Help, Code not working!!!
Body: Ahhhh... I cant get my code to work... Please help me ASAP
(Good)
Subject: Roboode Junit test error: "robocode home not set"
Body: I received this error while trying to run a Junit test on my robocode project.
I need to set the robocode home path but I dont know how to set it in Eclipse.
Could someone please tell me where i can set this path in Eclipse.
Thank you.
attached is my code and my file path.
3. what is the difference between foo.equals(bar) and foo == bar?
A. foo.equals(bar) is true when their values are the same but could be in different memory location
foo==bar is true only if they are in the same memory location
4. Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz"
instead of the number and for the multiples of five print "Buzz".
For numbers which are multiples of both three and five print "FizzBuzz".
A.
public class FizzBuzz{
public static void main(String [] args){
for (int i = 1; i <= 100; i++){
if (i % 15 == 0){
System.out.print("FizzBuzz");
}
else if (i % 3 == 0){
System.out.print("Fizz");
}
else if (i % 5 == 0){
System.out.print("Buzz");
}
else{
System.out.print(i);
}
}
}
}
5. Find a violation of checkstyle and findbug in the code below.
public void xFire(double robotDistance) {
if (robotDistance > 400) {
doNothing();
}
else if (robotDistance > 200)
fire(1);
else if (robotDistance > 100) {
fire(2)
}
else if (robotDistance > 50) {
fire(3);
}
}
A. Checkstyle: missing "{}" on first else if.
Findbug: missing ";" inside second else if.
6. Why did our RoboCode not follow the coding standard of being within the package hierachy "edu.hawaii" ?
A. this standard may be superceded by "adhere to the style of the original", as in the case of RoboCode.
7. In the antipattern article, what is the "Happy path test"?
A. A happy path test is a test within boundaries, pretty testing something that you know will pass.
8. What is the difference between white box testing and black box testing?
A. White box testing uses an internal perspective of the system to design test cases based on internal structure while Black box testing takes an external perspective of the test object to derive test cases.
9. What is the benefit of using a coverage tool?
A. It make sure that the program is performing normally; producing expected results with the smallest number of errors. Also shows you which line is being executed and if it contains errors or not.
10. What is the goal of GNU and what foundation did they create to help reach that goal?
A. The goal of GNU was to give users freedom, freedom to run the program, copy the program, modify the program, and distribute modified versions. They created the Free Software Foundation
0 comments:
Post a Comment