This content has been marked as final. Show 11 replies
I am reading a book that has some exercises,
and I want to make sure if I have answered them correct.
What book? Provide a reference. If the answers are not in the book you should use a different book.
The best way to accomplish your goal is to use a book that provides the answers and explains them.
Hello the book I read is
"Java- How to program 9ed" Paul Deitel, Harvey Deitel
After each chapter, it has some exercises with solutions and exercises without solutions.
Chapter 2 that I am reading has 6 exercises with answers, and 27 exercises without answers!
Only Instructors have access to the solutions!!!!
Do you recommend a better book. I am new to Java, but not to programming, I have professional experience with PL/SQL, Oracle Forms/Reports
It says :
The following supplements are available to qualified instructors only through Pearson Education’s Instructor Resource Center (www.pearsonhighered.com/irc):
• PowerPoint slides containing all the code and figures in the text, plus bulleted items that summarize key points.
• Test Item File of multiple-choice questions (approximately two per book section).
• Solutions Manual with solutions to the vast majority of the end-of-chapter exercises.
Please do not write to us requesting access to the Pearson Instructor’s Resource Center which contains the book’s instructor supplements, including the exercise solutions. Access is limited strictly to college instructors teaching from the book. Instructors may obtain access only through their Pearson representatives.
It isn't a mathematical expression: it must contain a typo. The second '^' is in error. The rest of it looks like a mathematical function using ^ for exponentiation. Please clarify.
NB the questions about left to right may concern a common misconception. They may even be the common misconception. The operands of an expression are evaluated left to right. The expression itself is evaluated according to the rules of precedence. So for example in a+b*c, a, b, and c are evaluated in that order, but b*c is evaluated before applying the +.
I guess it's mathematical expression. So I am guessing there is no type.
He said 'typo' not 'type'. This 'y=ax^3^+ 7' should probably be this 'y=ax^3+ 7'. So the question is probably
Given that y=ax^3+ 7, which of the following are correct Java statements for this equation?
a) y= a*x* x*x+7; --> correct
b) y= a*x* x*(x +7 );
c) y= (a*x )*x* (x+7 );
d) y= (a*x )*x* x+7; ---> correct
e) y= a*(x xx )+7; ---> correct
f) y= a*x* (x*x +7 );
So in ax^3+7 the exponentiation operator ('^') binds the x and the 3. So x^3 can be written as x*x*x so the expression is now
a*x*x*x+7 - so answer 'a' is correct.
If you add parenthesis around the 'x's you get
a*(x*x*x)+7 - so answer 'e' is correct
And since the multiplication operator ('*') is associative you can do any of the series of multiplication operations first so
(a*x)*x*x+7 - so answer 'd' is correct
The other three answers are wrong because they perform addition before the multiplication; multiplication has a higher precedence than addition.
State whether each of the following is true or false. If false, explain why.
1.a) Java operators are evaluated from left to right
true... example ----- a+b*(2+2)
Here we are do operation from left to right...here we start operation from (2+2)
b) The following are all valid variable names: underbar_, m928134, t5, j7, her_sales$,
his_$account_total, a, b$, c, z and z2.
In java we can use underscore( _ ) at the time of variable declaration...
here we can use numeric value but we can use aftr character value oly...
C.)A valid Java arithmetic expression with no parentheses is evaluated from left to right.
i dunno exact answer..
D.) The following are all invalid variable names: 3g, 87, 67h2, h22 and 2h.
False because h22 is valid variable...
Which of the following Java statements contain variables whose values are modified?
a) p= i+j+ k+7;
b) System.out.println( "variables whose values are modified");
c) System.out.println( "a=5" );
d) value = input.nextInt();
A is the answer... because there we modify the values for j and k... bt is not possible in other options..
Here we are do operation from left to right...here we start operation from (2+2)Which is not on the left. It's on the right. Your answer is therefore not only wrong but self-contradictory. Which is all the more strange, as the correct answer was given a month ago above, with example.
C.)A valid Java arithmetic expression with no parentheses is evaluated from left to right.Also strange, as it's been given above. It's been sitting there for a month. Did you read the thread before you pointlessly revived it?
i dunno exact answer..
A is the answer... because there we modify the values for j and k... bt is not possible in other optionsComplete rubbish. You've named two variables that aren't modified, and missed both the ones that are modified. And once again the correct answer appears above.
You get an F for your answers , a Z for not reading the thread and spotting the correct answers, which are even marked as being correct, and another Z for being a month late to help the original poster. Your guesses aren't even as good as the original poster's answers. If you can't add value please don't bother.