Software Design Questions and Answers – Visibility, Accessibility and Information Hiding

This set of Software Design test focuses on “Visibility, Accessibility and Information Hiding”.

1. Which of the following represents DeSCRIPTOR specification?
a) Program component decomposition and component relationships are shown in static models, such as class diagrams
b) Packaging and implementation specifications, particularly as they relate to information hiding
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: a
Explanation: Program component decomposition (De) and component relationships(R) are shown in static models, such as class diagrams.

2. Which of the following represents PAID specification?
a) Component properties are documented in text
b) Operation specifications, which elaborate operation responsibilities and state operation interfaces
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: b
Explanation: Operation specifications, which elaborate operation responsibilities (R)and state operation interfaces (I).

3. What is a program entity?
a) A program entity is anything in a program that is treated as a unit
b) Variables, constants, sub-programs, packages, classes, attributes and operations are all examples of program entities
c) Most programming languages allow various kinds of program entities
d) All of the mentioned
View Answer

Answer: d
Explanation: A program entity is anything in a program that is treated as a unit. Variables, constants, sub-programs, packages, classes, attributes, and operations are all examples of program entities and Most programming languages allow various kinds of program entities.
advertisement
advertisement

4. What is a name and which of the following is true?
a) A name is an identifier bound to a program entity
b) Virtually every programming language will not supports variable and sub-programming
c) It is not be possible to refer to a particular entity by name at various points of a program’s text
d) None of the mentioned
View Answer

Answer: a
Explanation: It may or may not be possible to refer to a particular entity by name at various points of a program’s text.

5. What is visibility?
a) A program entity at a point in a program text if it can be referred to by name at that point
b) The portion of a text over which a program entity is visible
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: b
Explanation: A program entity is visible at a point in a program text if it can be referred to by name at that point and The portion of a text over which a program entity is visible is its visibility.

6. What are the types of visibility?
a) Local
b) Global
c) Non-Local
d) All of the mentioned
View Answer

Answer: d
Explanation: Types of visibility- Local, Global, Non-Local.

7. What are the Object oriented visibility?
a) Private and Package
b) Protected
c) Public
d) All of the mentioned
View Answer

Answer: d
Explanation: Types of object oriented visibility- Private, Packaged, Protected and Public.
advertisement

8. Which of the following are of non-local form ?
a) Private
b) Protected and Packaged
c) Public
d) Public, Protected and Packaged
View Answer

Answer: d
Explanation: Private is of local form rest others are non-local forms.

9. When is a program accessible?
a) A program entity at a point in a program text if it can be used at that point
b) A variable is a programming language device for storing values
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: A program entity is accessible at a point in a program text if it can be used at that point.
advertisement

10. What is reference?
a) It is an expression that evaluates to an address where a value is stored
b) It is a variable with the same address as another variable
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: a
Explanation: A reference is an expression that evaluates to an address where a value is stored and An alias is a variable with the same address as another variable.

11. When is a variable called extending access beyond visibility?
a) Passing a reference as an argument
b) Passing an argument by reference (which uses aliasing)
c) Returning a reference from a sub-program
d) All of the mentioned
View Answer

Answer: d
Explanation: Making a variable accessible in a portion of a program where it is not visible is called extending access beyond visibility while Passing a reference as an argument, Passing an argument by reference (which uses aliasing), Returning a reference from a sub-program.

12. What does Information Hiding mean?
a) The key technique for is to restrict access to program entities as much as possible
b) It is an expression that evaluates to an address where a value is stored
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: a
Explanation: The key technique for hiding information is to restrict access to program entities as much as possible.

13. Which of the following are the strategies for restricting access to program entities?
a) Limiting Visibility
b) Not Extending Access
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: d
Explanation: Restricting access to program entities relies on two strategies-Limiting Visibility and Not Extending Access.

14. What are the heuristics for information hiding?
a) Restrict the scope of declarations to the smallest possible program segment
b) Make class attributes at least protected and preferably private
c) Avoid global visibility
d) All of the mentioned
View Answer

Answer: d
Explanation: All the mentioned are the heuristics followed for information hiding.

15. What are the heuristics for information hiding under don’t extend access?
a) Don’t pass or return references to class attributes—pass or return defensive copies instead.
b) Don’t pass parameters by reference
c) Don’t make aliases
d) All of the mentioned
View Answer

Answer: d
Explanation: All the mentioned are the heuristics followed for information hiding under don’t extend access.

Sanfoundry Global Education & Learning Series – Software Architecture and Design.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.