[ Web Proxy ]
URL:
Viewing: https://liquid-java.github.io/liquidjava-tutorial/ [Back]  [Original]

LiquidJava Quiz

LiquidJava Quiz

Test your knowledge about LiquidJava concepts including refinements, object state modeling and ghost variables!

LiquidJava Banner [LiquidJava Banner]
  1. Liquid types allow developers to catch bugs at:

    • Execution time
    • Compile time
    • Deployment time
    • Testing time
  2. Liquid types can prevent which of the following bugs? (Select all that apply)

    • Array index out-of-bounds
    • Null pointer exceptions
    • Memory leaks
    • Division by zero
  3. In LiquidJava, what integer values for x are allowed with this refinement? @Refinement("x > 0")

    • All values
    • All negative values
    • All non-negative values
    • All positive values
  4. In LiquidJava, which of the following can be refined? (Select all that apply)

    • Variables
    • Parameters
    • Return values
    • Imports
  5. In LiquidJava, which of the following is not a valid refinement?

    • @Refinement("x == 1 || x == -1")
    • @Refinement("x > 0")
    • @Refinement("x % 2 == 0")
    • @Refinement("x + 1")
  6. In LiquidJava, to specify that a method should only be called when the object is in a certain state, we should use a:

    • @StateRefinement
    • @Refinement
    • @RefinementAlias
    • @RefinementPredicate
  7. In LiquidJava, what does the following state refinement mean? @StateRefinement(from="!closed(this)", to="closed(this)")

    • The method can only be called when the object is closed and will leave it closed
    • The method can only be called when the object is open and will leave it open
    • The method can only be called when the object is not closed and will leave it closed
    • The method can be called in any state and will leave it closed
  8. In LiquidJava, the @ExternalRefinementsFor annotation is used to:

    • Import refinements from external libraries
    • Define new refinements for an external class or interface
    • Export refinements to other modules
    • None of the above
  9. In LiquidJava, a ghost variable is used to:

    • Store temporary data during the program execution
    • Model abstract properties of objects for verification purposes
    • Track memory usage of the program
    • Replace regular variables for better performance
  10. In LiquidJava, which of the following refinements updates the ghost variable size?

    • @Refinement("size = 0")
    • @StateRefinement(from="size(this) > 0")
    • @Refinement("size == 0")
    • @StateRefinement(to="size(this) == size(old(this)) + 1")
Check Answers Reset All


Web Proxy Viewer  |  New URL  |  Original Page