GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Consider the following code segment.    boolean a = true;boo…

Consider the following code segment.    boolean a = true;boolean b = false;boolean temp = a:a = b;b = temp;System.out.println(a);System.out.println(b);   What is printed as a result of executing this code segment?

Read Details

Assuming the following declarations:  int x = 5, y = 2, z =…

Assuming the following declarations:  int x = 5, y = 2, z = 10, temp = 0; What is the output of the following statement? If it causes an error, just type error. If nothing is output, just type no output. if ( y >= x ) {    y = z;    System.out.println( x + ” ” + y + ” ” +  z );

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;num = 2 % 6 / 2 – 4; Show the value that will be stored in the variable on the left. If the expression causes an error, just type ‘error.’

Read Details

Consider the following code segment. int value = initValue;i…

Consider the following code segment. int value = initValue;if(value > 7) { if(value < 22) { value = 0; }}else { value = 1;}System.out.println(“value = “ + value); Under which of the conditions below will this code segment print value = 1?

Read Details

Which statement generates random numbers in the range from 1…

Which statement generates random numbers in the range from 10 to 50?

Read Details

What will be printed after the following statements are exec…

What will be printed after the following statements are executed? int length;length = 11; // 11length *= 3; length *= length;length /= 50;System.out.println(length); If it shows an error, just type error.

Read Details

Consider the following code segment.       int a = 10;    in…

Consider the following code segment.       int a = 10;    int b = 5;    if(a + b > 10) {        System.out.print(a + b);    }    if(a – b > 0) {         System.out.print(a – b);    }   What, if anything, is printed as a result of executing the code segment?

Read Details

What would be the output of the following code? int input =…

What would be the output of the following code? int input = 5;int output = 3;input++;output += input;System.out.println(output);

Read Details

Consider the following code segment.   double sum = 0.0;for…

Consider the following code segment.   double sum = 0.0;for (int outer = 1; outer

Read Details

Assuming the following declarations:  int x = 5, y = 2, z =…

Assuming the following declarations:  int x = 5, y = 2, z = 10, temp = 0; What is the output of the following statement? If it causes an error, just type error. If nothing is output, just type no output. if ( x + y > z ) {     x = y + z; } else {     x = y – z;    }System.out.println( x + ” ” + y + ” ” +  z );

Read Details

Posts pagination

Newer posts 1 … 72 73 74 75 76 … 86,461 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top