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?
Blog
In the following code segment, x is an int variable with a p…
In the following code segment, x is an int variable with a positive value. int temp = x; while (temp > 0){ temp -= 2;}System.out.println(temp == 0); Which of the following best describes the behavior of the code segment?
What is sequencing in the context of algorithms?
What is sequencing in the context of algorithms?
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?
If you ping too much, other computers might think you are a…
If you ping too much, other computers might think you are a hacker.
What is the output of the following code aList = [“Scout”, […
What is the output of the following code aList = [“Scout”, [2, 3, 44, 1]] print(aList[0][1]) print(aList[1][3])
Which of the following scenarios best exemplifies a phishing…
Which of the following scenarios best exemplifies a phishing attack?
A user unintentionally installs keylogging software on a com…
A user unintentionally installs keylogging software on a computer. Which of the following is an example of how the keylogging software can be used by an unauthorized individual to gain access to computing resources?
Which of the following expressions will get the last charact…
Which of the following expressions will get the last character in a string? Assume that word is a string variable. I. word[0]II. word[-1]III. word[len(word)]IV. word[len(word)-1]
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?