Page 1
AP Computer Science Java Review
Latest Questions and Correct Answers
What are the four valid commands Karel knows?
Ans: -move();
-turnLeft();
-putBall();
-takeBall();
Which of these is a valid Java Karel command?
A.) move();
B.) move;
C.) move()
D.) move(5)
Ans: A.) move();
What are rows known as in Karel's world?
Ans: Streets
, Page 2
What are the columns known as in Karel's world
Ans: Avenues
If Karel starts at Street 1 and Avenue 3 facing East, what row
and column will Karel be on after this code runs?
move();
move();
move();
turnLeft();
move();
Ans: Street 2 and Avenue 6
How do you write a Java Class?
Ans: public class SquareKarel extends Karel
{
}
What is the Run Method?
Ans: The place where our program starts running
public void run()
, Page 3
{
}
How do you write a Java Class with Run Method?
Ans: public class SquareKarel extends Karel
{
public void run ()
{
// our code goes here
}
}
What is the run method in a Java program with Karel?
A.) A method that always makes Karel move in a square.
B.) The method that is called just before the program ends.
C.) The method that is called to start a Karel program.
D.) The method that is called in order to move Karel one
space forward.
AP Computer Science Java Review
Latest Questions and Correct Answers
What are the four valid commands Karel knows?
Ans: -move();
-turnLeft();
-putBall();
-takeBall();
Which of these is a valid Java Karel command?
A.) move();
B.) move;
C.) move()
D.) move(5)
Ans: A.) move();
What are rows known as in Karel's world?
Ans: Streets
, Page 2
What are the columns known as in Karel's world
Ans: Avenues
If Karel starts at Street 1 and Avenue 3 facing East, what row
and column will Karel be on after this code runs?
move();
move();
move();
turnLeft();
move();
Ans: Street 2 and Avenue 6
How do you write a Java Class?
Ans: public class SquareKarel extends Karel
{
}
What is the Run Method?
Ans: The place where our program starts running
public void run()
, Page 3
{
}
How do you write a Java Class with Run Method?
Ans: public class SquareKarel extends Karel
{
public void run ()
{
// our code goes here
}
}
What is the run method in a Java program with Karel?
A.) A method that always makes Karel move in a square.
B.) The method that is called just before the program ends.
C.) The method that is called to start a Karel program.
D.) The method that is called in order to move Karel one
space forward.