Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Jul 2017 |
Last Sign in: | 210 Weeks Ago, 3 Days Ago |
Questions Answered: | 15833 |
Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
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 |
Â
----------- Â ----------- 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