Sie sind auf Seite 1von 2

APCS-AB Exposure Java

Name:

Exercises 23.1

Date:
Period:

1.

What kind of data type stores only a single value?

2.

What 2 things do data structures store?

3.

What is Javas default type for a literal integer constant?

4.

What is the maximum integer a byte can store?

5.

How many bytes are in a short?

6.

Rounded to the nearest billion, what is the maximum integer an int can store?

7.

How many bytes are in a long?

8.

Look at program Java2301.java.


What is the purpose for the L at the end of this line:
long longNum = 9223372036854775807L;

9.

Look again at program Java2301.java. Why does the 1st line below display 253 and the 2nd display 28?
System.out.println("25 + 3 = " + 25 + 3);
System.out.println("25 + 3 = " + (25 + 3));

10.

How many bytes are in a float?

11.

How many bytes are in a double?

12.

Look at program Java2302.java.


What is the purpose for the F at the end of this line:
float floatNum3 = 3.33333333F;

13.

Which binary operator returns the remainder of an integer division?

14.

What does a char store?

15.

What does a String store?

16.

What does a boolean store?

17.

Assume x and y are char variables. Print the code that will assign both the value of J in one statement.

18.

Assume x is an int variable. You want to add 1 to x with the least amount of code possible. How do you do it?
6/16/2007

19.

Assume x is an int variable. You want to subtract 2 from x with the least amount of code possible. How do you do it?

20.

Assume x is an int variable. You want to triple the amount in x with the least amount of code possible. How do you do
it?

21.

Assume x is an double variable. You want to chop the value in x in half with the least amount of code possible.
How do you do it?

22.

What primitive data types are part of the AP Subset?

23.

What unary operations are part of the AP Subset?

24.

If you have the statement: double PI = 3.141592653589793238462643383279502884;


in your program, and you want the value of PI to never change, what should you do?

25.

What happens if you try to alter a constant in a program?

26.

What are 2 synonyms for selection?

27.

What are 2 synonyms for repetition?

28.

What command is used for one-way selection?

29.

What commands are used for two-way selection?

30.

What commands are used for multi-way selection?

31.

Which types of selection are part of the AP Subset?

32.

What command is used for fixed repetition?

33.

What command is used for pre-condition repetition?

34.

What command is used for post-condition repetition?

35.

Which types of repetition are part of the AP Subset?

36.

Look at program Java2307.java.


What is the purpose for the int p = 1; in this line:
for (int p = 1; p <= 15; p++)

35.

Refer to the previous question. What is the purpose of the p <= 15; ?

36.

Refer to the previous 2 questions. What is the purpose of the p++; ?

6/16/2007

Das könnte Ihnen auch gefallen