Question: True / False ( 5 ) 1 . Any methods that a core method might call are part of the core group. Answer: 2 .

True/False (5)
1. Any methods that a core method might call are part of the core group.
Answer:
2. You should never suppress compiler warnings.
Answer:
3. When defining the bag class write methods that have simple implementation first to get them out of the way.
Answer:
4. A final class is more secure than one that is not final.
Answer:
5. When testing a method, you only need to check for arguments that lie within the legal range of their corresponding parameter.
Answer:
Multiple Choice (10) Please highlight in YELLOW your entire answer.
01. Which of the following methods is a good candidate for a core method:
a. add()
b. clear()
c. contains()
d. remove()
02. Which of the following methods is a good candidate for a core method:
a. add()
b. toArray()
c. isArrayFull()
d. all of the above
03. 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 T[capacity];
b. bag = new Object[capacity];
c. bag = new (T[]) Object[capacity];
d. bag =(T[]) new Object[capacity];
04. Which instruction suppresses an unchecked-cast warning from the compiler?
a. @SuppressUnchecked()
b. @SuppressWarnings(unchecked)
c. @SuppressUncheckedWarnings()
d. @Warning(suppress unchecked)
05. 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
06. 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
07. 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
08. 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
09. 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
10. An incomplete definition of a method is called a _____.
a. stub
b. core method
c. fail-safe method
d. security problem

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!