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 compiling and running the following code? class

ID: 3704964 • Letter: Q

Question

QUESTION 1

What is the result of compiling and running the following code?

class Base {
    public void Base() { System.out.print("Base"); }
}

public class Derived extends Base {
    public Derived() { System.out.print("Derived"); }
    public static void main(String[] args) {
       new Derived();
    }
}

Base
Derived

Derived
Base

Derived

The code will not compile

Base

4 points   

QUESTION 2

Interfaces are only allowed to have abstract methods and static final attributes.

True

False

2 points   

QUESTION 3

Java does not have unsigned integer types.

True

False

2 points   

QUESTION 4

Java programs are compiled to bytecode, not native machine code.

True

False

2 points   

QUESTION 5

What is the result of compiling and running the following code?

class Base {
    public Base(String n) { System.out.println("Base1"); }
    public void Base(String n) { System.out.println("Base2"); }
}

public class Derived extends Base {
    public Derived() { System.out.println("Derived"); }
    public static void main(String[] args) {
       new Derived();
    }
}

Derived

Base1
Derived

The code will not compile

Base2
Derived

4 points   

QUESTION 6

Inheritance establishes which kind of relationship between the child class and the parent class?

contains-a

is-a

has-a

uses-a

4 points   

QUESTION 7

What is displayed on the screen when running the following code fragment?

System.out.println("Result: " + 3 + 5);
System.out.println("Result: " + (3 + 5));

Result: 35
Result: 8

Result: 8
Result: 8

Result: 35
Result: 35

Result: 8
Result: 35

4 points   

QUESTION 8

In Java, every variable must be declared to have a particular type.

True

False

Base
Derived

Derived
Base

Derived

The code will not compile

Base

Explanation / Answer

Question 1
Answer:
Base
Derived

Question 2
Answer:
True

Question 3
Answer:
True


Question 4
Answer:
True

Question 5
Answer:
The code will not compile
Question 6
Answer:
is-a
Question 7
Answer:

Result: 35
Result: 8
Question 8
Answer:

True

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