Java Development with Ant

 

Quizzes Index


Duke

This quiz is based on the book Java Development with Ant . Test your knowledge of Ant such as what happens when you overwrite a property or what the definition of an XDoclet is.

Choose the best answer(s) for each question, then click Submit to see how you scored.

 

  1. When setting a property "src.dir" to the name of a directory "source", should you use:
     A. <property name="src.dir" value="source" >
     B. <property name="src.dir" location="source" >
     C. Either works: it doesn't make any difference
  2. What dependency checking does the <javac> task do?
     A. none
     B. it recompiles all .java files that need rebuilding
     C. it recompiles all .java files whose .class file is missing or older than the .java source file
  3. What happens when you overwrite a property? What is the message that gets printed from the following snippet

    <property name="javac.debug" value="true"/>
    <property name="javac.debug" value="false"/>
    <echo message="debug flag is ${javac.debug}"/>
    

     A. debug flag is true
     B. debug flag is false
     C. debug flag is ${javac.debug}
  4. What is a valid path for specifiying files on a Unix system?
     A. "lib/junit.jar:lib/httpunit.jar"
     B. "lib\junit.jar;lib\httpunit.jar"
     C. either of the above
  5. What gets printed in this conditional target?

    <property name="someproperty" value="false" />
    
    <target name="conditional" if="someproperty">
         <echo message="hello" />
    </target>
    


     A. hello
     B. nothing
  6. How do you wait for deployment to complete before you start tests?
     A. <sleep>
     B. use <waitfor>
     C. have two build files, poll by hand and start the second test
  7. The <java> task can run a Java program in Ant's own JVM, or in a forked JVM. Should you run your code with fork="true" or fork="false"
     A. fork="false" for the speed gain
     B. fork="true" for the isolation
     C. it makes no difference
  8. True or false: by default, the <junit> task fails the build when a test fails.
     A. True
     B. False
  9. XDoclet is:
     A. A Java metadata templating engine
     B. A deployment descriptor generator
     C. A replacement for javadoc
     D. A & B
     E. A, B, & C
  10. What is Cactus?
     A. A performance testing JUnit extension
     B. An in-container testing framework
     C. A competitor to JUnit
  11. Writing a custom Ant task requires:
     A. Extending from org.apache.tools.ant.Task
     B. Commit access to Ant's CVS repository
     C. Updating a properties file within ant.jar
     D. None of the above
  12. Ant can be extended in several ways. In what way can Ant (version 1.5) not be extended?
     A. Custom mapper
     B. Custom FilterReader
     C. Custom <condition>
     D. Custom selector
  13. Overriding an Ant property from the command-line is done with this syntax:
     A. property name=value
     B. -override name=value
     C. -Dname=value
     D. You cannot override Ant properties from the command-line

Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve
JavaOne Banner
Java 8 banner (182)