Need some questions awnsered.

Talk about your favorite PC games, Steam and building awesome custom rigs!

Moderator: Moderators

Post Reply
User avatar
HotDog-Cart
Portablizer
Posts: 3804
Joined: Sat Jul 16, 2005 12:07 pm
PSN Username: Lythinca
Steam ID: scythe_king
Location: Your IP Address, Connecting...
Contact:

Need some questions awnsered.

Post by HotDog-Cart » Wed Dec 12, 2007 3:25 pm

These questions are about Java. Im new to it, and need to know them.

1) What are the 4 types of integers, in order from smallest to largest?

2) What are te 2 types of numbers with decimals inorder from smallest to largest?

3)What are the 3 differences between a String and a Char?

4)What is a boolean variable and what 2 types of info can it hold?

5)Whats the difference between a "System.out.print" and a "System.out.println"?

6)What are the 3 lines that must be added to any program that gets info from the user?

7)Whats the difference between inputting strings and numbers?

8)Explain when to use a loop, a while loop, and a do/while loop.

9)What are the 3 peices of information used in a FORloop setting? (Example: int count = 0; count < 10; count ++)

10)What as an "IF" statement?

11)Why would someone use a "If....else if....else if..." instead of "if...if...if"

12)How do you decide what info should be placed in a loop? (For while and do/while)

13)What are the 6 numeric comparison operators?

14)What are the 4 sting comparison operators?

15)What are the 3 boolean operators?

16)Please tell me an "if" statement which will only run if the number is between 1 and 10.

17) What does: "X++","Y--", "X+=2","Y-=5", "Z*=8", "R/=2"

Thanks guys.
Image

myersn024
Posts: 212
Joined: Mon Dec 11, 2006 2:34 pm

Post by myersn024 » Wed Dec 12, 2007 4:03 pm

You trying to get answers for a take home test or something? I don't know anything about Java, but I might be able to help with some of the other questions as long as I'm not doing you homework.

User avatar
HazmatB
Posts: 197
Joined: Wed Nov 28, 2007 6:23 pm

Post by HazmatB » Wed Dec 12, 2007 4:03 pm

Based on the time of year, and the type of questions, I would say that we have some test prep here. All of these are easy questions, and google will reward your work, but I don't think anyone here is going to give them away for free.

User avatar
HotDog-Cart
Portablizer
Posts: 3804
Joined: Sat Jul 16, 2005 12:07 pm
PSN Username: Lythinca
Steam ID: scythe_king
Location: Your IP Address, Connecting...
Contact:

Post by HotDog-Cart » Wed Dec 12, 2007 4:53 pm

Its not for a test. Its for a overhead that I have to make for the class. And its due tomorrow. :S
Image

User avatar
bicostp
Moderator
Posts: 10491
Joined: Mon Mar 07, 2005 5:47 pm
Steam ID: bicostp
Location: Spamalot
Contact:

Re: Need some questions awnsered.

Post by bicostp » Wed Dec 12, 2007 5:40 pm

I don't know Java but there's a few generally accepted definitions for things:

4)What is a boolean variable and what 2 types of info can it hold?

A boolean variable only holds two values: true and false.

7)Whats the difference between inputting strings and numbers?

Strings can be numbers and letters and treated as a line of text, numbers are computed as values.

10)What as an "IF" statement?
What does the word "if" mean? ;P

16)Please tell me an "if" statement which will only run if the number is between 1 and 10.

THIS IS BS CODE NOT JAVA

Code: Select all

if 1 < number < 10
do.stuff
else
dont.do.stuff
end if
17) What does: "X++","Y--", "X+=2","Y-=5", "Z*=8", "R/=2"

What does cat? This doesn't make sense without the rest of the question.

In ActionScript:
X++ adds 1 to X and puts the output into X
Y-- subtracts 1 from Yand puts the output into Y
X+=2 adds 2 to X and puts the output into X
Y-=5 subtracts 5 from Y and puts the output into Y
Z*=8 multiplies Z by 8 and puts the output into Z
R/=2 divides R by 2 and puts the output into R

User avatar
HotDog-Cart
Portablizer
Posts: 3804
Joined: Sat Jul 16, 2005 12:07 pm
PSN Username: Lythinca
Steam ID: scythe_king
Location: Your IP Address, Connecting...
Contact:

Post by HotDog-Cart » Wed Dec 12, 2007 5:48 pm

Thanks bic! Also this is off topic, by why the hell arent my sig or avatar working? Ive even tried other pics, and differnet hosts?

:)
Image

User avatar
HazmatB
Posts: 197
Joined: Wed Nov 28, 2007 6:23 pm

Post by HazmatB » Wed Dec 12, 2007 6:03 pm

A couple of revisions to Bic:

7) Your prof probably wants you to say that a string holds the ascii representations of text, whereas numbers are just that: numbers. So when inputting usually you will receive the ascii representations of things

i.e. When you type 1 into a computer the computer actaully sees the ascii version of 1 which is 81 (base 10).

16) in Java:

Code: Select all

int i = number;
if(1<i && i<10){// && means AND. & means boolean AND.
//Execute CODE
}else{
//DO NOT EXECUTE CODE
}
Note that the else is purely optional.

17.
Some important things to say about X++ and Y-- is that they are post op's, meaning that they execute AFTER the rest of the instruction. As opposed to ++X and --Y which execute BEFORE the rest of the instruction.[/code]

User avatar
Skyone
Moderator
Posts: 6390
Joined: Tue Nov 29, 2005 8:35 pm
Location: it is a mystery
Contact:

Post by Skyone » Wed Dec 12, 2007 6:51 pm

Code: Select all

1) short int, int, long int, long long int
2) float, double
3) chars are 1 byte, strings are a group of chars, strings are null-terminated
4) a boolean (bool) is a false/true (0/1) variable
5) println moves the console cursor to the next line (/n)
6) import java.io.Console;
import java.util.Arrays;
import java.io.IOException;
7) numbers are formatted as decimal/hexadecimal, strings are formatted for ASCII
8) overbearingly obvious
9) define counting value; while command; pre/post value altering
10) ...
11) else if is used to follow an if or another else if to assure only one of the conditions is executed
12) ...
13) <, <=, >, >=, ==, !=
14) ...
15) AND, OR, NOT
16) if(x >= 1 && x <= 10)
17) increment x, decrement y, add 2 to x, subtract 5 from y, multiply z by 8 (store in z), divide r by 2 (store in r)
Not even sure about number 6, I hardly code in Java.

Post Reply