6. Quiz Questions

If you would like to look up the answers for the following quiz questions, you can check our discussion forum. If you don't find an answer in the forum, you may create a post asking for an answer to a particular question.

If you would like to do interactive quizzes with online feedback and with the option to ask a coach, then you should enrol in the introductory online course (book parts 1-3) offered by our partner developer-competence.com.

6.1. Question 1: Where to Check Constraints

Where in the application code should the constraints be checked? In the ...

☐ controller code

☐ model classes

☐ user interface code

☐ underlying DBMS (if it supports constraint validation)

6.2. Question 2: Where to Define Constraints

Where in the application code should the constraints be defined? In the ...

☐ controller code

☐ model classes

☐ user interface HTML5 code

☐ user interface JavaScript code

6.3. Question 3: Counting Constraints

Figure 5.6. Class with constraints

Class with constraints

How many constraints are specified by the class model shown in the diagram?

Enter a number: _____

6.4. Question 4: Constraint Names

Figure 5.7. Class with constraints

Class with constraints

Which of the following constraints are specified by the class model?

☐ A range constraint for the property name.

☐ A uniqueness constraint for the property name.

☐ A referential integrity constraint for the property name.

☐ A uniqueness constraint for the property age.

☐ A mandatory value constraint for the property name.

☐ A mandatory value constraint for the property age.

6.5. Question 5: Compliant Objects

Figure 5.8. Class with constraints

Class with constraints

Which of the following objects do not represent admissible instances (or, in other words, violate a constraint) of the object type Person?

  1. {name: "Susan", age: 8}

  2. {name: " ", age: 0}

  3. {name: "Susan"}

  4. {name: "Peter", age: 122}