Monday, October 19, 2009

Yichi's Quicky Quiz

Here are some quicky quiz questions that I think may be asked in the mid-term.

1. When you start software development, which editor you want to use, wordpad or Eclipse? Why you choose it?
- Use Eclipse because wordpad is not an IDE. IDE is very important in software development. It helps developers understand the system hierarchy better. It also shows syntax errors which saves lots of time locating the problem. It also supports for testing, debugging and refactoring.

2. Name two new features of Java 5 comparing with C?
- In Java, parameters are always passed by value.
- Java supports basic collections


3. Implement the FizzBuzz program in Java. FizzBuzz program should print out all of the numbers from 1 to 100, one per line, except that when the number is a multiple of 3, you print "Fizz", when a multiple of 5, you print "Buzz", and when a multiple of both 3 and 5, you print "FizzBuzz".
public class FizzBuzzClass {

public static void main(String[] args){
for(int i = 1; i <= 100; i++){
System.out.println(GetFizzBuzz(i));
}
}

static String GetFizzBuzz(int n){
if(n%3==0&&n%5==0){
return "FizzBuzz";
}
else if(n%3==0){
return "Fizz";
}
else if(n%5==0){
return "Buzz";
}
else{
return Integer.toString(n);
}
}
}



4. Design three unit test for the FizzBuzz program.
-Test 1: Make sure GetFizzBuzz(3) return "Fizz"
-Test 2: Make sure GetFizzBuzz(4) return "4"
-Test 3: Make sure GetFizzBuzz(5) return "Buzz"


5. Why coding standard is important for a program?
- Code standard is important because it improves the readability, understandability, and maintainability of the code.

6. When you create a class in Java why you want to override equals method and hashCode method most the time?
- Because the default implementation for equals method and hashCode method might not be correct for your class.

7. What is the advantage for using Ant? Briefly describe how would you write an Ant build system for a program.
Ant has a file-level dependency management and it has built-in support for Java and simplifies cross-platform Java development. To build a system, you need to define a default target which ant will run first. Then you may want to use IVY to get all the third party libraries that used in your system. Lastly, you need to include all the code that need to be compiled.

8. What are the advantages and disadvantages for manual quality assurance and static quality assurance?
-Manual QA can detect some logical problems, but it takes time to write lots of customized tests. Static QA is to use some existing tools such as FindBugs, they mostly check for some simple problems such as an unused variable.

9. Why configuration management is important for a project?
Configuration management helps developers back track the changes that made to the system.

10. In case you run into a problem in question 3 (For example, you don't know how to print "FizzBuzz"), and you want to ask other people for help. how would generate ask your question:)
Hi there, I am working on a FizzBuzz program(discribe FizzBuzz). I can print "Fizz" and "Buzz" but I cannot print "FizzBuzz" when the number has a factor of 15. Here is my code:
static String GetFizzBuzz(int n){
if(n%3==0andn%5==0){
return "FizzBuzz";
}
else if(n%3==0){
return "Fizz";
}
else if(n%5==0){
return "Buzz";
}
else{
return Integer.toString(n);
}
}

Any Comment?

No comments:

Post a Comment