GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

What is the value of true && false?

What is the value of true && false?

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

Imagine if you were given candies to divide evenly between t…

Imagine if you were given candies to divide evenly between the members of your group of 4. You should follow kindergarten rules, where everyone in the group should get the same number, and any extras should be returned to the teacher.If your group of 4 received 11 candies, how many candies are left over to be returned to your teacher?

Read Details

What is the default value of an int data type?

What is the default value of an int data type?

Read Details

An acronym is formed by extracting the first letter of each…

An acronym is formed by extracting the first letter of each word in a phrase of one or more words. For example, the acronym of the phrase “Laugh Out Loud” is “LOL”, and the acronym of the phrase “If you know you know” is “Iykyk.”   A phrase must meet the following conditions.   • The phrase has exactly one space between each word. • The phrase does not have leading or trailing spaces. • The final word in the phrase has at least two characters.   In the following code segment, the String variable phrase has been properly declared and initialized such that it meets these conditions. The code segment is intended to create the acronym of the String stored in phrase and store it in the variable text.   String temp = phrase;String text = temp.substring(0, 1); int i = temp.indexOf(” “);while (i > 0){ /* missing code */}   Which of the following can be used to replace /* missing code */ so that the code segment works as intended?

Read Details

Consider the following code segment. Assume that the int var…

Consider the following code segment. Assume that the int variable input has been properly declared and initialized.   int answer = 1; if (input != 0){ int count = 1; while (count != input){ count++; answer *= count; }}System.out.println(answer);   Which of the following best describes the condition in which this code segment always results in integer overflow?

Read Details

Which assignment operator would you use to add 5 to a variab…

Which assignment operator would you use to add 5 to a variable x?

Read Details

x and y are declared as integer variables.You are given the…

x and y are declared as integer variables.You are given the following expression: x >= y Which of these expressions is the opposite of the above expression and has valid syntax?

Read Details

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

Posts pagination

Newer posts 1 … 68 69 70 71 72 … 86,458 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top