Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, lindseyreneesmith7
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
image
Computers and Technology, 22.06.2019 11:20, destinyleisantos
The kurt vonnegut commencement speech, the neiman-marcus chocolate chip cookie recipe, and the get-well emails to the dying boy are examples of select one: a. social engineering b. hoax emails c. email viruses d. worms
Answers: 1
image
Computers and Technology, 22.06.2019 19:30, andyromero
Once the data center routes to the destination server that hosts the website, what's the next step in the internet process? user’s browser renders html code from destination server into web page request goes through router/model and isp request routed to nameserver and datacenter
Answers: 2
image
Computers and Technology, 23.06.2019 16:00, lokaranjan5736
Write a grading program for a class with the following grading policies: a. there are two quizzes, each graded on the basis of 10 points. b. there is one midterm exam and one final exam, each graded on the basis of 100 points. c. the final exam counts for 50% of the grade, the midterm counts for 25%, and the two quizzes together count for a total of 25%. (do not forget to normalize the quiz scores. they should be converted to a percentage before they are averaged in.) any grade of 90 or more is an a, any grade of 80 or more (but less than 90) is a b, any grade of 70 or more (but less than 80) is a c, any grade of 60 or more (but less than 70) is a d, and any grade below 60 is an f. the program will read in the student’s scores and output the student’s record, which consists of two quiz and two exam scores as well as the student’s average numeric score for the entire course and final letter grade. define and use a structure for the student reco
Answers: 2
Do you know the correct answer?
Consider the method total below: public static int total (int result, int a, int b) {     if (a == 0...

Questions in other subjects:

Konu
Mathematics, 08.01.2021 21:50
Konu
English, 08.01.2021 21:50
Konu
Mathematics, 08.01.2021 21:50