Your Name______

GreenFoot Concepts~ Chapter 1-6

Matching: Match the correct data type with its definition (1 point each) _____4 pts

  1. boolean
/
  1. contains alphabetic letters or words enclosed in quotes

  1. double
/
  1. contains integers (whole numbers) only

  1. int
/
  1. contains only two possible values, true or false

  1. String
/
  1. contains double precision values with decimals

Matching: Match the following value operators with its definition. 1 pt each _____6 pts

  1. equal to

  1. <=
/
  1. Greater than

  1. Less than or equal to

  1. >=
/
  1. Not equal to

  1. ==
/
  1. Greater than or equal to

  1. !=
/
  1. Less than

Multiple Choice: Circle the correct response.( 2 points each) ______46 pts

  1. Objects are created from:
  2. methods
  3. classes
  4. parameters
  5. commands
  6. Objects have several [__] that are blocks of code that perform specific tasks or actions.
  1. methods
  2. classes
  3. instances
  4. parameters
  1. This specifies what type of data a method call with return:
  1. parameters
  2. commands
  3. class type
  4. return type
  1. The mechanism that is used to pass additional information to a method is called a:
  1. command
  2. parameter
  3. return type
  4. signature
  1. The specification of a method, which shows its return type, name and parameters is called its:
  1. command
  2. parameter
  3. return type
  4. signature
  1. Another name for objects is:
  1. classes
  2. commands
  3. methods
  4. instances
  1. An instruction that tells an object to perform a specific task it has programming code to do is called a:
  1. parameter
  2. command
  3. method call
  4. instance
  1. The command that allows you to make a decision based on true or false conditions is a(n):
  1. list command
  2. do command
  3. act statement
  4. if statement
  1. When you need to call a method from a different class you must specify the class name before the method name using:
  1. dot notation
  2. parenthetical citation
  3. curly braces
  4. spaces
  1. Methods that belong to the class itself are marked with the keyword:
  1. void
  2. public
  3. static
  4. general
  1. By convention, class names in Java should always start with a:
  1. capital letter
  2. small letter but use capital letters for the beginning of words in the middle of it
  1. This default Greenfoot method is automatically created in each new class and is what is executed when you click on Act or Run in the window:
  1. canSee()
  2. move()
  3. run()
  4. act()
  1. Comments are ignored by the computer but necessary for documentation for the user and they are started with:
  1. /**
  2. (
  3. {
  1. By convention, method names in Java should always start with a:
  1. capital letter
  2. small letter but use capital letters for the beginning of words in the middle of it because they cannot contain spaces
  1. A bit of memory that belongs to an object to store information is called a:
  1. method call
  2. instance variable
  3. return type
  1. Good Java coding practice dictates that we should declare all of our variables:
  1. at the top of the class
  2. inside of the method that it is going to be used in
  3. at the end of the class
  1. An assignment statement enables us to store something into a variable. The symbol that allows us to do that is:
  1. !=
  2. =
  3. ==
  4. /=
  1. This statement can be added to the IF statement to specify what should happen if the condition is false:
  1. when
  2. while
  3. do
  4. else
  1. Putting this symbol in front of something means NOT:
  1. . (dot
  2. ! (exclamation mark)
  3. ^(caret)
  4. –(dash)
  1. These symbols mean AND, which will join two conditions:
  1. !!
  2. ||
  1. When we need to repeat code or do a similar task repeatedly, we need a:
  1. constant
  2. loop
  3. modifier
  4. instance
  1. This type of data structure allows us to store many values of the same type and access them using an index, like this whiteKeys[2], which would access the third element:
  1. String
  2. Array
  3. Double
  4. Constant
  1. A special expression that means “nothing” or “no object” is:
  1. null
  2. private
  3. static
  4. Boolean

True and False- Circle T for True, circle F for False. 1 pt each ______7 pts

T F /
  1. A method with a void return type does not return a value.

T F /
  1. .Actors are classes that are placed into the world

T F /
  1. Computers do not understand source code that we type in so it needs to be translated into machine code by a compiler before being executed.

T F /
  1. Java is very case dependent, so Body and body represent two different things.

T F /
  1. Objects will inherit methods from its superclasses.

T F /
  1. Anything stored in an instance variable will be remembered as long as the object exists and can be accessed later.

T F /
  1. A constant is a named value that is used like a variable, but can only be changed by other classes.

Short Answer 3 points each ______27 pts

  1. Why do all loops need a loop counter?
  2. What is overloading? (CH 6)
  3. Explain what each of the first 4 words indicate in this statement:
    private static final double GRAVITY=5.8;
  4. If we want to use methods from other classes that are already written by other in the Java documentation like setting colors from the Color class or using the List type from the Util class, we must first ______those packages.
  1. Tell what the following code would do to the values of i and j:

private void example()

{

int j=10

for (int i=0; i<10; i++)

{

j=j – i;

}

}

  1. Fill in the blanks of the following code so that it does exactly what the code above does.

private void exampleAgain()

{

int j=10, i=0;

while (i<______)

{

j = j - i;

i ______

}

}

  1. Explain what this method does:

private void anotherExample(int x, int y)

{

value=2*x+2*y;

}

To add a new actor, like a lobster, to this little-crab world, you would:

To place a crab into the world manually (not using the Act or Run buttons), you would:

1