GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

What is the value of “d” after this line of code has been ex…

What is the value of “d” after this line of code has been executed? double d = Math.round ( 4.5 + Math.random() );

Read Details

Consider the following code segment. String greet1 = “Good m…

Consider the following code segment. String greet1 = “Good morning!”;String greet2 = “Good afternoon!”;String greet3 = “Good evening”;int timeOfDay;if(timeOfDay >= 1700) { System.out.println(greet3);}else if(timeOfDay >= 1200) { System.out.println(greet2);}else { System.out.println(greet1);} What is printed as a result of executing the code segment if timeOfDay equals 1230?

Read Details

Consider the following variable declaration. boolean b;   Wh…

Consider the following variable declaration. boolean b;   Which of the following values can be stored in the variable b?

Read Details

Consider the following code segment. for (int j = 1; j < 10;...

Consider the following code segment. for (int j = 1; j < 10; j += 2){System.out.print(j);}   Which of the following code segments will produce the same output as the code segment above?

Read Details

Determine if the following evaluates to true or false based…

Determine if the following evaluates to true or false based on the value of these variables:   int a = 0;int b = 1;   !(a == 0 && b == 2);

Read Details

Consider the following information about the Person class….

Consider the following information about the Person class. The class has an int attribute age that represents a person’s age. The class has a non-static getAge method that has no parameters and returns the value of age. This method can be called from another class. The following code segments each appear in a class other than Person. Assume that p is a Person object whose age attribute is equal to 16. Code Segment 1 int val1 = p.getAge();System.out.println(val1);   Code Segment 2 int val2 = Person.getAge();System.out.println(val2);   What, if anything, is printed as a result of executing each of the code segments?

Read Details

Consider the following code segment. String one = “computer”…

Consider the following code segment. String one = “computer”; String two = “science”;String concat = /* missing code */; System.out.println(concat); Which of the following expressions can be used to replace /* missing code */ so that the code segment prints the string “pun”?

Read Details

What occurs when an integer expression evaluates to a value…

What occurs when an integer expression evaluates to a value outside the allowed range?

Read Details

Users of a mobile application are categorized based on the a…

Users of a mobile application are categorized based on the average number of hours they use the application each day, as shown in the following table.   Mobile Number Users Category Average Hours of Use Per Day Top User Greater than 5 Regular User Between 1 and 5, inclusive Inactive User Less than 1     Suppose n is the average number of hours a user spends using the application each day. Which of the following algorithms can be used to assign the correct categorization to a user?

Read Details

Consider the following code segment, which is intended to pr…

Consider the following code segment, which is intended to print true only when both r and v are positive numbers. Assume that r and v have been properly declared and initialized.   boolean rPos = r > 0; boolean vPos = v > 0;System.out.print(rPos == vPos);    The code segment does not always work as intended.   Which of the following values for r and v will demonstrate that this code segment does not work as intended?

Read Details

Posts pagination

Newer posts 1 … 881 882 883 884 885 … 87,273 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top