Ujian Java Fundamentals Midterm Exam – 2017

1. After each execution of your Alice animation, what element or elements could be adjusted in your code?
Control statements
Procedures
Arguments
All of the above (*)

2. In Alice, where you would you get access to the specific joints of an object that are not available through the object drop down menu?
code editor
scene editor
functions tab (*)
procedures tab

3. In Alice, which of the following programming statements moves the butterfly forward, double the distance to the tree?
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree / 2}
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}
this.Butterfly move forward {this.Butterfly getDistanceTo this.Tree * 2} (*)
this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}

4. In Alice, we can avoid object collision using what?
Using object detection.
Slowing movements down.
Using math operators. (*)
Downloading the Alice 3 collision detector app.

5. In Alice, what are the forms of a scenario?
(Choose all correct answers)
A task to perform. (*)
A section of code to write.
A problem to solve. (*)
A person to help.
A system to start.

6. From your Alice lessons, a textual storyboard provides a detailed, ordered list of the actions each object performs in each scene of the animation. True or false?
True (*)
False

7. Saved Alice projects can be opened and edited. True or false?
True (*)
False
8. From your Alice lessons, variables are fixed and cannot be changed. True or false?
True
False (*)

9. In Alice, you can access the Java on the side option through which menu option?
Edit
Run
Window (*)
Project

10. Which Alice execution task corresponds with the following storyboard statement? <br>Cat rolls to the left.
Cat roll Right 1
roll Left 1
Cat roll Left 1
this.Cat roll Left 1.0 (*)

11. In Alice, when two objects are synchronized and move together, this means that one object is:
A class of another
A vehicle of another (*)
An object of another
An instance of another

12. In Alice, which of the following is not a control statement?

While

Move (*)

Count

 

13. Which of the following actions would require a control statement to control animation timing?

(Choose all correct answers)

A fish swimming. (*)

A biped object walking. (*)

A bird flying. (*)

A rock object turning.

 

14. An Alice event is considered what?

Error handling.

A keystroke or mouse click. (*)

An object’s orientation.

A party with at least 20 people.

 

15. When creating an event based on a keypress which event handler would you use?

Mouse

Position/Orientation

Keyboard (*)

Scene Activation/Time

 

 

16. What is the result of the following code?

Mark for Review
(1) Points

x > y : x > y
x < y : x < y

x > y : 0
x < y : 1

x > y : false
x < y : true

x > y : 1
x < y : 0

x > y : true
x < y : false (*)

 

17. Examine the following code. What are the variables?

(Choose all correct answers)

i (*)

n (*)

args (*)

t (*)

 

18. In Alice, which of the following are benefits of separating out motions into their own procedures?

(Choose all correct answers)

It allows many objects of a class to use the same procedure. (*)

It simplifies code and makes it easier to read. (*)

It makes the animation easier to run.

It makes the scene easier to view.

It can allow subclasses of a superclass to use a procedure. (*)

 

19. In Alice, objects inherit the characteristics of their:

Class (*)

Code

Project

Program

 

20. An animation gives the scenario a purpose. True or false?

True

False (*)

 

 

21. If you want one message to display if a user is below the age of 18 and a different message to display if the user is 18 or older, what type of construct would you use?

while loop

for all loop

if (*)

do loop

 

22. If you need to repeat a group of Java statements many times, which Java construct should you use?

(Choose all correct answers)

if

do while loop (*)

while loop (*)

repeat…until

 

23. In Alice, we use the WHILE control statement to implement the conditional loop. True or false?

True (*)

False

 

24. In Alice, once an instance is added to the scene, it cannot be deleted. True or false?

True

False (*)

 

Section 3
(Answer all questions in this section)

25. In Greenfoot, you must first create an instance before you create a class. True or false?

True

False (*)

 

 

26. In Greenfoot, a subclass is a specialization of a superclass. True or false?

True (*)

False

 

27. In Java what is casting?

Casting is when we want to tell the java compiler that a class we are accessing is really another type of class (*)

Casting is when we reset the state of an instance.

Casting is when we change the coordinates of an actor

Casting is when we remove an object from the world

 

28. From your Greenfoot lessons, what can methods belong to?

(Choose all correct answers)

Galleries

Classes (*)

Scenarios

Objects (*)

All of the above

 

29. From your Greenfoot lessons, classes can only use the methods they have inherited. They cannot use methods from other classes. True or false?

True

False (*)

 

30. In Greenfoot you can use comparison operators to compare a variable to a random number. True or false?

True (*)

False

31. Which of the following comparison operators represents “greater than or equal”?

>= (*)

>

! =

= =

 

32. Defined methods are methods that are only created by the Greenfoot development team?

True

False (*)

 

33. In Greenfoot, which of the following statement is true about Defined Methods?

A defined method only relates to the World class.

A defined method is automatically executed once created.

A defined method is only relevant to the Greenfoot Development team.

A defined method must be called by your source code, normally in the Act method. (*)

 

34. In Greenfoot what command would you use to detect if a mouse has been clicked on an actor?

Greenfoot.clicked(this)

Actor.clicked(this)

Greenfoot.pressed(this)

Greenfoot.mouseClicked(this) (*)

 

35. From your Greenfoot lessons, the isKeyDown method is located in which class?

World

Greenfoot (*)

GreenfootImage

Actor

 

36. When a program is tested once and it works then testing is complete.

True

False (*)

 

37. From your Greenfoot lessons, how do you know the program does not contain syntax errors?

Write the code.

Review the documentation.

Inspect the instances.

Compile the code. (*)

 

38. From your Greenfoot lessons, if the condition in an if-statement is true, the first code segment is executed. True or false?

True (*)

False

 

39. The list below displays components of the Greenfoot source code editor except one. Which one should be removed?

Documentation

Instance creator (*)

Method body

Class description

Comments

 

40. Use your Greenfoot knowledge to answer the question: Where are defined variables typically entered in a class’s source code?

After the constructors and methods in the source code.

Between the constructors and methods in the source code.

In the defined method in the source code.

At the top of the source code, before the constructors and methods. (*)

 

41. The GreenfootImage class enables Greenfoot actors to maintain their visible image by holding an object of type GreenfootImage. True or false?

True (*)

False

 

42. What does the following programming statement mean?

image1 = new GreenfootImage(“duke12.png”);

The image file, duke12.png, has just been drawn and imported into the scenario.

Image files from 1-119 are associated with image1.

The variable, image1, cannot use the image file, duke12.png.

The image file, duke12.png, is assigned to the variable image1. (*)

 

43. In the Greenfoot IDE, an instance’s position is on the x and y coordinates. True or false?

True (*)

False

 

44. Using the Greenfoot IDE, only five instances can be added to a scenario. True or false?

True

False (*)

 

45. In Greenfoot, the body of the method is located in between which of the following characters?

Asterisks **

Parnetheses ( )

Curly brackets { } (*)

Square brackets [ ]

 

46. A variable is also known as a ____________.

Class

Instance

Method

Syntax

Field (*)

 

47. In Greenfoot, string concatenation reduces the number of redundant characters or phrases you need to type into each array. True or false?

True (*)

False

 

48. In Greenfoot, what types of values cannot be stored in a local variable?

Integers

Method (*)

Objects

World name

Class name

 

49. In Greenfoot, which of the following statements could prevent an infinite loop from occurring?

i = 100 + i

i=1

i = i

i = i + 1 (*)

 

50. In Greenfoot, what type of symbol is used to connect boolean expressions?

Keyboard key names

Logic operators (*)

Integers

String concatenation

Post Author: adminwu