0
0
Spring Bootframework~10 mins

@Min, @Max for numeric constraints in Spring Boot - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set a minimum value constraint on the age field.

Spring Boot
@Min([1])
private int age;
Drag options to blanks, or click blank then click option'
A18
B0
C21
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using a negative number for minimum age.
Confusing @Min with @Max.
2fill in blank
medium

Complete the code to set a maximum value constraint on the score field.

Spring Boot
@Max([1])
private int score;
Drag options to blanks, or click blank then click option'
A10
B1000
C100
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Setting maximum too low or too high.
Mixing up @Min and @Max annotations.
3fill in blank
hard

Fix the error in the code by completing the annotation to restrict quantity between 1 and 10.

Spring Boot
@Min(1)
@Max([1])
private int quantity;
Drag options to blanks, or click blank then click option'
A5
B10
C15
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Setting max less than min causes validation errors.
Using zero or negative numbers for max.
4fill in blank
hard

Fill both blanks to create a field 'rating' that must be between 1 and 5 inclusive.

Spring Boot
@Min([1])
@Max([2])
private int rating;
Drag options to blanks, or click blank then click option'
A1
B3
C5
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping min and max values.
Using values outside the 1-5 range.
5fill in blank
hard

Fill all three blanks to define a field 'level' with minimum 0, maximum 10, and default value 5.

Spring Boot
@Min([1])
@Max([2])
private int level = [3];
Drag options to blanks, or click blank then click option'
A0
B10
C5
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting default value outside the min-max range.
Confusing min and max values.