250+ MCQs on Visibility, Accessibility and Information Hiding and Answers

Software Design test 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

Answer: a
Clarification: 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

Answer: b
Clarification: 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

Answer: d
Clarification: 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.

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

Answer: a
Clarification: 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

Answer: b
Clarification: 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

Answer: d
Clarification: 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

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

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

Answer: d
Clarification: 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

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

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

Answer: a
Clarification: 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

Answer: d
Clarification: 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

Answer: a
Clarification: 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

Answer: d
Clarification: 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

Answer: d
Clarification: 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

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

Leave a Reply

Your email address will not be published. Required fields are marked *