Suzi coded a method to delete a target element (without returning it) as follows. What is wrong with this code? Hint: There is more than one issue.
```
1 void delete( Object[] array, int numElements, Object target ){
2 int i;
3 for ( i == 0; i <= numElements; i++ )
4 if ( array[i].equals( target ) )
5 break;
6 for ( ; i <= numElements; i++ )
7 array[i] = array[i+1];
8 }
```
Line# 3: i == 0
Supposed to be assignment (=)not check for equality (==)
Line# 3: i <= numElements
Loop will be off by one; should be i < numElements
Line# 5: break;
Not an error, but potentially confusing. The break will cause the for loop on line 3 to exit, which is what we need.
Line# 6: i <= numElements; should be i < ( numElements – 1 )
Lastly, numElements needs to be decremented only if target was found and deleted.
You might also like to view...
2. A cloud provider is deploying a new SaaS product comprised of a cloud service. As part of the deployment, the cloud provider wants to publish a service level agreement (SLA) that provides an availability rating based on its estimated availability over the next 12 months. First, the cloud provider estimates that, based on historical data of the cloud environment, there is a 25% chance that the physical server hosting the cloud service will crash and that such a crash would 2 days before the cloud service could be restored. It is further estimated that, over the course of a 12 month period, there will be various attacks on the cloud service, resulting in a total of 24 hours of downtime. Based on these estimates, what is the availability rating of the cloud service that should be published
What will be an ideal response?
Which of the following is the subset of files in a distribution share that are required for a particular answer file?
A. distribution set B. configuration set C. image set D. offline update