GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

What is the output of the following code snippet? String str…

What is the output of the following code snippet? String str1 = “her”; String str2 = “cart”; if (str1.compareTo(str2) < 0) { System.out.print(str2); } else { System.out.print(str1); }

Read Details

Which of the statements about hand-tracing is true?

Which of the statements about hand-tracing is true?

Read Details

What is the output of the following code snippet? int x = 25…

What is the output of the following code snippet? int x = 25; if (x < 100) { x = x + 5; } if (x < 500) { x = x - 2; } if (x > 10) { x++; } else { x–; } System.out.println(x);

Read Details

Consider the following code snippet. Which statement should…

Consider the following code snippet. Which statement should be used to fill in the empty line so that the output will be [32, 54, 67.5, 29, 35]? public static void main(String[] args) { double data[] = {32, 54, 67.5, 29, 35}; ______________ System.out.println(str); }

Read Details

The black boxes from which a program is manufactured are cal…

The black boxes from which a program is manufactured are called ___.

Read Details

What is the output of the following code snippet? int i = 1;…

What is the output of the following code snippet? int i = 1; while (i < 20) { System.out.print(i + " "); i = i + 2; if (i == 15) { i = 19; } }

Read Details

Assume the array of integers values has been created and pro…

Assume the array of integers values has been created and process is a method that has a single integer parameter. Which of the following is equivalent to the loop below? for (int val: values) { process(val); }

Read Details

What changes do you need to make in the following code snipp…

What changes do you need to make in the following code snippet to display “Let us learn Java” exactly 10 times? int i = 0; while (i

Read Details

What are the values of i and j after the following code snip…

What are the values of i and j after the following code snippet is run? int i = 10; int j = 20; int count = 0; while (count < 5) { i = 2*i; i = i + 1; j = j - 1; count++; } System.out.println("i = " + i + ", j = " + j);

Read Details

Suppose you wish to write a method that returns the sum of t…

Suppose you wish to write a method that returns the sum of the elements in partially filled array. Which is the best choice for a method header?

Read Details

Posts pagination

Newer posts 1 … 82,823 82,824 82,825 82,826 82,827 … 90,529 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top