Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 1 What is the result of compiling and running the following code? class Base { public void Base() { System.out.print(Base); } } public class

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sql All In One For Dummies 7 Books In One

Authors: Allen G Taylor ,Richard Blum

4th Edition

1394242298, 978-1394242290

More Books

Students also viewed these Databases questions