This content has been marked as final.
Show 11 replies

1. Re: Simple Questions.
EJP Nov 4, 2012 12:02 PM (in response to apollon27)I answer
Nearly. (C) is false. Consider a+b*c.
a) False b) True c) True d) False because h22 is valid.
Am I right?Question 2
Also (d). 'value' is modified.
I think a)Question 3
Given what? This formula must contain a typo. Question 3 is therefore unanswerable.
Given that y=ax^3^+ 7 
2. Re: Simple Questions.
rp0428 Nov 4, 2012 4:51 PM (in response to apollon27)>
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. 
3. Re: Simple Questions.
apollon27 Nov 4, 2012 6:48 PM (in response to rp0428)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 :
Instructor Supplements
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 multiplechoice questions (approximately two per book section).
• Solutions Manual with solutions to the vast majority of the endofchapter 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. 
4. Re: Simple Questions.
972409 Nov 4, 2012 9:32 PM (in response to EJP)EJP wrote:
I guess it's mathematical expression. So I am guessing there is no type.Question 3
Given what? This formula must contain a typo. Question 3 is therefore unanswerable.
Given that y=ax^3^+ 7
Edited by: 969406 on Nov 4, 2012 1:32 PM 
5. Re: Simple Questions.
EJP Nov 4, 2012 11:28 PM (in response to 972409)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 +. 
6. Re: Simple Questions.
rp0428 Nov 4, 2012 11:07 PM (in response to 972409)>
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. 
7. Re: Simple Questions.
apollon27 Nov 5, 2012 8:40 AM (in response to rp0428)Thank you very much for the answers:
x^3^ 3 is superscript. means x*x*x but how can I write it? 
8. Re: Simple Questions.
EJP Nov 5, 2012 9:04 AM (in response to apollon27)x*x*x is x ^3^. You need a space before the first ^. 
9. Re: Simple Questions.
972748 Nov 6, 2012 10:08 AM (in response to EJP)i just checked the book.. the expression is as you thought.. 'y=ax^3+ 7'. 
10. Re: Simple Questions.
978238 Dec 6, 2012 5:00 PM (in response to apollon27)Question 1
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...
2.
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.. 
11. Re: Simple Questions.
EJP Dec 6, 2012 10:58 PM (in response to 978238)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 selfcontradictory. 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 options
Complete 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.