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

QUESTION 1 What is the result of this expression? int x = 50 + (48 % 7) / 3; 51

ID: 3726930 • Letter: Q

Question

QUESTION 1

What is the result of this expression?

int x = 50 + (48 % 7) / 3;

51

52

53

54

1 points   

QUESTION 2

Given the following declaration, which of the following statement is most accurate?

Employee e = new Employee();

e contains a reference to an Employee object.

e contains an object of the Employee type.

You can assign an int value to e.

e contains an int value.

1 points   

QUESTION 3

If a local variable has the same name as an instance variable, the local variable takes precedence and the instance variable is hidden. Which keyword is used to reference a instance variable?

new

this

public

static

there is no such keyword in Java

1 points   

QUESTION 4

Use the following class definition to answer questions 4 and 5:

public class Employee {
      private String firstName;
      private String lastName;
      private int salary;
      public Employee(String f, String l, int s) {
          firstName = f;
          lastName = l;
          salary = s;
      }
}

How many instance variables are in an object of the Employee class?

1

2

3

4

1 points   

QUESTION 5

A separate application can use the constructor to create an object of type Employee.

True

False

1 points   

QUESTION 6

Which of the following is the correct expression that evaluates to true for any number between 1 and 50 (inclusive) or the number is even?

1 <= x <= 50 || x % 2 == 0

((x > 1) && (x < 50)) || (x % 2 == 0)

((x >= 1) && (x =< 50)) && (x % 2 == 0)

((x >= 1) && (x =< 50)) || (x % 2 == 0)

1 points   

QUESTION 7

Which builtin object in Java provides methods to display data to the user?

System.in

System.out

System.err

1 points   

QUESTION 8

An instance variable is shared by all objects of a class.

True

False

51

52

53

54

Explanation / Answer

1)   52
2)   e contains a reference to an Employee object.
3)   this
4)   3
5)   True
6)   ((x >= 1) && (x =< 50)) || (x % 2 == 0)
7)   System.out
8)   False

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote