subject

Consider the method total below: public static int total (int result, int a, int b) {     if (a == 0)    {      if (b == 0)      {         return result * 2;      }      return result / 2;       }    else    {      return result * 3;    } }           The assignment statement x = total (6, 0, 0); must result in x being assigned the value 8

2) 
x being assigned the value 4

3) 
x being assigned the value 5

4) 
x being assigned the value 12

5) 
x being assigned the value 10

Consider the following definitions:
public boolean someMethod (int[] list, int value)
{
   int counter;
   boolean flag = false;
   for (counter = 0; counter < list. length; counter++)
   {
     flag = (list[counter] != value);
   }
   return flag;
}
Under which of the following conditions must the method above return true?

1) 
Under all conditions

2) 
Under the condition that value == list[list. length − 1]

3) 
Under the condition that value != list[list. length − 1]

4) 
Under the condition that value != list[i] for all i such that 0 <= i < list. length

5) 
Under no conditions

What is the output of the program shown below? (1 point)
public class SomeClass
{
   private int x, y;
       public SomeClass (int xValue, int yValue)
   {
     x = xValue;
     y = yValue;
   }            
   public void m1()
   {
     x = 30;
     System. out. print((y + 1) + " ");
   }
   public void m2()
   {
     m1();
     System. out. print(x + " ");
   }
}
public class SomeTester
{
   public static void main (String[] args)
   {
     int x = 20;
     int y = 10;
     SomeClass z = new SomeClass(x, y);
     z. m2();
     z. m1();
   }
}

21 10 21

2) 
21 30 21

3) 
11 30 11

4) 
1 10 11

5) 
11 30 21

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 09:00
Which best describes the role or restriction enzymes in the analysis of edna a. to break dna into fragments that vary in size so they can be sorted and analyzed b. to amplify small amounts of dna and generate large amounts of dna for analysis c. to purify samples of dna obtained from the environment so they can be analyzed d. to sort different sizes of dna fragments into a banding pattern that can be analyzed
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Me ! evelyn is a manager in a retail unit. she wants to prepare a report on the projected profit for the next year. which function can she use? a. pmt b. round c. division d. what-if analysis
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. sean is a computer programmer. he has programmed an application for toddlers that plays nursery rhymes. however, a logic error has occurred in the program. which problem is a likely consequence of the error? a. the program crashes every time the user wants to play the nursery rhymes. b. the program crosses its buffer boundaries and overwrites an adjacent program. c. the program plays a different nursery rhyme than the one the user intended to play. d. the program shows different structures in its programming language code. e. the program introduces new viruses every time the user plays a nursery rhyme.
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
Write a program that displays the following menu: geometry calculator 1. calculate the area of a circle 2. calculate the area of a rectangle 3. calculate the area of a triangle 4. quit enter your choice (1-4): if the user enters 1, the program should ask for the radius of the circle and then display its area. use the following formula: area = ď€(the square of r) use 3.14159 for ď€ and the radius of the circle for r. if the user enters 2, the program should ask for the length and width of the rectangle and then display the rectangle’s area. use the following formula: area = length * width if the user enters 3, the program should ask for the length of the triangle’s base and its height, and then display its area. use the following formula: area = base * height * .5 if the user enters 4, the program should end. input validation: display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu. do not accept negative values for the circle’s radius, the rectangle’s length or width, or the triangle’s base or height. note: if the user enters an improper menu choice (1-4), the program prints "the valid choices are 1 through 4. run the program again and select one of those." if the user enters a negative radius, the program prints "the radius can not be less than zero." if the user enters a negative value for height or base, the program prints "only enter positive values for base and height."
Answers: 1
You know the right answer?
Consider the method total below: public static int total (int result, int a, int b) {     if (a == 0...
Questions
question
Mathematics, 20.05.2021 02:00
question
Mathematics, 20.05.2021 02:00
question
English, 20.05.2021 02:00
question
Mathematics, 20.05.2021 02:00
Questions on the website: 13722362