In the following code segment, str is a properly declared an…

In the following code segment, str is a properly declared and initialized string. The code segment is intended to count the number of times that “a” appears in str.     int count = 0; String temp = str;int loc = temp.indexOf(“a”);while (loc >= 0){ /* missing code */}   Which of the following can be used to replace /* missing code */ so that the code segment works as intended?

The following is an excerpt of a class specification that ap…

The following is an excerpt of a class specification that appears in an API library. public class RobotA Robot specifies a robot that moves around a two-dimensional coordinate grid.The Robot class has xCoordinate and yCoordinate variables that hold information about the robot’s location on thegrid.The Robot constructor initializes a Robot object with the given coordinates.The move() and rotate() methods are used to modify the robot’s location on the grid.   Based on the class specification, which of the following descriptions is accurate?

The figure below represents a network of physically linked d…

The figure below represents a network of physically linked devices labeled A through I. A line between two devices indicates that the devices can communicate directly with each other. Any information sent between two devices that are not directly connected must go through at least one other device. For example, in the network represented below, information can be sent directly between A and B, but information sent between devices A and G must go through other devices. Connections are represented by lines between the devices, as follows. Device A is connected to B and C. Device B is connected to A, D, E, and G. Device C is connected to A, D, F, and I. Device D is connected to B, C, and F. Device E is connected to B, F, G, and H. Device F is connected to C, D, E, H, and I. Device G is connected to B and E. Device H is connected to E and F. Device I is connected to C and F. What is the minimum number of connections that must be broken or removed before device B can no longer communicate with device C?