Question

Assume that you declare a variable as int x = 100 ; and correctly pass it to a method with the declaration private static void IncreaseValue (ref int x) .There is a single statement within the IncreaseValue () method: x = x + 25 ; . Back in the Main ( ) method, after the method call, what is the value of x ? a The program will not run 125 O c. It is impossible to tell. O d 100 QUESTION 6 Assume that you have declared an array: int[] num(20, 30, 90 and a method with the following header: private static void DisplayScores (params int[] scores) . Which of the following method calls is valid? a. DisplayScores (20) b.DisplayScores (20, O c. Displayscores (num) ; d.All of the above are valicd 33);

0 0
Add a comment Improve this question Transcribed image text
Answer #1
1.
b. 125

2.
Option c

Please upvote the solution if it helped. Thanks!

Add a comment
Know the answer?
Add Answer to:
Assume that you declare a variable as int x = 100 ; and correctly pass it...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1.   What will be the value of x after the following code is executed? int x...

    1.   What will be the value of x after the following code is executed? int x = 10, y = 20; while (y < 100) { x += y; } A.   90 B.   110 C.   210 D.   This is an infinite loop 2.   If a superclass has constructor(s): A.   then its subclass must initialize the superclass fields (attributes). B.   then its subclass must call one of the constructors that the superclass does have. C.   then its subclass does not inherit...

  • Which two code fragments correctly create and initialize a static array of int elements? (Choose two.) A. static final intl] a100,200 B. static final int[l a; static { a=new int[2]; a[01-100; a[1]=20...

    Which two code fragments correctly create and initialize a static array of int elements? (Choose two.) A. static final intl] a100,200 B. static final int[l a; static { a=new int[2]; a[01-100; a[1]=200; } C. static final int[] a = new int[2]{ 100,200 }; D. static final intl a static void init() ( a new int[3] a[o] 100; a[11 200; Which two code fragments correctly create and initialize a static array of int elements? (Choose two.) A. static final intl] a100,200...

  • X. (10 points) In the box provided show the output for this program segment public static...

    X. (10 points) In the box provided show the output for this program segment public static void main (String [) args) intl num-(1,2.3,4) System.out printinx+y+num12) tyit(y, x. num): System.out printin(x+ynum(2): public static void tryit(int a, int b, intl c) int x c[2]-20 System.out printin(x+bCI2) XI. (7 points) a. Write a method NEGATIVE that receives as parameters a one-dimensional array variable LIST of integers. The method should return the sum of the negative elements in the array. You may not assume...

  • a) Declare and instantiate an array named scores of twenty-five elements of type int.   (b)Write a...

    a) Declare and instantiate an array named scores of twenty-five elements of type int.   (b)Write a statement that declares an array namedstreetAddress that contains exactly eighty elements of typechar. 2. In a single statement: declare, create and initialize an arraynamed a of ten elements of type int with the values of the elements (starting with the first) set to 10, 20,..., 100 respectively. 3. Declare an array reference variable, week, and initialize it to an array containing the strings "mon",...

  • Java Inner class class Outer {    private int x=10;    private static int y=20 ;...

    Java Inner class class Outer {    private int x=10;    private static int y=20 ;    publics void M1( ) {          int z=30;        class Inner           {             public void M2()              {                                                                              Sytem.out.println(“sum: ”+ (x+y+z));               }         } Inner i=new Inner();    i.M2() ; /// first call    i.M2(); // second call i.M2(); // third call }   // end of M1        publics static void main(String[] args)       {           Outer O = new...

  • QUESTION 1 Using the following declarations and a member of the Array class, int [ ]...

    QUESTION 1 Using the following declarations and a member of the Array class, int [ ] bArray = new int [10]; int location; Using a method in the Array class, write a statement that would change the order of the elements in the bArray array. The contents of the first cell should hold what was in the last cell. The second cell should hold what was in the next to last cell. __________________________ HINT: You must write the full statement...

  • ____     1.   Assume you have the following declaration char nameList[100];. Which of the following ranges is...

    ____     1.   Assume you have the following declaration char nameList[100];. Which of the following ranges is valid for the index of the array nameList? a. 0 through 99 c. 1 through 100 b. 0 through 100 d. 1 through 101 ____     2.   Assume you have the following declaration int beta[50];. Which of the following is a valid element of beta? a. beta['0'] c. beta[0] b. beta['1'] d. beta[50] ____     3.   Suppose that sales is an array of 50 components of...

  • Consider the class as partially defined here: //class Pizzaorder class Pizzaorder // static public members public...

    Consider the class as partially defined here: //class Pizzaorder class Pizzaorder // static public members public static final int MAX TOPPINGS 20: // instance members private String toppings[]; private int numToppings; // constructor public PizzaOrder () { numToppings toppings 0; String[MAX TOPPINGS]; new // accessor tells # toppings on pizza, i.e., #toppings in array public int getNum Toppings ()return numToppings; // etc. We want to write an instance method, addTopping) that will take a String parameter, topping, and add it...

  • Another simple sort is the odd-even sort. The idea is to repeatedly make two passes through the a...

    Another simple sort is the odd-even sort. The idea is to repeatedly make two passes through the array. On the first pass you look at all the pairs of items, a[j] and a[j+1], where j is odd (j = 1, 3, 5, …). If their key values are out of order, you swap them. On the second pass you do the same for all the even values (j = 2, 4, 6, …). You do these two passes repeatedly until...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT