Question

QUESTION 3 Assume x = 4 and y = 5, which of the following is true?...

QUESTION 3

  1. Assume x = 4 and y = 5, which of the following is true?

    x < 5 || y < 5

    x > 5 || y > 5

    x < 5 && y < 5

    x > 5 && y > 5

  2. QUESTION 14

  3. Which of the following statements are the same?

    (A) x -= x + 4
    (B) x = x + 4 - x
    (C) x = x - (x + 4)

    (A) and (B) are the same

    (B) and (C) are the same

    (A) and (C) are the same

    (A), (B), and (C) are the same

  4. The default value for data field of a boolean type, numeric type, String type is ___________, respectively.

    true, 1, null

    false, 0, null

    true, 0, null

    true, 1, Null

  5. QUESTION 16

  6. Analyze the following code:

    public class Test {
       public static void main (String args[]) {
         int i = 0;
         for (i = 0; i < 10; i++);
           System.out.println(i + 4);
       }
    }

    The program compiles despite the semicolon (;) on the for loop line, and displays 4.

    The program compiles despite the semicolon (;) on the for loop line, and displays 14.

    The program has a compile error because of the semicolon (;) on the for loop line.

    The program has a runtime error because of the semicolon (;) on the for loop line

  7. QUESTION 17

  8. What is i printed?

    public class Test {
    public static void main(String[] args) {
        int j = 0;
        int i = ++j + j * 5;

        System.out.println("What is i? " + i);
    }
    }

    5

    6

    0

    1

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
QUESTION 3 Assume x = 4 and y = 5, which of the following is true?...
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) Consider the following Java program: 1 public class HelloWorld { 2     // My first program!...

    1) Consider the following Java program: 1 public class HelloWorld { 2     // My first program! 3     public static void main(String[] args) { 4         System.out.println("Hello, World!"); 5     } 6 } What is on line 1? a. a variable declaration b. a statement c. a method (subroutine) definition d. a comment e. a class definition 2) Which one of the following does NOT describe an array? a. It can be used in a for-each loop. b. It has a numbered sequence...

  • Question 1 (5 points) Question 1 Unsaved What is displayed on the console when running the...

    Question 1 (5 points) Question 1 Unsaved What is displayed on the console when running the following program? public class Quiz2B { public static void main(String[] args) { try { System.out.println("Welcome to Java"); int i = 0; int y = 2 / i; System.out.println("Welcome to Java"); } catch (RuntimeException ex) { System.out.println("Welcome to Java"); } finally { System.out.println("End of the block"); } } } Question 1 options: The program displays Welcome to Java two times. The program displays Welcome to...

  • 2. Write a counter controlled loop to solve the following problems. Each one will involve an...

    2. Write a counter controlled loop to solve the following problems. Each one will involve an array (MinMax.java) Read in 25 ints from the keyboard, and store them in an array. Then, find the maximum and minimum values in such an array, and display them on the screen. public class Array-Assignment { public static void main(String [] args) {     int [] x = new int[3];     int [] y = {3, 5, 9, 2};     x[2] = y[3];    ...

  • Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the...

    Question 1 Not yet answered Marked out of 1.00 Flag question Question text Which of the following keywords is useful for skipping to the next iteration of a loop? Select one: a. do b. break c. switch d. continue e. while Clear my choice Question 2 Not yet answered Marked out of 1.00 Flag question Question text Consider the following line of Java code. System.out.println("Hello, World!"); "out" is which of the following? Select one: a. a statement b. a class...

  • Which of the following are valid array declarations? a. int[] array- new int[10]; b. double [array...

    Which of the following are valid array declarations? a. int[] array- new int[10]; b. double [array double[10]; c. charl charArray "Computer Science"; None of the above Analyze the following code: class Test public static void main(Stringl] args) System.out.println(xMethod(10); public static int xMethod(int n) System.out.println("int"); return n; public static long xMethod(long n) System.out.,println("long"); return n The program displays int followed by 10 The program displays long followed by 10. The program does not compile. None of the above. tions 3-4 are...

  • (a)How many times does the code snippet given below display "Hello"? int x = 1; while...

    (a)How many times does the code snippet given below display "Hello"? int x = 1; while (x != 15) {    System.out.println ("Hello");    x++; } (b)What is the output of the following code fragment? int i = 1; int sum = 0; while (i <= 5) {    sum = sum + i;    i++; } System.out.println("The value of sum is " + sum); Quie 2 What is the output of the following snipped code? public class Test {...

  • With a Scanner object created as follows, what method do you use to read an int...

    With a Scanner object created as follows, what method do you use to read an int value? Scanner input = new Scanner(System.in); A. input.int(); B. input.nextInt(); C. input.integer(); D. input.nextInteger(); What is the output of the following code? x = 0; if (x > 0) System.out.println("x is greater than 0"); else if (x < 0) System.out.println("x is less than 0"); else System.out.println("x equals 0"); A. x is greater than 0 B. x is less than 0 C. x equals 0...

  • The following individual two programs are using while loop in order to print a specific output:...

    The following individual two programs are using while loop in order to print a specific output: The outputs of the first program are: 10 9 8 5 4 The outputs of the second program are: 123456789 Using the Table 3.1 below, allocate the error(s) of each line of two programs and type of error: The first program: public Main { public static void main(String args[]){ int i=10 while(i>4){ System.out.print(i); i++; } } } The second program:   public class Main   {...

  • The following individual two programs are using while loop in order to print a specific output:...

    The following individual two programs are using while loop in order to print a specific output: The outputs of the first program are: 10 9 8 5 4 The outputs of the second program are: 123456789 Using the Table 3.1 below, allocate the error(s) of each line of two programs and type of error: The first program: public Main { public static void main(String args[]){ int i=10 while(i>4){ System.out.print(i); i++; } } } The second program:   public class Main   {...

  • What does the program print, and if possible can you give an explanation of how you...

    What does the program print, and if possible can you give an explanation of how you reached the answer? . What will the following program print? class Quiz03 public static void main (String [] args) final int limit = 5; ( string line""i string line = "" ; for ( int j=1 ; j <= row; j++ ) for int row=1; row<=limit; row++ ) line += "*" ; System.out.println( line

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