22
Test: Java Fundamentals Midterm Exam Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer. Section 2 (Answer all questions in this section) 1 . In Alice, procedural abstraction is the concept of making code easier to understand and reuse. True or false? Mark for Review (1) Points True (*) False Correct 2 . In Alice, if a procedure is declared for a clownFish class, which classes can use the procedure? Mark for Review (1) Points The clownFish class and Swimmer class ClownFish class (*) The pajamaFish class, clownFish class, and Swimmer class Any class with "Fish" in the class name Correct 3 . From your Alice lessons, which of the following is a tool to show the logic of an animation? Mark for Review (1) Points Visual storyboard Flowchart (*) Pie chart

Java Fundamentals Midterm Exam

  • Upload
    4

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Test: Java Fundamentals Midterm ExamReview your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

Section 2(Answer all questions in this section)

1.In Alice, procedural abstraction is the concept of making code easier to understand and reuse. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

2.In Alice, if a procedure is declared for a clownFish class, which classes can use the procedure?

Mark forReview 

(1) Points

The clownFish class and Swimmer classClownFish class (*)The pajamaFish class, clownFish class, and Swimmer classAny class with "Fish" in the class name

Correct

3.From your Alice lessons, which of the following is a tool to show the logic of an animation?

Mark forReview 

(1) Points

Visual storyboardFlowchart (*)Pie chart

Scene editorClass chart

Incorrect. Refer to Section 2 Lesson 5.

4.In Alice, which function is used to move an object directly to the center point of another object?

Mark forReview 

(1) Points

getObjectgetDurationgetDepthgetDistance (*)

Incorrect. Refer to Section 2 Lesson 7.

5.Which of the following statements about what happens when the following code is executed is false?

Mark forReview 

(1) Points

The message "Printing Some Text" will be printed until loopVal is no longer less than 5.The variable loopVal is initialized to 0.The condition loopVal < 5 is tested after the block is executed. (*)The condition loopVal < 5 returns a boolean value.None of the above.

Correct

6.If youwant one message to display if auser is below the age of18 anda different message to display if the user is 18 or older,what type of construct would you use?

Mark forReview 

(1) Points

for all loopdo loopwhile loop

if (*)

Incorrect. Refer to Section 2 Lesson 14.

7. The Alice IF control structure requires the false statement to be populated. Trueor false?

Mark forReview 

(1) Points

TrueFalse (*)

Correct

8. In Alice, Do In Order and Do Together: Mark forReview 

(1) Points

Are move statementsAre control statements (*)Are complex statementsNone of the above

Correct

9. In Alice, the setVehicle procedure will associate one object to another. True or false?

Mark forReview 

(1) Points

True (*)False

Incorrect. Refer to Section 2 Lesson 6.

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

Mark forReview 

(1) Points

(Choose all correct answers)

A biped object walking. (*)A rock object turning.A fish swimming. (*)A bird flying. (*)

Incorrect. Refer to Section 2 Lesson 6

11.

In Alice, howis a one-shot procedure different from proceduresin the Code editor?

Mark forReview 

(1) Points

One-shot procedures are only available for acting objects, while procedures are available for all objects.One-shot procedures are available in the Code editor, while procedures are availablein the Scene editor.A one-shot procedure executes only one timeto re-position the object, while proceduresin the Code editor execute every time the Run button is clicked. (*)

All of the above

Incorrect. Refer to Section 2 Lesson 2.

12.From your Alice lessons, variables are fixed and cannot be changed. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Correct

13.Which of the following programming instructions commands the fish to continuouslymove forward a random speed between 0.5 and 1.0 meters, minus 0.25 meters, until it collides with the shark?

Mark forReview 

(1) Points

(*)

Correct

14.From your Alice lessons, what does the Count control statement do?

Mark forReview 

(1) Points

Executes statements a random number of times.Executes statements simultaneously.Executes statements a specific number of times. (*)Executes statements while a condition is true.

Correct

15.From your Alice lessons, when testing your animation, you should test that comments were added below each sequence of instructions in the code. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

CorrectSection 2(Answer all questions in this section)

16.From your Alice lessons, at what point in the animation process do you confirm the items on the "Checklist for Animation Completion"?

Mark forReview 

(1) Points

Before designing the animation.During and after the animation process. (*)At the beginning of the animation process.After adding each procedure to the Code editor.

Correct

17.Debugging and testing is the process of running the animation one time, and adjusting the control statements, procedures, and arguments.

Mark forReview 

(1) Points

TrueFalse (*)

Incorrect. Refer to Section 2 Lesson 3.

18.From your Alice lessons, complete the following sentence: When coded, an event triggers a ___________.

Mark forReview 

(1) Points

Infinite loopGalleryProcedure (*)Scene

Correct

19In Alice, which of the following programming Mark for

.statements moves the butterfly forward, doublethe distance to the tree?

Review (1) Points

this.Butterfly move forward {this.ButterflygetDistanceTo this.Tree * 2} (*)this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree * 2}this.Butterfly move backward {this.Butterfly getDistanceTo this.Tree / 2}this.Butterfly move forward {this.ButterflygetDistanceTo this.Tree / 2}

Correct

20.In Alice, which of the following programming statements moves the fish forward, the distance to the rock, minus the depth of the rock?

Mark forReview 

(1) Points

this.Fish move forward {this.Rock getDistanceTo this.Fish - this.Fish getDepth}this.Fish move forward {this.Fish getDistanceTo this.Rock - this.Rock getDepth} (*)this.Fish move forward {this.Rock getDistanceTo this.Fish - this.Fish - 2}this.Rock move forward {this.Rock getDistanceTo this.Fish - this.Fish - 2}

Correct21.

Examine the following code. What are the variables?

Markfor

Review (1) Points

(Choose all correct answers)

argsn (*)i (*)t

Incorrect. Refer toSection 2 Lesson 13.

22. Which of the following is not a valid arithmetic operator in

Markfor

Review (1) Points

Java?

+/-*%None of the above (*)

Correct

Section 3(Answer all questions in this section)

23. From your Greenfoot lessons, sourcecode is writtenin the Code editor. True orfalse?

Markfor

Review (1) Points

True (*)False

Correct

24. In Greenfoot, what happens ifthe condition is false in an if-statement?

Markfor

Review (1) Points

The

programming statements are executed.The if-statement is executed.The act method is deleted.The programming statements are not executed. (*)

Correct

25. Use your Greenfoot knowledge to answer the question. One reason to writea defined method in a class is to change the behavior of theclass. True or false?

Markfor

Review (1) Points

TrueFalse (*)

Incorrect. Refe

r toSection 3 Lesson 6

26.From your Greenfoot lessons, howdo youcall adefined method?

Mark forReview 

(1) Points

Call the method from the act method. (*)Call the method from the defined method.Write the method in the World superclass.Write the method in the instance.Write the method in the source code.

Correct

27. Which of the following type of audience should you ask to play your Greenfoot game during the testing phase?

Mark forReview 

(1) Points

TestingTarget (*)PrimaryProgrammer

Incorrect. Refer to Section 3 Lesson 4.

28. From your Greenfoot lessons, a problem statement defines the purpose for your game. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

29. Using Greenfoot, how do we change the size and resolution of the World instance?

Mark forReview 

(1) Points

Edit the methods in the class.Edit the values in the constructor. (*)Delete the instance.Edit the values in the class's act method.

Correct

30. In Greenfoot, an if-statement is used to alternate between displaying two images in an instance. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Correct 31.Using theGreenfootIDE, whenis a construct

Mark forReview 

(1) Points

or automatically executed?

When source code is written.When a new image is added to the class.When a new instance of the class is created. (*)When the act method is executed.

Correct

32. From your Greenfoot lessons, which of the following is an example of a type of data passed through a parameter?

Mark forReview 

(1) Points

MethodsClassesIntegers (*)Scenarios

Incorrect. Refer to Section 3 Lesson 2.

33. In Greenfoot, the properties of an instance can be modified in the documentation. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Incorrect. Refer to Section 3 Lesson 2.

34. From your Greenfoot lessons, which of the following are properties of an

Mark forReview 

instance? (1) Points

SizeColorImage fileMethodsAll of the above (*)

Incorrect. Refer to Section 3 Lesson 2.

35. In the following Greenfoot method signature, which is the method name?

void turnLeft()

Mark forReview 

(1) Points

()voidturnLeft (*)Left

Correct36.From your Greenfoot lessons,which ofthe following is nota characteristic of a static method?

Mark forReview 

(1) Points

Belongs to a class itself

Belongs to an instance itself (*)Available for other classes to use with dot notationSignature contains the word staticIs a method

Incorrect. Refer to Section 3 Lesson 5.

37. From your Greenfoot lessons, dot notation allows you to use a method from a different class, if the class you are programming does not possess the method. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

38. When a Greenfoot code segment is executed in an if-statement, each line of code is executed in sequential order. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

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

Mark forReview 

(1) Points

True (*)False

Correct

40. From your Greenfoot lessons, the keyDown method is located in which class?

Mark forReview 

(1) Points

ActorGreenfoot (*)GreenfootImageWorld

Correct41.From your Greenfoot lessons, which of thefollowing isnot a step to creating a new subclass?

Mark forReview 

(1) Points

Right-click on a superclass.Click New subclass...Name the class.Select an image for the class.Program the class to move forward. (*)

Incorrect. Refer to Section 3 Lesson 1.

42. From your Greenfoot lessons, a scenario is a game or simulation implemented in Greenfoot. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

43. How would the following sentence be written in Greenfoot source code? If Duke's leg is down, and the keyboard key "d" is down...

Mark forReview 

(1) Points

if (&&isDown ! Greenfoot.isKeyDown("d") )if (!isDown && Greenfoot.isKeyDown("d") )if (isDown && Greenfoot.isKeyDown("d")) (*)if (!Greenfoot.isKeyDown && isDown("d") )

Correct

44. From your Greenfoot lessons, what is a loop?

Mark forReview 

(1) Points

A statement that executes one segment of code.A statement that can execute a sectionof code multiple times. (*)A statement that can execute a sectionof code one time.A statement that can execute a method multiple times.

Incorrect. Refer to

Section 3 Lesson 10.

45. From your Greenfoot lessons, when do infinite loops occur?

Mark forReview 

(1) Points

When the loop is executed.Only in while loops.When the end to the code isn't established. (*)When the end to the act method isn't established.

Incorrect. Refer to Section 3 Lesson 10.

Section 3(Answer all questions in this section)

46.

In the following Greenfoot array, what statement would you write to access the "a" key?

Keynames = {"a", "b", "c", "d"};

Mark forReview 

(1) Points

keynames[2]keynames["a"]keynames[0] (*)keynames["a" key]

Correct

47.

From your Greenfoot lessons, which line of code ismissing something?

Mark forReview 

(1) Points

13 (*)456

Correct

48.

In Greenfoot, the image below is an example of what construct?

Mark forReview 

(1) Points

MethodCommentConstructor (*)Class

Incorrect. Refer to Section 3 Lesson 12.

49.

Use your Greenfoot skills to answer the question. What is incorrect in this code?

Mark forReview 

(1) Points

Spacing missingCurly brace missingParenthesis missing (*)Comma missing

Correct

50.

From your Greenfoot lessons, which of the following are examples of abstraction?

Mark forReview 

(1) Points

(Choose all correct answers)

Playing a range of sounds when keyboard keys are pressed. (*)A single instance displays a single image.Assigning a different keyboard key to each instance. (*)Programming a single movement for a single instance.Assigning a different image file to each instance. (*)

Correct