CS FundamentalsEasyHCL · Tech Mahindra pattern
A class diagram shows Employee with attribute `- salary: double` and operation `+ getSalary(): double`. What do the leading `-` and `+` symbols indicate?
- A. `-` marks salary as private (accessible only within Employee), and `+` marks getSalary() as public (accessible from any class)
- B. `-` means the attribute is optional and `+` means the method is static
- C. `-` means the attribute is abstract and `+` means it is final
- D. They indicate the order attributes were added to the class
Correct answer: A. `-` marks salary as private (accessible only within Employee), and `+` marks getSalary() as public (accessible from any class)
UML visibility notation: `-` private, `+` public, `#` protected, `~` package. Here salary is hidden behind the public getSalary() accessor, a standard encapsulation pattern.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A sequence diagram shows a loop combined fragment labelled loop [for each item in cart] wrapping a single message validateItem(item) sent…
- A class diagram shows Vehicle as a superclass with a generalization (hollow triangle arrow) pointing from Car and Truck up to Vehicle. If…
- Using basic COCOMO for a semi-detached project (E = 3 × KLOC^1.12 person-months), what is the estimated effort for a 45 KLOC project?
- A control flow graph has 28 edges and 20 nodes. What is its cyclomatic complexity?
- A control flow graph has 30 edges and 21 nodes, forming 2 disconnected components. What is its cyclomatic complexity?
- A control flow graph has 7 edges and 6 nodes. What is its cyclomatic complexity?