Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

\'A\' < \'a\' && 4 <= 8 || 2.5 >= 7 || 4 < y What is the value of the expression

ID: 3556710 • Letter: #

Question


'A' < 'a' && 4 <= 8 || 2.5 >= 7 || 4 < y

What is the value of the expression above?

Select one:

a. x

b. It cannot be determined.

c. false

d. true

In math to get the square root of 2 you raise 2 to the 1/2 power like this: 20.5

what expression in java do you use to raise 2 to the 0.5 power in java?

Select one:

a. Math.exp(2.0,1/2)

b. Math.pow(2.0,0.5)

c. Math.power(2.0,1/2)

d. Math.pow(.05, 2.0)

what does the following code print?

String x = "Long Beach City College";
System.out.println(x.charAt(5));

Select one:

a. B

b. a blank

c. Beach

d. '5'

How would you declare a method that adds two integer arguments together and returns the int result?

Select one:

a. public int add() { return a+b }

b. int public add(int a,b)

c. public int add(int a, int b)

d. int add(int a, int b)

fill in the blank in this code?

public ___ tax(int age,double amt,String acct) {

double t = 0.0;

if(age>7) t = amt*1.05;
else t = amt*1.01;
System.out.print(acct);
return t;

}

Select one:

a. void

b. String

c. int

d. double

What class is required for user input?

Select one:

a. Next

b. Console

c. Scanner

d. String

The Fence Post problem pattern is most related to which of the following in java concepts or statements.

Select one:

a. Scanner

b. problem decomposition

c. boolean expressions

d. while statement

What does the following code print:

Select one:

a. 18

b. 6

c. 48

d. 10

which java statement type best matches this flow structure:

Select one:

a. while

b. method with two parameters

c. if

d. if else

int x = 27;
int y = 10;

do
    x = x / 3;
while (x >= y);

What is the final value of x in the code above?

Select one:

a. 27

b. 3

c. 0

d. 9

What is the correct value of this expression:

1 / 2 > 0 || 4 == 9 % 5 || 1 + 1 < 1 - 1

Select one:

a. false

b. true

public static double secret(int first, double second)
{
    double temp;

    if (second > first)
        temp = first * second;
    else
        temp = first - second;

    return temp;
}


Based on the above code, what would be the output of the statement

System.out.println(secret(5, 7.0));

Select one:

a. 5.0

b. 2.0

c. 7.0

d. 35.0

Given the following code:

String s = "this is a dog.";

Which call to substring will return just the word "is"?

Select one:

a. s.substring(6,8)

b. s.substring(5,6)

c. s.substring(5,7)

d. s.substring(6,7)

What does the following section of code do:

int t = 0;
for(int i = 1; i <= 5; i ++ ) {

System.out.println("number: ");
int n = console.nextInt();
t = t + n;

}
System.out.println("result: " + t );

Select one:

a. print the numbers that were input

b. total of the numbers input

c. count the numbers input

d. calculate the average of the input numbers

Suppose that x is an int variable. Which of the following expressions always evaluates to false?

Select one:

a. (x >= 0) && (x == 0)

b. (x > 0) || (x == 0)

c. (x > 0) || (x <= 0)

d. (x > 0) && ( x <= 0)

What would you fill in the blank with a format specifier in the following statement:

System.out.printf( "You owe ___ dollars", 22.33461);

to print exactly:

You owe 22.33 dollars

type it exactly into the box below:

The expression !(x <= 0) is true only if x is a positive number.

Select one:

True

False

Void methods use the returnstatement to return the value 0.

Select one:

True

False

Explanation / Answer

'A' < 'a' && 4 <= 8 || 2.5 >= 7 || 4 < y

What is the value of the expression above?

Select one:

a. x

b. It cannot be determined.

c. false

d. true

In math to get the square root of 2 you raise 2 to the 1/2 power like this: 20.5

what expression in java do you use to raise 2 to the 0.5 power in java?

Select one:

a. Math.exp(2.0,1/2)

b. Math.pow(2.0,0.5)

c. Math.power(2.0,1/2)

d. Math.pow(.05, 2.0)

what does the following code print?

String x = "Long Beach City College";
System.out.println(x.charAt(5));

Select one:

a. B

b. a blank

c. Beach

d. '5'

How would you declare a method that adds two integer arguments together and returns the int result?

Select one:

a. public int add() { return a+b }

b. int public add(int a,b)

c. public int add(int a, int b)

d. int add(int a, int b)

fill in the blank in this code?

public ___ tax(int age,double amt,String acct) {

double t = 0.0;

if(age>7) t = amt*1.05;
else t = amt*1.01;
System.out.print(acct);
return t;

}

Select one:

a. void

b. String

c. int

d. double

What class is required for user input?

Select one:

a. Next

b. Console

c. Scanner

d. String

The Fence Post problem pattern is most related to which of the following in java concepts or statements.

Select one:

a. Scanner

b. problem decomposition

c. boolean expressions

d. while statement

What does the following code print:

// code not given

Select one:

a. 18

b. 6

c. 48

d. 10

which java statement type best matches this flow structure:

Select one:

a. while

b. method with two parameters

c. if

d. if else

int x = 27;
int y = 10;

do
    x = x / 3;
while (x >= y);

What is the final value of x in the code above?

Select one:

a. 27

b. 3

c. 0

d. 9

What is the correct value of this expression:

1 / 2 > 0 || 4 == 9 % 5 || 1 + 1 < 1 - 1

Select one:

a. false

b. true

public static double secret(int first, double second)
{
    double temp;

    if (second > first)
        temp = first * second;
    else
        temp = first - second;

    return temp;
}


Based on the above code, what would be the output of the statement

System.out.println(secret(5, 7.0));

Select one:

a. 5.0

b. 2.0

c. 7.0

d. 35.0

Given the following code:

String s = "this is a dog.";

Which call to substring will return just the word "is"?

Select one:

a. s.substring(6,8)

b. s.substring(5,6)

c. s.substring(5,7)

d. s.substring(6,7)

What does the following section of code do:

int t = 0;
for(int i = 1; i <= 5; i ++ ) {

System.out.println("number: ");
int n = console.nextInt();
t = t + n;

}
System.out.println("result: " + t );

Select one:

a. print the numbers that were input

b. total of the numbers input

c. count the numbers input

d. calculate the average of the input numbers

Suppose that x is an int variable. Which of the following expressions always evaluates to false?

Select one:

a. (x >= 0) && (x == 0)

b. (x > 0) || (x == 0)

c. (x > 0) || (x <= 0)

d. (x > 0) && ( x <= 0)

What would you fill in the blank with a format specifier in the following statement:

System.out.printf( "You owe ___ dollars", 22.33461);

to print exactly:

You owe 22.33 dollars

type it exactly into the box below:

The expression !(x <= 0) is true only if x is a positive number.

Select one:

True

False

Void methods use the returnstatement to return the value 0.

Select one:

True

False