Question

What is the output from the following code segment? Output from PRINTLINE 1: public static void...

What is the output from the following code segment?

Output from PRINTLINE 1:


public static void Main(){

            int x = 38;
    int y = 45;  
      int z = DoIt(ref x, ref y);
    PRINTLINE(x + “ “ + y + “ “ + z); // PRINTLINE 1
}


static int DoIt(ref int a, ref int b)

{
a /= 8;
b /= 7;

PRINTLINE(a + “ “ + b); // PRINTLINE 2
return (a + b);
}

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

4 6
4 6 10
Add a comment
Know the answer?
Add Answer to:
What is the output from the following code segment? Output from PRINTLINE 1: public static void...
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. In java (What is the output of the code segment)? public static void Main(){    ...

    1. In java (What is the output of the code segment)? public static void Main(){             int x = 38;     int y = 45;         int z = DoIt(ref x, ref y);     PRINTLINE(x + “ “ + y + “ “ + z); // PRINTLINE 1 } static int DoIt(ref int a, ref int b) { a /= 6; b /= 8; PRINTLINE(a + “ “ + b); // PRINTLINE 2 return (a + b); } 2....

  • What is the output of the PRINTLINE2 from the following code segment?      public static void Main(){...

    What is the output of the PRINTLINE2 from the following code segment?      public static void Main(){ int x = 15; int y = 55;        int z = DoIt(ref x, ref y);      PRINTLINE(x + “ “ + y + “ “ + z); // PRINTLINE 1   } static int DoIt(ref int a, ref int b) {   a += 22;   b -= 12;   PRINTLINE(a + “ “ + b); // PRINTLINE 2   return (a - b); }

  • What is the output of the following code: public static void main(String []args){     int x =...

    What is the output of the following code: public static void main(String []args){     int x = 10;     int y = 10;     try{     System.out.println(function1(y, x));     } catch (Exception e) { System.out.println(“ERROR”); } } static int function1 (int x, int y) {     x += 10;     y += 7;     return (x + y); }

  • What output is produced by the following program? public class MysteryNums public static void main(String[] args)...

    What output is produced by the following program? public class MysteryNums public static void main(String[] args) - int x = 12; int y = x - 3; 3, sentence (y, x + y); . public static void sentence (int numi, int num2) { 4: System.out.println(num1 + " + num2);

  • 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...

  • 1. What is the output when you run printIn()? public static void main(String[] args) { if...

    1. What is the output when you run printIn()? public static void main(String[] args) { if (true) { int num = 1; if (num > 0) { num++; } } int num = 1; addOne(num); num = num - 1 System.out.println(num); } public void addOne(int num) { num = num + 1; } 2. When creating an array for primitive data types, the default values are: a. Numeric type b. Char type c. Boolean type d. String type e. Float...

  • 20) What is the output of the following segment of C code: int avg(int n, int*...

    20) What is the output of the following segment of C code: int avg(int n, int* a); int main () {             int array[4]={1,0,6,9};             printf("%d", avg(4, array)+ 1);             system("pause");             return 0; } int avg(int n, int* a) { int i, sum=0; for (i=0;i<n;i++) { sum+=a[i]; } return sum/n; } a) 16 b) 5 c) 4 d) 8 21) What is the output of the following segment of C code: int x = 2; int y = 3;...

  • What is the output of the following code? public class Test { pub be static void...

    What is the output of the following code? public class Test { pub be static void main(String() args) { Object o 1 -new Object(); Object o2 = new Object(); System out.print((o1 = o2) + "" + (o1 equals(o2))); } } A. false false B. true true C. false true D. true false Analyze the following code. //Program 1: public class Test { public static void main(String[] args) { Object circle 1 = new Circle(); Object circle2 = new Circle(); System...

  • What will be the output of the following Java code? class Output { public static void...

    What will be the output of the following Java code? class Output { public static void main(String args[]) { boolean a = true; boolean b = false; boolean c = a ^ b; System.out.println(!c); } } a) 0 b) 1 c) false d) true

  • Show the output of the following piece of code: public static void main(String[] args) { char...

    Show the output of the following piece of code: public static void main(String[] args) { char x = 'a'; char y = 'c'; System.out.println(++x); System.out.println(y++); System.out.println(x - y); }

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