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:

b. After the change, the method will never check the first element in list b.

Explanation:

After changing the code on line 5 with the one in the question the method will never check the first element in list b. This is because by changing the code you are telling the method to run for every element in list b starting from the last element and moving backward. Since the second argument is j > 0, once j is equal to 0 it will not run the method since it would give a False on the argument and therefore, will never run the method for the element in position 0 (first element in the list)


Related Questions

Suppose the following sequence of bits arrives over a link:
11010111110101001111111011001111110
Show the resulting frame after any stuffed bits have been removed. Indicate any errors that might have been introduced into the frame.

Answers

Answer:

ok

Explanation:

(Python)
Summary: Given integer values for red, green, and blue, subtract the gray from each value.

Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray).

Given values for red, green, and blue, remove the gray part.

Ex: If the input is:

130
50
130
the output is:

80 0 80
Find the smallest value, and then subtract it from all three values, thus removing the gray.

Answers

r=int(input("Enter the red value: "))

g=int(input("Enter the green value: "))

b=int(input("Enter the blue value: "))

m=min([r,g,b])

print(str(r-m)+" "+str(g-m)+" "+str(b-m))

I wrote my code in python 3.8. I hope this helps

Malcolm Movers charges a base rate of $200 per move plus $150 per hour and $2 per mile. Write a program named MoveEstimator that prompts a user for and accepts estimates for the number of hours for a job and the number of miles involved in the move and displays the total moving fee. For example, if 25 hours and 55 miles are input the output would be displayed as: For a move taking 25 hours and going 55 miles the estimate is $4,060.00

Answers

Answer:

import java.util.Scanner;

public class MoveEstimator

{

public static void main(String[] args) {

   

    Scanner input = new Scanner(System.in);

    final int BASE_RATE = 200, RATE_PER_HOUR = 150, RATE_PER_MILE = 2;

    int hours, miles;

    double totalFee = 0.0;

   

 System.out.print("Enter the number of hours for a job: ");

 hours = input.nextInt();

 System.out.print("Enter the number of miles: ");

 miles = input.nextInt();

 

 totalFee = BASE_RATE + (hours * RATE_PER_HOUR) + (miles * RATE_PER_MILE);

 System.out.printf("For a move taking %d hours and going %d miles the estimate is $%.2f", hours, miles, totalFee);

}

}

Explanation:

*The code is in Java.

Create the Scanner object to be able to get input

Initialize the constant values using final keyword, BASE_RATE, RATE_PER_HOUR, RATE_PER_MILE

Declare the variables, hours, miles, totalFee

Ask the user to enter the hours and miles

Calculate the totalFee, add BASE_RATE, multiplication of  hours and RATE_PER_HOUR, multiplication of  miles and RATE_PER_MILE

Print the output as in required format

The program named MoveEstimator that prompts a user for and accepts estimates for the number of hours for a job and the number of miles involved in the move and displays the total moving fee is as follows:

x = int(input("number of hours for the job "))

y = int(input("number of miles involved "))

def MoveEstimator(x, y):

 

  return 200 + 150*x + 2*y

print(MoveEstimator(x, y))

Code explanation:The first line of code used the variable, x to store the input of the hours for the jobThe second line of code is used to store the input of the number of miles travelled. Then, we define a function that accept the users inputs(argument) as variable x and y. Then return the mathematical operation to find the total moving fee.Finally, we call the function with a print statement.

learn more on python code here: https://brainly.com/question/22841107

A common programming operation is to swap or exchange the values of two variables. If the value of x is currently 19 and the value of y is 42, swapping them will make x into 42 and y into 19. Write a program named Swap.java that allows the user to enter two int values. The program should store those values into variables and then swap the variables. Print the values of both variables before and after the swap. You will receive full credit as long as your solution works, but try to do this using as few variables as possible

Answers

Answer:

import java.util.Scanner;

public class Swap

{

public static void main(String[] args) {

   

    Scanner input = new Scanner(System.in);

    int x, y, t;

 System.out.print("Enter the first variable: ");

 x = input.nextInt();

 System.out.print("Enter the second variable: ");

 y = input.nextInt();

 

 System.out.printf("Values before the swap -> x = %d, y = %d\n", x, y);

 

 t = x;

 x = y;

 y = t;

 

 System.out.printf("Values after the swap -> x = %d, y = %d\n", x, y);

}

}

Explanation:

Import the Scanner class

Create a Scanner object to be able to get input from the user

Declare the variables, x, y, and t - the variable t will be used as temporary variable that will hold the value of x

Ask the user to enter the first and second variables

Print the values before swap

Assign the value of x to the t

Assign the value of y to the x (Now, x will have the value of y)

Assign the value of the t to the y (Since t holds the value of x, y will have the value of x)

Print the values after the swap

Irene wants to connect your smart phone wirelessly to her laptop in order to transfer images. which two images could she reasonably employee to connect these devices​

Answers

Answer:

Your Phone: Enable Photo Sharing

Explanation:

On your Windows 10 PC, return to the Your Phone app. Click the Settings icon at the bottom of the window and turn on the switch under "Allow this app to show photos from my phone" if it’s not already enabled.

17. Select the correct answer.
Which printing technique involves working on precise codes that are encoded and stored in a storage medium?
A.
computer numerical control
B.
electrostatic printing
C.
emboss printing
D.
offset printing
E.
gravure printing

Answers

Answer:

The right choice is option A (Computer numerical control).

Explanation:

A way to consolidate machine equipment monitoring by using programming implemented throughout the personal computer systems intimately familiar with that technology would be readily accessible. This would be widely utilized in the manufacture of thermoplastic design as well as manufacturing components.

Any other solutions just shouldn't apply to the above case. So the above is the appropriate solution.

Write a piece of codes that asks the user to enter a month (an integer), a day (another integer), and a two-digit year. The program should then determine whether the month times the day is equal to the year. If so, it should display a message saying the date is magic. Otherwise, it should display a message saying the date is not magic.
#include
using namespace std;
int main()
{
int day;
int month;
int year;
cout<<"enter year"< cin>>year;
cout<<"enter day"< cin>>day;
cout<<"enter month"< cin>>month;
//programology..
if(month*day==year)
{
cout<<"its magic programology year"< }
else
{
cout<<"its not magic year"< }
}

Answers

Answer:

Follows are the code to this question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

int day,month,year;//defining integer variable

cout<<"please enter last two digit of the year: "; //print message

cin>>year;//input year value

cout<<"enter day: "; //print message

cin>>day;//input day value

cout<<"enter month: ";//print message

cin>>month;//print month message

if(month*day==year)//check magic date condition  

{

cout<<"its magic programology year";//print message

}

else

{

cout<<"its not magic year";//print message

}

return 0;

}

Output:

please enter last two digit of the year: 98

enter day: 14

enter month: 7

its magic programology year

Explanation:

In the given code, three integer variable "day, month, and year" is declared, that uses the input method "cin" to input the value from the user-end.

In the next step, an if block statement is used that check month and day value multiple is equal to year value, if the condition is true it will print "magic programology year" otherwise it will print "not the magic year".

list four devices associated with video conferencing​

Answers

Answer:

Video camera

2) Microphone

3) Speakers on the device being used.

4) Internet connection

Explanation:

pls mark brainliest

1)Camera

2) microphone

3)computer

4)internet

5) speaker



Despite all of the trouble that Percy and his friends are encountering, why do you think he continues on his quest? What does that say about his character?

Answers

Answer:

To be like his dad maybe I don't a 100%

7.4 question 1 edhesive

Answers

Answer:

huh

Explanation:

what do you mean? the question doesn't make any sense

Answer:

def GPAcalc(g):

   if g == "a" or g == "A":

       return 4

   elif g == "B" or g == "b":

       return 3

   elif g == "C" or g == "c":

       return 2

   elif g == "D" or g == "d":

       return 1

   elif g == "F" or g == "f":

       return 0

   else:

       return "Invalid"

grade = input("Enter your Letter Grade: ")

gpa = GPAcalc(grade)

print("Your GPA score is: " + str(gpa))

Explanation:

a customer calls complaining their laptop wont start what should I say

Answers

Answer:

tell them to bring there laptop to you so you can explain how to get them out of situations like those. Or maybe do a video call so the person can show you whats going on and you can take it on from there guiding her on how to fix it...

Explanation:

Which command will provide us with a list of the available internal commands (commands that are part of Command Prompt, such as CD and DIR - not IPCONFIG or NETSTAT) of Command Prompt?

Answers

Answer: $help

Explanation:

Not sure which terminal you are using, but "help" in the terminal outputs available internal commands.

Complete the sentence.
If you wanted the best performance for a game that requires a powerful graphics processor and lots of memory, you
would run it on a
tablet
desktop
smartphone

Answers

You would run it on a desktop, as they usually can process things much better.

Write a program in your favorite language (e.g., C, Java, C , etc.) to convert max. 32 bit numbers from binary to decimal. The user should type in an unsigned binary number. The program should print the decimal equivalent. You should write a program from scratch that performs the conversion, please do not use built in functions. Please provide a screenshot of your program running on these values: 111011012 110000110011110101110101011101012 Please also include your source code together with your answers to assignment questions.

Answers

Answer:

In Python:

bin = int(input("Binary Number: "))

num = str(bin)

dec = 0

for i in range(len(num)):

   dec = dec + int(num[i]) * 2**int(len(num)-i-1)

   

print("Decimal Equivalent: "+str(dec))

Explanation:

Note that the program assumes that the user input will be valid. So, error check was done in the program

This line gets the binary number from the user

bin = int(input("Binary Number: "))

This converts the inputted number to string

num = str(bin)

This initializes decimal number to 0

dec = 0

This iterates through the string number

for i in range(len(num)):

This converts the number to decimal

   dec = dec + int(num[i]) * 2**int(len(num)-i-1)

This prints the result of the conversion    

print("Decimal Equivalent: "+str(dec))

See attachment for screenshots

5. Select the correct answer.
Henry uploaded the photos of his birthday to a cloud storage system. He feels that it’s a safe option for data storage. His friend suggested that there may be a disadvantage to cloud storage. Which disadvantage is Henry’s friend referring to?
A.
The owner may not be able to delete the data after the upload.
B.
The file format of the images may be corrupted.
C.
The service can sell the data without notifying the owner.
D.
People can alter the data without notifying the owner.
E.
The data is not under the owner’s direct control.

Answers

Answer: E.  The data is not under the owner’s direct control.

Explanation:

A massive disadvantage to cloud storage is that the data stored is ot under the direct control of the person uploading. They first have to access the service and that service is owned by the company offering the cloud storage.

If for any reason the company decides not to give access (depending on local laws), or if the company suffers a problem that affects its ability to offer the service, the person who uploaded could lose access to their data.

Select all the correct answers. Which two statements are true about an OS? translates the user's instructions into binary to get the desired output needs to be compulsorily installed manually after purchasing the hardware is responsible for memory and device management delegates the booting process to other devices is responsible for system security Reset Next​

Answers

Answer:

C. is responsible for memory and device management.

E. is responsible for system security.

Explanation:

An operating system platform is a system software pre-installed on a computing device to manage or control software application, computer hardware and user processes.

This ultimately implies that, an operating system (OS) is essentially an interface between the computer’s hardware and all the software applications (programs) running on it.

Some examples of an operating system are QNX, Linux, OpenVMS, MacOS, Microsoft windows, IBM, Solaris, VM, Ubuntu, etc.

The two statements which are true about an operating system (OS) are;

I. It's responsible for memory and device management. The operating system (OS) ensures proper allocation of memory to processes and manages all the input/output devices that are connected to the computer.

II. It's responsible for system security. The operating system (OS) makes sure the data integrity of a computer system isn't compromised i.e determining whether or not a request is to be processed through an authentication process.

5. Played electronically by manipulating images on a television screen produced by a
computer program often emphasizing fast action
mi Yoko
tor of the "GAME BOY" and "Game and Watch hand held systems​

Answers

Answer:

1) Video Games

2) Gunpei Yokoi

Explanation:

1) Video games are electronic games played off electronic consoles which are connected to Visual Display Units such as desktops or laptops and flat=screen televisions. The games are created in such a way that images can be manipulated using a pad and controlled by the computer program.

2) Gunpei Yokoi person who made the "game boy" and "game and watch" hand-held games.

He was recognized posthumously for his achievements in 2003 when he was offered a lifetime achievement award from the international game developers association.

Cheers

write an algorithm and draw a flowchart to calculate the sum of of the first 10 natural numbers starting from 1​

Answers

Answer:

#include <stdio.h>

void main()

{

int j, sum = 0;

printf("The first 10 natural number is :\n");

for (j = 1; j <= 10; j++)

{

sum = sum + j;

printf("%d ",j);

}

printf("\nThe Sum is : %d\n", sum);

}

Within a loop

Step 1: Initialize a variable to 1 (say x=1)

Step 2: Specifiy the condition

In this case x<=10

Step 3: Increment the variable by 1

using increment operator x++

OR

simply x+=1(x=x+1)

Step 4: Print the value of variable

Terminate the loop

Explanation:

Write a C# program named ProjectedRaises that includes a named constant representing next year’s anticipated 4 percent raise for each employee in a company. Also declare variables to represent the current salaries for three employees. Assign values to the variables, and display, with explanatory text, next year’s salary for each employee. Note: For final submission assign the following current salaries for the employees: 25000 for employee 1, 38000 for employee 2, 51000 for employee 3. Then next year's salary for employee 1 would be displayed as: Next year's salary for the first employee will be $26,000.00

Answers

Answer:

using System;

class ProjectedRaises {

 static void Main() {

     const float raise = 0.04f;

     double salary1 = 0.0f,salary2 = 0.0f,salary3 = 0.0f;

Console.WriteLine("Current salary for each employee: ");

     salary1 = Single.Parse(Console.ReadLine());

     salary2 = Single.Parse(Console.ReadLine());

     salary3 = Single.Parse(Console.ReadLine());

     salary1 = salary1 + raise * salary1;

     salary2 = salary2 + raise * salary2;

     salary3 = salary3 + raise * salary3;

     Console.WriteLine("Next year salary for the employees are: ");

     Console.WriteLine(Math.Round(salary1));

     Console.WriteLine(Math.Round(salary2));

     Console.WriteLine(Math.Round(salary3));

}

}

Explanation:

This declares and initializes variable raise as a float constant

     const float raise = 0.04f;

This declares the salary of each employee as double

     double salary1 = 0.0f,salary2 = 0.0f,salary3 = 0.0f;

This prompts the user for the salaries of the employee

Console.WriteLine("Current salary for each employee: ");

The next three lines get the salary of the employees

     salary1 = Single.Parse(Console.ReadLine());

     salary2 = Single.Parse(Console.ReadLine());

     salary3 = Single.Parse(Console.ReadLine());

The next three lines calculate the new salaries of the employees

     salary1 = salary1 + raise * salary1;

     salary2 = salary2 + raise * salary2;

     salary3 = salary3 + raise * salary3;

This prints the header

     Console.WriteLine("Next year salary for the employees are: ");

The next three lines print the new salaries of the employees

     Console.WriteLine(Math.Round(salary1));

     Console.WriteLine(Math.Round(salary2));

     Console.WriteLine(Math.Round(salary3));


What is the total March Expenditure now? (cell Q2)

Answers

I did a lot to do it lol was

The more employees can do, the less they have to be managed by supervisors.


Please select the best answer from the choices provided

T
F

Answers

False
Don’t take me too seriously cause I could be wrong, but I think it’s false. Unless the employees are like the best hardworking employees, they will likely slack off the second they get the chance. The more they can do just means that they can do more, it doesn’t necessary mean they need less supervision

Answer:

True

Explanation:

import java.util.ArrayList;
import java.util.List;
/**
* Fix the problem in the following code by changing the Point class only,
* without touching the code in main(). Make only the necessary changes.
*/
public class PointTest {
static final class Point {
private double x, y;
List points = new ArrayList<>();
Point(double x, double y) {
this.x = x;
this.y = y;
}
}
public static void main(final String[] args) {
List pointList = new ArrayList<>();
pointList.add(new Point(1, 2));
pointList.add(new Point(3, 4));
System.out.println(pointList.size());
// remove the second Point
pointList.remove(new Point(3, 4));
System.out.println(pointList.size());
// Not removed!
}
}

Answers

Answer:

Explanation:

The following code was fixed but it is impossible to fix the entirety of the code without adjusting the Main method as well. This is because the information is being saved in an ArrayList that is saved within the main method. This means that either we need to move the Arraylist outside of the main method or adjust something inside the main method as well to make the code run. In this iteration, I have added an IF statement to the Point method so that it deletes a point if it is being added for a second time. In order to accomplish this, I had to add an extra argument when calling the Point Method in the Main method which would be the ArrayList in which the information is saved.

import java.util.ArrayList;

import java.util.List;

class PointTest {

   static final class Point {

       private double x, y;

       Point(double x, double y, List<Point> points) {

           this.x = x;

           this.y = y;

           for (int i = 0; i < points.size(); i = i+1) {

               if ((points.get(i).x == x) && (points.get(i).y == y)) {

                   points.remove(i);

               }

           }

       }

   }

   public static void main(final String[] args) {

       List<Point> pointList = new ArrayList<>();

       pointList.add(new Point(1, 2, pointList));

       pointList.add(new Point(3, 4, pointList));

       System.out.println(pointList.size());

// remove the second Point

       pointList.remove(new Point(3, 4, pointList));

       System.out.println(pointList.size());

// REMOVED!!!!!

   }

}

Pls awnser if awnser is wrong I will unmark brainliest

Answers

Answer: i think 1, 3, and 4

Explanation:

what do mean by cpu? example

Answers

Explanation:

The main computer case containing the central components of a personal computer is CPU.

The central processing unit (CPU) can be defined as the brain of the computer, it also takes the raw data and turns it into information.

Which methods will remove filters? Check all that apply.
A. In the navigation icons area, click Remove Filter.
B. In the Home Tab, in the Sort & Filter group, click Cancel.
C. On the File tab, click Save Object As, and save the table.
D. On the Home tab, in the Sort & Filter group, click Remove Filter.
E. Click the drop-down menu in the filtered column, then click Clear Filter.
F. In the Record Navigation bar, click the Filter warning, and unclick Filter.

Answers

Answer:

The last three options are the correct ones

Explanation:

Answer:

Not sure, but maybe DEF

Explanation:

(3)(6 Points) During a sale at a store, a 10% discount is applied to purchases over $10.00. Write a program that asks for the amount of a purchase, then calculates the discounted price. The purchase amount will be input in cents (as an integer). These are two examples of your expected program's execution.

Answers

I only need point sort

An analogue sensor has a bandwidth which extends from very low frequencies up to a maximum of 14.5 kHz. Using the Sampling Theorem, what is the minimum sampling rate (number of samples per second) required to convert the sensor signal into a digital representation?

If each sample is now quantised into 2048 levels, what will be the resulting transmitted bitrate in kbps?

Give your answer in scientific notation to 1 decimal place.

Hint: you firstly need to determine the number of bits per sample that produces 2048 quantisation levels

Answers

Answer:

3.2*10^5

Explanation:

By Nyquist's theorem we must have 2*14.5kHz=29kHz so 29,000 samples per second. 2048=2^11 so we have 11 bits per sample. Finally we have 29000*11 bits per second (bps) =319000=3.2 * 10^5

In this exercise we want to know how many bits will be transmitted between the two intelligences, so we have that:

[tex]3.2*10^5 bits[/tex]

What is the Nyquist's theorem?

According to the theorem, the reconstructed signal will be equivalent to the original signal, respecting the condition that the original signal does not contain frequencies above or above this limit. This condition is called the Nyquist Criterion, or sometimes the Rahab Condition.

in this way we have:

[tex]2*14.5kHz=29kHz \\2048=2^11 =11 bits \\ 29000*11 =319000=3.2 * 10^5[/tex]

See more about bits at brainly.com/question/2545808

What category of software makes it possible to run other programs on the computer?
Select one:
a. The Controller
b. The Applications
c. System Software
d. Programming Tools

Answers

Answer:

C

Explanation:

What is user interface

Answers

Answer:

a user interface is the thing that apears after the login

Explanation:

go to goolge and type microsoft flight simulator user intr=erface

What does Ares want Percy to do for him?

Answers

Answer:

Get his sheild

Explanation:

Answer:

Ares wants Percy to retrieve his shield

Explanation:

Other Questions
God is an awesome God! which statement correctly describes how the amount of ofoxygen in the earths atmosphere has changed over time? Suppose 15 Argus student ride the city bus to school. Out of a total of 220 students, what percent ride the city bus (round to nearest whole %) You live in an area that the Assyrian army is attempting to conquer. Write a speech that you might give to your neighbors to persuade them either to defend themselves or to surrender without a fight what is the length of segment SA? show your work please I will give you brainliest what different nationalities established small states in the balkan peninsula? please help me with this homework question! Good Luck! I might give Brainliest. 8b-What is the Unit Price for the better deal? Round to the nearest hundredth) Put your answer in the form 0.00 or .00, so if answer is 43 cents, its 0.43 or.43, if there is a dollar amount like 1.50, do not add zeros in front) Your answer 9- Which sour cream is the better deal? * O Daisy Sour Cream $1.49 for 8 oz O Kraft Sour Cream $2.55 for 16 oz What value is closest to the length of major arc Xyz? The population of a school is 800 students and is increasing at a rate of 3% per year. How many students will be there in 6 years? 1.This function represents the value, in dollars, of a particular model of car, whero z represents the number of miles driven,f(x)= -50x + 25,000a. What does f(x) represent?b. What does x represent?c. What does the number 25,000 represent?d. What does the number -50 represent?e. What is the value of the car after it's been driven 100 miles?f. What is the value of the car after it's been driven 200 miles? A 1800 kg hybrid vehicle operates on ethanol and is equipped with a multipurpose motorgenerator-flywheel. When the vehicle slows or stops, 50% of the kinetic energy is recovered as electrical energy in the battery. When the IC engine is used to recharge the battery, there is a 25% efficiency of converting chemical energy in the fuel to electrical energy stored in the battery. The vehicle slows from 70 miles per hour to 20 miles per hour. Calculate: the perimeter of the floor of a room is 18 metre and its height is 3 cm what is the area of 4 walls of the room Comparing the Motion of Two CarsPosition vs Timefor Two CarsDWhich statements describe the motion of car A and carB? Check all that apply.Car A and car B are both moving toward the origin.Car A and car B are moving in opposite directions,Car Ais moving faster than car B.Car A and car B started at the same location.Car A and car B are moving toward each other untilthey cross over.BPosition (m)Time (s) pls help i well give u points In the Seventh grade Rachel read 15 books in the 8th grade she read 19 books what is the percent of change of books read Annie has 2 weeks to teach Helen. What do you, in YOUR own words, think Annie will get accomplished? i need help baddddddddddddddd plzz HELPS MEH PLZ + 20 its not hard to help me