Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a class with a name in UML notation.
LLD
class [1] { }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'attribute' or 'method' as the class name.
✗ Incorrect
The class name goes inside the class box in UML diagrams.
2fill in blank
mediumComplete the code to add an attribute to a UML class with visibility.
LLD
class Person { [1] name: String }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' which means private, not public.
✗ Incorrect
In UML, '+' means the attribute is public (visible outside the class).
3fill in blank
hardFix the error in the UML method declaration by choosing the correct return type symbol.
LLD
class Person { + getAge() : [1] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'void' which means no return value.
✗ Incorrect
The method getAge() should return an integer representing age.
4fill in blank
hardFill both blanks to show correct UML notation for a private attribute and a public method.
LLD
class Car { [1] speed: int [2] accelerate() }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' for attributes which should be private.
✗ Incorrect
Private attributes use '-', public methods use '+'.
5fill in blank
hardFill all three blanks to complete the UML class with an attribute, method, and return type.
LLD
class Book { [1] title: String [2] getTitle() : [3] }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Making the attribute public or returning wrong type.
✗ Incorrect
The attribute 'title' is private ('-'), the method 'getTitle()' is public ('+'), and returns a String.