# AP Computer Science Help

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

#### dcf-joe

It's My Birthday!
I need help answering these questions. My Computer Science teacher does not teach us anything, but he gives us these humongous packets and then tests us over the material. None of us in the class can understand anything except Java basics, and I mean basic stuff like System.out.println. Anyways here are the questions:
1. Which are the most commonly used number types in Java?
2. When does the cast (long) x yield a different result from the call Math.round(x)?
3. How do you round the double value x to the nearest int value, assuming that you know that it is less than 2 * 10^9?
4. What is the difference between the following two statements? final double CM_PER_INCH = 2.54; and public static final double CM_PER_INCH = 2.54;
5. What is wrong with the following statement? double circumference = 3.14 * diameter;
6. What is the meaning of the following statement? balance = balance + amount;
7. What is the value of n after the following sequence of statements? n--; n++; n--;
8. What is the value of 1729 / 100? Of 1729 % 100?
9. Why doesn't the following statement compute the average of s1, s2, and s3? double average = s1 + s2 + s3 / 3; //Error
10. What is the value of Math.sqrt(Math.pow(x,2) + Math.pow(y,2)) in mathematical notation?
11. Why can't you call x.pow to compute x^y?
12. Is the call System.out.println(4) a static method call?
13. Assuming the String variable s holds the value "Agent", what is the effect of the assignment s = s + s.length()?
14. Assuming the String variable river holds the value "Mississipi", what is the value of river.substring(1,2)? Of river.substring(2, river.length() - 3)?
15. Why can't input be read directly from System.in?
16. Suppose "in" is a Scanner object that reads from System.in, and your program calls String name = in.next(); What is the value of name if the user enters John Q. Public?

#### Chicon

Hi dcf-joe,

As it won't help you if I give you the answers of your homework, I suggest you to launch your Java IDE and make some tests. It's the better way to learn. Also, you'll find the solutions of most theorical questions here.

#### DoubleHelix

Banned
You don't honestly expect someone else to do your homework, do you? Aside from rendering your education completely useless, it's also a violation of your school's code of conduct and could get you expelled. If your professor isn't teaching you anything, go to the head of the department or the dean.

#### bkatz540

I'm currently in AP Computer Science, but these questions seem very easy for me. If your teacher hasn't taught you that stuff, that sucks, because a lot of those are basics.

But like other people have said, no one is going to do your homework for nothing. If you pay me some money maybe I'll help you out, though.

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

As Seen On