The following method is intended to return true if and only if the parameter val is a multiple of 4 but is not a multiple of 100 unless it is also a multiple of 400. The method does not always work correctly public boolean isLeapYear(int val) if ((val 4) == 0) return true; else return (val & 400) == 0; Which of the following method calls will return an incorrect response?
A .isLeapYear (1900)
B. isLeapYear (1984)
C. isLeapYear (2000)
D. isLeapYear (2001)
E. isLeapYear (2010)

Answers

Answer 1

Answer:

.isLeapYear (1900) will return an incorrect response

Explanation:

Given

The above method

Required

Which method call will give an incorrect response

(a) will return an incorrect response because 1900 is not a leap year.

When a year is divisible by 4, there are further checks to do before such year can be confirmed to be a leap year or not.

Since the method only checks for divisibility of 4, then it will return an incorrect response for years (e.g. 1900) that will pass the first check but will eventually fail further checks.

Hence, (a) answers the question;


Related Questions

Which XXX declares a student's name. public class Student { XXX private double myGPA; private int myID; public int getID() { return myID; } } Group of answer choices String myName; public String myName; private myName; private String myName;

Answers

Question:

Which XXX declares a student's name.

public class Student {

   XXX

   private double myGPA;  

   private int myID;

   public int getID() {

        return myID;

   }

}

Group of answer choices

a. String myName;

b. public String myName;

c. private myName;

d. private String myName;

Answer:

private String myName;

Explanation:

To declare a student's name, the following should be noted.

i. The name of the student is of type String

ii. Since all of the instance variables (myGPA and myID) have a private access modifier, then myName (which is the variable name used to declare the student's name) should be no exception. In other words, the student's name should also have a private access.

Therefore, XXX which declares a student's name should be written as

private String myName;

Option (a) would have been a correct option if it had the private keyword

Option (b) is not the correct option because it has a public access rather than a private access.

Option (c) is not a valid syntax since, although it has a private access, the data type of the variable myName is not specified.

Option (d) is the correct option.

what are the different steps while solving a problem using computer? explain​

Answers

Explanation:

The following six steps must be followed to solve a problem using computer.

Problem Analysis.

Program Design - Algorithm, Flowchart and Pseudocode.

Coding.

Compilation and Execution.

Debugging and Testing.

Program Documentation.

Other Questions
Select the correct answer.A school bus has 25 seats, with 5 rows of 5 seats. 15 students from the first grade and 5 students from the second grade travel in the bus. Howmany ways can the students be seated if all of the second-grade students occupy the first row?OA 25P20OB. SPs * 20P15OC5C525C14OD. SPs *15P15OE PSX25C5 please help, everything is in the pictures. :} Can someone help with this? Work out the lengths of sides a and b.Give your answers to 1 decimal place.17 cmaab8 cm12 cm5 cm There is a bag with only red marbles and blue marbles.The probability of randomly choosing a blue marble is 78.There are 56 marbles in total in the bag and each is equally likely to be chosen.Work out how many red marbles there must be. Melanie is the director of human resources for a small manufacturing firm. She has a strong personal interest in technology, and is known throughout the firm as the one with the most knowledge about new kinds of communications technologies. If the firm decides to upgrade its network, Melanie will probably function in what role in the firm's buying center Calculate the amount of heat required to completely sublime 55.0 g of solid dry ice CO2 at its sublimation temperature. The heat of sublimation for carbon dioxide is 32.3 kj mol The value of H for the reaction below is -6535 kJ. ________ kJ of heat are released in the combustion of 16.0 g of C6H6 (l)?2C6H6 (l) + 15O2 (g) 12CO2 (g) + 6H2O (l) Write the electron configuration for Gold (Au). You may choose to write it in the long form or in the noble gas configuration form (shortcut). what is the mean mark of 847 30? Please help me on this question helpppppppppppppppppppppppppppppppppp!!!!!!!!! We dont dance / arent dancing at school today. Boys dont wear / arent wearing pink T-shirts. Alpha wolves track the prey.The prey is also hunted by alpha wolves.Alpha wolves decide where to build the pack's den.Producing pups for the pack is also something alpha wolves do.Directions Combine the sentences into one sentence that includes a list. You may change the form of the action words and remove unnecessary words. x+y=132x-y=5solve using any method Cho tam gic ABC c AB =4cm ,AC=5cm,BC=6cm.Trn tia i ca tia AB ly im D sao cho AD=5cm a) chng minh : tam gic ABC ng dng vi tam gic CBD b) tnh CD which of these elements has two valence electrons?a. hydrogen (H)b. barium (Ba)c. nitrogen (N)d. krypton (Kr)e. bromine (Br) Can someone help Im confused A flywheel in a motor is spinning at 510 rpm when a power failure suddenly occurs. The flywheel has mass 40.0 kg and diameter 75.0 cm . The power is off for 40.0 s , and during this time the flywheel slows down uniformly due to friction in its axle bearings. During the time the power is off, the flywheel makes 210 complete revolutionsAt what rate is the flywheel spinning when the power comes back on(in rpm) entify the simple subject in the following sentence.George Washington was one of the greatest generals in American history.generalswasGeorge Washington