Consider the following method, inCommon, which takes two Integer ArrayList parameters. The method returns true if the same integer value appears in both lists at least one time, and false otherwise.
public static boolean inCommon(ArrayList a, ArrayList b)
{
for (int i = 0; i < a.size(); i++)
{
for (int j = 0; j < b.size(); j++) // Line 5
{
if (a.get(i).equals(b.get(j)))
{
return true;
}
}
}
return false;
}
Which of the following best explains the impact to the inCommon method when line 5 is replaced by for (int j = b.size() - 1; j > 0; j--) ?
A. The change has no impact on the behavior of the method.
B. After the change, the method will never check the first element in list b.
C. After the change, the method will never check the last element in list b.
D. After the change, the method will never check the first and the last elements in list b.
E. The change will cause the method to throw an IndexOutOfBounds exception.

Answers

Answer 1

Answer:

The answer is "Option b".

Explanation:

In the given code, a static method "inCommon" is declared, that accepts two array lists in its parameter, and inside the method two for loop is used, in which a conditional statement used, that checks element of array list a is equal to the element of array list b. If the condition is true it will return the value true, and if the condition is not true, it will return a false value. In this, the second loop is not used because j>0 so will never check the element of the first element.


Related Questions

Write a program to insert an array of letters (word), then arrange the letters in ascending order and print this array after the arrangement.​

Answers

Answer:

def split(word):  

   return [char for char in word]

word = input("Enter a word: ")

chars = split(word)

chars.sort()

sorted = ''.join(chars)

print(sorted)

Explanation:

Here is a python solution.

C6
D
E
F
B
SABROSA
Catering Invoice
Sabrosa Empanadas & More
1202 Biscayne Bay Drive
Orlando, FL 32804
Empanadas & More
Invoice #: 5690B
Date: 05/15/20
1
2
MENU ITEM
3 Empanadas: Poblano & Cheese
4 Empanadas: Spicy Sweet Potato
UNIT PRICE
$2.79
$2.29
SUBTOTAL
TOTAL W/ TAX
QUANTITY
35
20
S
6
7
8
9
Catering Invoice Catering Subtotal Challenge +
Calculation Mode: Automatic Workbook Statistics

Answers

Answer:

Catering Invoice

Sabrosa Empanadas & More

1202 Biscayne Bay Drive

Orlando, FL 32804

Empanadas & More

Invoice #: 5690B

Date: 05/15/20

1

2

MENU ITEM

3 Empanadas: Poblano & Cheese

4 Empanadas: Spicy Sweet Potato

UNIT PRICE

$2.79

$2.29

SUBTOTAL

TOTAL W/ TAX

QUANTITY

35

Explanation:

hi I think this is vorrect

Which of the following is NOT one of the Internet sources that hackers use to gather information about a company's employees?

1. Blogs
2. Company website
3. Social networking sites
4. Regional Internet registries

Answers

Answer:

4. Regional Internet registries

Explanation:

Cyber security can be defined as preventive practice of protecting computers, software programs, electronic devices, networks, servers and data from potential theft, attack, damage, or unauthorized access by using a body of technology, frameworks, processes and network engineers.

With cybersecurity theory, security standards, frameworks and best practices we can guard against cyber attacks and easy-to-guess passwords such as using alphanumeric password with certain composition and strength.

Some examples of the Internet sources that hackers use to gather information about a company's employees includes;

I. Blogs.

II. Company website.

III. Social networking sites.

However, Regional Internet registries cannot be used by hackers to gather information about a company's employees because it is an internet protocol resource organization saddled with the responsibility of allocating and registering internet protocol (IP) addresses.

being the server administrator how often will you conduct a server maintenance?

Answers

Weekly server checks

Nonetheless, a weekly check is essential. Another check you should do weekly or even every two weeks is your disk usage. Again, disk usage rarely suddenly changes so it's not something you need to check every day. However running out of disk space can mean that your server breaks down.

write an algorithm to find the average of six numbers​

Answers

Answer:

Input: two numbers x and y Output: the average of x and y Step 1 : input x,y Step 2: sum=0,average=0 Step 3:sum = x + y Step 4:average = sum /2 Step 5: print average.

Explanation:

Input: two numbers x and y Output: the average of x and y Step 1 : input x,y Step 2: sum=0,average=0 Step 3:sum = x + y Step 4:average = sum /2 Step 5: print average.

Algorithms are set of instructions which are to be followed in other to solve a particular problem. The algorithm which gives the average of six values goes thus:

1.)

Input : a, b, c, d, e, f

#takes input of the six numbers

2.)

sum=0 ; average=0

# initialize sum and average variables to 0

3.)

sum = a + b + c + d + e + f

#takes the sum of the six numbers

4.)

average = sum /6

#divide the sum by the number of values.

5)

print average.

#display the average value

Learn more : https://brainly.com/question/24266817

How do we use game maker?

Answers

Answer:

The easy to use powerful game engine that is the best for 2D games

Adding a paper clip to the vertical stabilizer of your glider will have what effect on its Center of Gravity (CG)?
The CG would move toward the rear.
The CG would stay the same.
The CG would move toward the nose.
O The CG would move lower

Answers

Answer:

the CG would move toward the rear.

Explanation:

Adding a paper clip to the vertical stabilizer of your glider will, the CG would move toward the rear. The correct option is A.

What is center of gravity?

The place on an item where the force of gravity is thought to act is known as the center of gravity (CG).

The gravitational pull is thought to be focused at the point where an object weighs on average. Depending on the object's size, shape, and mass distribution, the center of gravity will be in one place or another.

The impact of adding a paper clip to your glider's vertical stabilizer is to shift the center of gravity (CG) to the back of the glider.

This is due to the fact that the paper clip adds weight to the glider's rear, moving the center of mass there and, as a result, the center of gravity.

Thus, the correct option is A.

For more details regarding center of gravity, visit:

https://brainly.com/question/20662119

#SPJ6

The measure of software complexity that measure how complex a software is in machine's viewpoint in terms of how the size of the input data affects an algorithm's usage of computational resources is known as Computational Complexity.

a. True
b. False

Answers

Answer:

a. True

Explanation:

In Computer science, an algorithm can be defined as a standard formula or procedure which comprises of set of finite steps or instructions for solving a problem on a computer.

Basically, the time complexity of an algorithm is defined by f(n) if; for all "n" and all inputs with length "n" the execution of the algorithm takes a maximum of f(n) steps. Therefore, this is a measure of the efficiency of an algorithm.

Hence, the time complexity is a measure of the amount of time required by an algorithm to run till its completion of the task with respect to the length of the inpu

Computational complexity can be defined as a measure of software complexity that measure how complex a software is in machine's viewpoint in terms of how the size of the input data affects an algorithm's usage of computational resources such as memory or running time.

Write a method named numUnique that accepts a sorted array of integers as a parameter and that returns the number of unique values in the array. The array is guaranteed to be in sorted order, which means that duplicates will be grouped together. For example, if a variable called list stores the following values: int[] list

Answers

Answer:

The method in Java is as follows:

public static int numUnique(int list[]) {  

int unique = 1;  

for (int i = 1; i < list.length; i++) {  

 int j = 0;  

 for (j = 0; j < i; j++) {

  if (list[i] == list[j])  

   break;  

 }

 if (i == j)  

  unique++;  

}  

return unique;  

}  

Explanation:

This line defines the numUnique method

public static int numUnique(int list[]) {

This initializes the number of unique elements to 1

int unique = 1;  

This iterates through the list

for (int i = 1; i < list.length; i++) {

The following iteration checks for unique items

 int j = 0;  

 for (j = 0; j < i; j++) {

  if (list[i] == list[j]) If current element is unique, break the iteration

   break;  

 }

 if (i == j)  

  unique++;  

}

This returns the number of unique items in the list

return unique;  

}  

Write a constructor for BaseballPlayer. The constructor takes three int parameters: numHits, numRuns, and numRBIs storing the values within the class' ArrayList field named playerStats.

Answers

Answer:

Following are the code to the given question:

public class BaseballPlayer//defining a class BaseballPlayer

{

BaseballPlayer(int numHits, int numRuns, int numRBIs)//defining a parameterized cons

{

}

}

Explanation:

Some of the data is missing, which is why the solution can be represented as follows:

In this code, a class BaseballPlayer is defined, and inside the class a parameterized constructor is defined that holds three integer variable "numHits, numRuns, and numRBIs".

At Moore High, 456 students attended the prom. This is 65 more students than
the previous year.
To the nearest percent, what is the percent of increase from last year to this
year?
12%
15%
17%
19%

Answers

Answer:

B-15%

Explanation:

Yes I agree the answer is B 15%

A type of SDLC in which each phase has results that flow into the next phase is called the __________ model.

Answers

Answer : a type of SCLC in which each phase has results that flow into the next phase is called the waterfall model. Hope that helps (:

The Circle and CircleTester have been created, but they have errors. The public and private settings for variables and methods are not all correct.
Your job is to go through and fix them. You will need to make edits in both files to get them working correctly, but once complete, your output should match the output below.
Sample Output:
Circle with a radius of 5.0
The diameter is 10.0
The perimeter is 31.41592653589793
CIRCLE.JAVA
public class Circle {
public double radius;
private Circle(double myRadius) {
radius = myRadius;
private void setRadius(int myRadius){
radius = myRadius;
}
private double getDiameter() {
return radius*2;
}
public double getRadius() {
return radius;
}
private double getPerimeter() {
return Math.PI*getDiameter();
}
private String toString() {
return "Circle with a radius of " + radius;
}
}
CIRCLE TESTER.JAVA
public class CircleTester {
public static void main(String[] args) {
Circle circ = new Circle(10);
circ.radius = 5;
System.out.println(circ);
System.out.println("The diameter is " + circ.getDiameter());
System.out.println("The perimeter is " + circ.getPerimeter())
}
}

Answers

Answer:

CIRCLE.JAVA

public class Circle {

  private double radius;

  public Circle(double myRadius) {

    radius = myRadius;

    private void setRadius(int myRadius){

    radius = myRadius;

 }

 public double getDiameter() {

    return radius*2;

 }

 public double getRadius() {

   return radius;

 }

 public double getPerimeter() {

   return Math.PI*getDiameter();

 }

 public String toString() {

    return "Circle with a radius of " + radius;

 }

}

CIRCLE TESTER.JAVA

public class CircleTester {

 public static void main(String[] args) {

    Circle circ = new Circle(10);

    circ.radius = 5;

    System.out.println(circ);

    System.out.println("The diameter is " + circ.getDiameter());

    System.out.println("The perimeter is " + circ.getPerimeter())

 }

}

Explanation:

public class Circle {

  //This could be made private or public.

  //Making it private is better

  private double radius;

  //This is a constructor. It should be made public

  //since it would most likely be used in another class

  //to create an object of this class.

  //Making it private means no other external class can create

  //an object of this class.

  //Since the tester class (CIRCLETESTER.java), as shown on line 3,

  // needs to create

  //an object of this class, this should be made public

  public Circle(double myRadius) {

    radius = myRadius;

    private void setRadius(int myRadius){

    radius = myRadius;

 }

 //This should be made public since it will be

// used in another class (CIRCLETESTER.java in this case)

 public double getDiameter() {

    return radius*2;

 }

 public double getRadius() {

   return radius;

 }

 //This should be made public since it will be

 //used in another class (CIRCLETESTER.java)

 public double getPerimeter() {

   return Math.PI*getDiameter();

 }

 //The toString() method is the string representation

 //of an object and is called when there is an attempt to

 //print the object. It should be made public since it will

 //be used in another class (CIRCLETESTER.java)

 public String toString() {

    return "Circle with a radius of " + radius;

 }

}

CIRCLE TESTER.JAVA

public class CircleTester {

 public static void main(String[] args) {

    Circle circ = new Circle(10);

    circ.radius = 5;

    System.out.println(circ);

    System.out.println("The diameter is " + circ.getDiameter());

    System.out.println("The perimeter is " + circ.getPerimeter())

 }

}

12. What was the trade Howard offered to Death?​

Answers

Answer:

His life

Explanation:

The tool chest for programmers is also known as the CPU.
True or False?

Answers

Explanation:

I would say yes, but I'm not sure

Yeah I’m pretty sure it’s true

Finish the program to compute how many gallons of paint are needed to cover the given square feet of walls. Assume 1 gallon can cover 350.0 square feet. So gallons = the square feet divided by 350.0. If the input is 250.0, the output should be:

0.714285714286

Answers

Answer:

gallons_paint = wall_area / 350.0

Explanation:

So gallons = the square feet divided by 350.0:

So gallons = gallons_paint

the square feet = wall_area

then divide by 350.0

the whole thing:

wall_area = float(input())

# Assign gallons_paint below

gallons_paint = wall_area / 350.0

print(gallons_paint)

The program to compute how many gallons of paints are needed to cover the given square feet's of walls is as follows:

def square_feet_to_gallons(area):

  gallons = area / 350

  return gallons

print(square_feet_to_gallons(250))

1 gallon covers 350 square feet.

Therefore, gallons = area / 350

The user inputs is the area in square feet. Then the output should be the number of gallons.

The code explanation python.

We declared a function named square_feet_to_gallons and the argument is area.

Then we declared a variable and assigned the mathematical operation area/350 to it.

Then we return the gallons.

Finally, we call the function with a print statement.

learn more on programming here:https://brainly.com/question/14469650?referrer=searchResults

divide the difference of 47 and 23 by the difference of 25 &13​

Answers

Answer:

The answer is 2

Explanation:

write down the name of output devices

Answers

Answer:

Monitor

Printer

Headphones

Computer Speakers

Projector

GPS

Sound Card

Video card

Explanation:

monitor

printer

headphones

computer speakers

projector

GPS

sound card

video card

hope it helps you

plese follow me

attribute variables have the same meaning as participants variables. is this true or false?​

Answers

Answer:

true

Explanation:

because I said so dude

Which of the following is not a form of technology?

A) computer

B) ketchup

C) pencil

D) umbrella

Answers

Answer:

ketchup because all of the others are objects with certain creative functions but ketchup is just K e t c h u p.

Answer:
A well known answer yes u guessed ryt it’s “Ketchup”.
Horaayy felicitations to u


Now back to the question, according to the definition of “technology”:
“An equipment or machinery made by engineering or applied science/sciences is called technology”.
As u can c that ketchup is this certainly not a technology rather a recipe/food item etc.

What email program would you suggest and why?

Answers

Answer:

An email program

Explanation:

And why?

Answer:

I would suggest g m a i l.

Explanation:

I use G m a i l all the time and I think it is easy to use! A lot of people think it is great too! :)

HELP AASAP BRAINLIEST JUST HELP

Answers

Answer:

d

Explanation:

plz brainliest

Complete the getOdds method so it returns a new ArrayList of Integers containing all odd Integers from the parameter ArrayList vals in the order they originally appeared. The contents of vals should not change. For example if an ArrayList containing the Integers 2,5,8,6,7,3, 12 in that order is passed as a parameter to getOdds, it should return an ArrayList containing the Integers 5, 7,3 in that order. Write your getOdds method in the U7_L2_Activity Three class. Use the runner class to test your method but do not add a main method to your U7_L2_Activity Three.java file or your code will not be scored correctly.

Answers

Answer:

Following are the code to this question:

import java.util.*;//import package for user-input

public class U7_L2_Activity Three//defining  class U7_L2_Activity Three

{

  public static ArrayList<Integer> getOdds(ArrayList<Integer> val)//defining a static method getOdds as an ArrayList

  {

      ArrayList<Integer> odd = new ArrayList<Integer>();//creating ArrayList Object  

      int i; //defining integer variable  

      for(i=0;i<val.size();i++)//defining for loop for calculating odd values

      {

          if(val.get(i)%2!=0)//defining if block to check odd numbers

          {

              odd.add(vals.get(i));//add values in odd ArrayList  

          }

      }

      return odd;//return ArrayList odd

  }

  public static void main(String[] asr)//defining main method

  {

      int l,i;//defining integer variable

      Scanner sob = new Scanner(System.in);//creating Scanner calss Object

      ArrayList<Integer> num = new ArrayList<Integer>();//creating ArrayList object  

      System.out.println("Enter length of the ArrayList: ");//print message

       l = scan.nextInt();//input length value

      System.out.println("Enter ArrayList values: "); //print message  

      for(i = 0; i < l; i++)//use for to input value  

      {

          num.add(sob.nextInt());//input value

      }

      System.out.println("Odds list: " + getOdds(num));//calling method getOdds

      System.out.println("Original list: " + num);//print array value

  }

}

Output:

Enter ArrayList length:

7

Enter values:

2

5

8

6

7

3

12

Odds list: [5, 7, 3]

Original list: [2, 5, 8, 6, 7, 3, 12]

Explanation:

In the above-program inside the class, a static method "getOdds "is declared, that accepts an array list in its parameters, and defined an array list "odd", in this a for loop is defined, that check the odd numbers in the array and add the value in the odd Arraylist, and returns its values.

Inside the main method is defined that creates scanner class object for input array value and pass the value into the method "getodds" and print its return values.

What effect would excluding quotation marks from a search phrase have?
A.
It would narrow down the search.
B.
It would have little or no impact on the search.
C.
It would broaden the search.
D.
It would cause the search engine to bring up very different results.

Answers

Answer: C

 it would broaden the search

Explanation:

Placing quotation marks around a search term or phrase limits your search to that exact term or phrase. Without the quotes, your search engine may return all results that contain each separate word. Placing AND between your keywords will return results that only include both or all your keywords.

Answer:

The answer is C. It would broaden the search.

Explanation:

I got it right on the Edmentum test.

Why are object-oriented languages very popular?
They can use flowcharts.
They can use pseudocode.
They are powerful, clear, and efficient.
They don't use binary.

Answers

Answer:

Explanation:

Other advantages of object-oriented programming languages are you can use it to kinds of web applications for thorough data analysis, less development time, accurate coding, easy testing, reusability, debugging, less data corruption, and maintenance.

What is the relationship between a database and an information system and what impact does this relationship have on database design?
Respond to one or both of the following statements:

a. It is impossible to produce good information from poor data.
b. No matter how sophisticated the application programs are, it is impossible to use good application programs to overcome the effects of bad database design.

Answers

Answer:

b

Explanation:

hhiivibibu9 gg8 oh 8h h9 h 0h9

Why are object-oriented languages very popular?
They can use flowcharts.
They can use pseudocode.
They are powerful, clear, and efficient.
They don't use binary.

Answers

Answer: I don't know the Choices but I can give u an example.

Explanation:

Other advantages of object-oriented programming languages are you can use it to kinds of web applications for thorough data analysis, less development time, accurate coding, easy testing, reusability, debugging, less data corruption, and maintenance.

Answer:

They are powerful, clear, and efficient.

Explanation:

write a short note on Magnetic tape as a secondary storage device​

Answers

Answer:

In magnetic tape only one side of the ribbon is used for storing data. It is sequential memory which contains thin plastic ribbon to store data and coated by magnetic oxide. Data read/write speed is slower because of sequential access. It is highly reliable which requires magnetic tape drive writing and reading data.

Explanation:

compare and contrast Charles bebbage and Blaise Pascal inventions

Answers

Explanation:

A computer might be described with deceptive simplicity as “an apparatus that performs routine calculations automatically.” Such a definition would owe its deceptiveness to a naive and narrow view of calculation as a strictly mathematical process. In fact, calculation underlies many activities that are not normally thought of as mathematical. Walking across a room, for instance, requires many complex, albeit subconscious, calculations. Computers, too, have proved capable of solving a vast array of problems, from balancing a checkbook to even—in the form of guidance systems for robots—walking across a room.

Before the true power of computing could be realized, therefore, the naive view of calculation had to be overcome. The inventors who laboured to bring the computer into the world had to learn that the thing they were inventing was not just a number cruncher, not merely a calculator. For example, they had to learn that it was not necessary to invent a new computer for every new calculation and that a computer could be designed to solve numerous problems, even problems not yet imagined when the computer was built. They also had to learn how to tell such a general problem-solving computer what problem to solve. In other words, they had to invent programming.

They had to solve all the heady problems of developing such a device, of implementing the design, of actually building the thing. The history of the solving of these problems is the history of the computer. That history is covered in this section, and links are provided to entries on many of the individuals and companies mentioned. In addition, see the articles computer science and supercomputer.

Early history

Computer precursors

The abacus

The earliest known calculating device is probably the abacus. It dates back at least to 1100 BCE and is still in use today, particularly in Asia. Now, as then, it typically consists of a rectangular frame with thin parallel rods strung with beads. Long before any systematic positional notation was adopted for the writing of numbers, the abacus assigned different units, or weights, to each rod. This scheme allowed a wide range of numbers to be represented by just a few beads and, together with the invention of zero in India, may have inspired the invention of the Hindu-Arabic number system. In any case, abacus beads can be readily manipulated to perform the common arithmetical operations—addition, subtraction, multiplication, and division—that are useful for commercial transactions and in bookkeeping.

The abacus is a digital device; that is, it represents values discretely. A bead is either in one predefined position or another, representing unambiguously, say, one or zero.

Analog calculators: from Napier’s logarithms to the slide rule

Calculating devices took a different turn when John Napier, a Scottish mathematician, published his discovery of logarithms in 1614. As any person can attest, adding two 10-digit numbers is much simpler than multiplying them together, and the transformation of a multiplication problem into an addition problem is exactly what logarithms enable. This simplification is possible because of the following logarithmic property: the logarithm of the product of two numbers is equal to the sum of the logarithms of the numbers. By 1624, tables with 14 significant digits were available for the logarithms of numbers from 1 to 20,000, and scientists quickly adopted the new labour-saving tool for tedious astronomical calculations.

Most significant for the development of computing, the transformation of multiplication into addition greatly simplified the possibility of mechanization. Analog calculating devices based on Napier’s logarithms—representing digital values with analogous physical lengths—soon appeared. In 1620 Edmund Gunter, the English mathematician who coined the terms cosine and cotangent, built a device for performing navigational calculations: the Gunter scale, or, as navigators simply called it, the gunter. About 1632 an English clergyman and mathematician named William Oughtred built the first slide rule, drawing on Napier’s ideas. That first slide rule was circular, but Oughtred also built the first rectangular one in 1633. The analog devices of Gunter and Oughtred had various advantages and disadvantages compared with digital devices such as the abacus. What is important is that the consequences of these design decisions were being tested in the real world.

Digital calculators: from the Calculating Clock to the Arithmometer

In 1623 the German astronomer and mathematician Wilhelm Schickard built the first calculator. He described it in a letter to his friend the astronomer Johannes Kepler, and in 1624 . .

Boolean, integer, string, and float are examples of:
constants.
recursions.
loops.
variables.

Answers

Answer:

variables

Explanation:

They are all examples of variables
Other Questions
Help please due now!! A benefit of European exploration wasA. the effect of diseases on American Indian populationsB. the forced conversion of people to ChristianityC. increased knowledge of the worldD. the loss of unique world culturesPlease select the best answer from the choices provided Angles in a triangle Is x2 + 10x + 20 a perfect square trinomial? Yes or no Indicate whether each statement about the video is cierto or falso.1. There is a statue of Velzquez outside of the Prado.ciertoORfalso2. The paintings of El Greco shown are landscapes.ciertoORfalso3. The works of Goya shown are portraits.ciertoORfalso4. Las meninas is displayed on the same wall as several other Velzquez paintings.cierto ORfalso What fraction is greater than -2/3 and less than -1/2A. -3/4 B. -7/12 C. -5/12 D. -3/8 2/3 answer correctly for brainiest HELP!!!! The length of time food is cooked and the cooking technique you use determine how much _________________________ a food will retain. for culinary arts What is the minimum value of the function g (2) = x2 - 6x 12?-213+ V2133-21 How do you use PACED properly? A rectangular reflecting pool is 85.0 ft wide and 120 ft long. What is the area of the pool in square meters? I know what the answer is but the teacher wants me to explain helpppppp an object,diagram,or computer program that helps us understood something by making it easier to see it is...... Help Fast. The question is in an image because there is a graph to see. at stp what is the volume of 5.35 moles of methane ch4 UDD Question 6 10 pts Solve for x. Round to the nearest tenth (one decimal place). Just type the number, no unit of measurement. G X 240 DI F 48 Next * Previous please help, this is my homework and I am a little confused Boolean, integer, string, and float are examples of:constants.recursions.loops.variables. What is the relationship between the pairs in the following analogy?Microphone : music as diary : memories.O A. One is used to record the other.B. One is used to create the other.C. Both are used by people of the same age group.D. One is used to manage the other. I need help with this one