SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 210 Weeks Ago, 3 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 18 Nov 2017 My Price 10.00

What is the output produced by this code?

Need help with the attached questions. (time sensitive) All ar Java language.

 

Thank You

 

QUESTION 1

1.      What is the output produced by this code?
int a = -5, b = 7;
System.out.println("a" + " + " + "b" + " = " + (a + b));

 

a + b = -57

 

a + b = 2

 

-5 + 7 = -57

 

Nothing, this will not compile.

 

-5 + 7 = 2

3 points   

QUESTION 2

1.      Suppose you have a variable of type Weasel called stoat. How would you call its avoid method if the avoid method takes an Animal object as a parameter? (Assume predator is an Animal object.)

 

predator.avoid(stoat);

 

stoat.avoid("predator");

 

stoat.avoid(predator);

 

Weasel.avoid(predator);

 

Weasel.avoid("predator");

3 points   

QUESTION 3

1.      Suppose you want to have multiple lines of code run if an if statement is true. Which of the following will allow you to do that?

 

Surround the code with ()

 

You cannot do that; you need multiple if statements

 

Indent the code underneath the if

 

Surround the code with {}

 

 

 

QUESTION 26

1.       How many iterations will the following for loop execute?

for ( inti = 0; i< 20; i++) { }

 

0

 

19

 

20

 

22

2 points   

QUESTION 27

1.       How many iterations will the following for loop execute?

for (inti = 5; i< 20; i++) { }

 

15

 

14

 

0

 

16

2 points   

QUESTION 28

1.       How many iterations will the following for loops execute?

for ( inti = 1; i< 20; i *= 2) { }

 

10

 

5

 

0

 

4

 

Attachments:

Answers

(5)
Status NEW Posted 18 Nov 2017 02:11 PM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)