Engineering Questions with Answers - Multiple Choice Questions

MCQs on Visibility, Accessibility and Information Hiding

1 - Question

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 - Question

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 - Question

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.




4 - Question

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 - Question

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 - Question

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 - Question

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.




8 - Question

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 - Question

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.




10 - Question

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 - Question

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 - Question

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 - Question

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 - Question

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 - Question

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.

 

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners