GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

Assume that the int variables x, y, z, and low have been pro…

Assume that the int variables x, y, z, and low have been properly declared and initialized. The code segment below is intended to print the sum of the greatest two of the three values but does not work in some cases.   if(x > y && y > z){   low = z;}if(x > y && z > y){   low = y;}else {   low = x;}System.out.println(x + y + z – low); For which of the following values of x, y, and z does the code segment NOT print the correct value?

Read Details

Assume that you are given the following declarations: int nu…

Assume that you are given the following declarations: int num = 0;double val = 0.0;val = 17 % 5 / 3 – 1; Show the value that will be stored in the variable on the left. If the expression causes an error, just type ‘error.’

Read Details

What is an argument in method calling?

What is an argument in method calling?

Read Details

If an int variable weight currently holds the value 150, wha…

If an int variable weight currently holds the value 150, what is its value after the following statement is executed? weight -= 27; If it shows an error, just type error.

Read Details

What is the result of 17 / 4 when evaluated in a Java expres…

What is the result of 17 / 4 when evaluated in a Java expression? If it shows an error, just type error.

Read Details

What is the casting operator to convert a double to an int?

What is the casting operator to convert a double to an int?

Read Details

What is the output of the following code segment?   for (int…

What is the output of the following code segment?   for (int k = 0;  k

Read Details

Consider the following two code segments, which are intended…

Consider the following two code segments, which are intended to produce identical outputs.   Code Segment 1   for (int i = 0; i < 10; i++){ System.out.println("counting " + i);}   Code Segment 2   int x = 0; while (x < 10){ x = x + 1; System.out.println("counting " + x);}   Which of the following changes can be made to Code Segment 2 so that the outputs of the two code segments are identical as intended?

Read Details

Consider the following method. public static String scramble…

Consider the following method. public static String scramble(String word, int howFar) { return word.substring(howFar + 1, word.length()) + word.substring(0, howFar); } What value is returned as a result of the call scramble(“compiler”, 3)? (Copyright AP College 2014-30)

Read Details

A Boolean expression evaluates to either true or false.

A Boolean expression evaluates to either true or false.

Read Details

Posts pagination

Newer posts 1 … 65 66 67 68 69 … 86,459 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top