Answered step by step
Verified Expert Solution
Question
1 Approved Answer
True / False ( 5 ) 1 . Any methods that a core method might call are part of the core group. Answer: 2 .
TrueFalse
Any methods that a core method might call are part of the core group.
Answer:
You should never suppress compiler warnings.
Answer:
When defining the bag class write methods that have simple implementation first to get them out of the way.
Answer:
A final class is more secure than one that is not final.
Answer:
When testing a method, you only need to check for arguments that lie within the legal range of their corresponding parameter.
Answer:
Multiple Choice Please highlight in YELLOW your entire answer.
Which of the following methods is a good candidate for a core method:
a add
b clear
c contains
d remove
Which of the following methods is a good candidate for a core method:
a add
b toArray
c isArrayFull
d all of the above
Which one of the following Java statements allocates an array in the bag constructor causing a compiler warning for an unchecked operation? Assume capacity is an integer.
a bag new Tcapacity;
b bag new Objectcapacity;
c bag new T Objectcapacity;
d bag T new Objectcapacity;
Which instruction suppresses an uncheckedcast warning from the compiler?
a @SuppressUnchecked
b @SuppressWarningsunchecked
c @SuppressUncheckedWarnings
d @Warningsuppress unchecked
What are the consequences of returning a reference to the bag array in the toArray method?
a the return variable is an alias for the private instance array variable
b the client will have direct access to the private instance array variable
c the client could change the contents of the private instance array variable without using the public access methods
d all of the above
Which one of the following is considered a safe and secure programming practice?
a identifying a group of core methods to implement first
b using generic data types
c validating input data and arguments to a method
d none of the above
Which one of the following is considered a safe and secure programming practice?
a making no assumptions about the actions of clients and users
b using @SupressWarning unchecked
c adding the comments and headers of the public methods to the class by copying them from the interface
d all of the above
When implementing the bag ADT, which scenario could result in a security problem?
a the programmer validates input data to a method
b a constructor throws an exception or error before completing its initialization
c generics are used to restrict data types of the entries in the collection
d a group of core methods is not defined
When implementing the bag ADT, which scenario could result in a security problem?
a a SecurityException is thrown in the constructor
b an IllegalStateException is thrown in the constructor
c a client attempts to create a bag whose capacity exceeds a given limit
d the delete method is implemented before the add method
An incomplete definition of a method is called a
a stub
b core method
c failsafe method
d security problem
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started