Top Banner
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, when a new procedure is declared, all subclasses of the superclass will inherit the procedure. True or false? Mark for Review (1) Points True (*) False Correct 2 . A scenario gives the Alice animation a purpose. True or false? Mark for Review (1) Points True (*) False Correct 3 . In Alice, objects inherit the characteristics of their: Mark for Review (1) Points Code Project Class (*) Program Correct
17

Mid Java Fundamental

Apr 29, 2023

Download

Documents

ardi siwi
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Mid Java Fundamental

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, when a new procedure is declared, allsubclasses of the superclass will inherit the procedure. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

2.A scenario gives the Alice animation a purpose.True or false?

Mark forReview 

(1) Points

True (*)False

Correct

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

Mark forReview 

(1) Points

CodeProjectClass (*)Program

Correct

Page 2: Mid Java Fundamental

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

Mark forReview 

(1) Points

TrueFalse (*)

Correct

5.A variable is a named location inside the computer's memory; once there, the information can be retrieved and changed. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

Section 2(Answer all questions in this section)

6.Functions answer questions about an object, such as its height, width, depth and even distance to another object. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

7.Which of the following would not be an argument in an Alice programming instruction that commands a person object to move forward 2 meters?

Mark forReview 

(1) Points

Number of seconds to execute the

Page 3: Mid Java Fundamental

programming instructionDirection to moveDistance to move forwardPerson's height (*)

Correct

8.From your Alice lessons, functional decomposition is the process of taking a complex problem or process and growing it intolarger parts that are easier to manage. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Correct

9.From your Alice lessons, if you examined a science process that had many steps, which of the following is a way that you could apply functional decomposition to this process?

Mark forReview 

(1) Points

1. Present the problem as an animation. 2. Further refine and define the tasks needed for each high level step. 3. Identify the high level steps for the science concept.1. Identify the detailed steps for the science concept. 2. Present the problem as an animation.1. Present the problem as an animation.1. Identify the high level steps for the science concept.2. Further refine and define the tasks needed for each high level step.3. Present the problem as an animation. (*)

Correct

Page 4: Mid Java Fundamental

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

Mark forReview 

(1) Points

(Choose all correct answers)

repeat...untildo while loop (*)while loop (*)if

Incorrect. Refer to Section 2 Lesson 14.

Section 2(Answer all questions in this section)

11.

In Java, a function is a method that returns a value. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

12.

A loop can be infinite (continue forever) or conditional (stops upon a condition). True or false?

Mark forReview 

(1) Points

True (*)False

Correct

1Which of the following is not a valid primitive Mark for

Page 5: Mid Java Fundamental

3.type in Java? Review 

(1) Points

booleanString (*)longintdouble

Correct

14.

What is the output produced by the following code?

Mark forReview 

(1) Points

j is 5k is 5 (*)j is 10 j is 5 k is 5j is 10k is 10j is 15k is 15

Page 6: Mid Java Fundamental

Correct

15.

An Alice event is considered what? Mark forReview 

(1) Points

A party with at least 20 people.An object's orientation.Error handling.A keystroke or mouse click. (*)

Correct

Section 2(Answer all questions in this section)

16.In Alice, how is a one-shot procedure different from procedures in 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

Correct

17.In Alice, which of the following programming statements moves the butterfly forward, doublethe distance to the tree?

Mark forReview 

(1) Points

Page 7: Mid Java Fundamental

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

18.In Alice, which of the following programming statements moves the cat backward, half the distance to the bird?

Mark forReview 

(1) Points

this.Cat move backward {this.Bird getDistanceTo this.Cat / 2}this.Cat move forward {this.Bird getDistanceTo this.Cat / 2}this.Bird move forward {this.Bird getDistanceTo this.Cat / 2}this.Cat move backward {this.Cat getDistanceTo this.Bird / 2} (*)

Correct

19.Which of the following actions would require acontrol 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. (*)

Page 8: Mid Java Fundamental

Correct

20.In Alice, the procedures' arguments allow the programmer to adjust the object, motion, distance amount, and time duration. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

Section 2(Answer all questions in this section)

21.In Alice, Do In Order and Do Together: Mark for

Review (1) Points

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

Correct

22.The first step to using a top-down approach toprogramming is to create a table to align the storyboard steps to the programming instructions. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Incorrect. Refer to Section 2 Lesson 4.

Page 9: Mid Java Fundamental

Section 3(Answer all questions in this section)

23.When designing a game in Greenfoot, it helps to define the actions that will take place in a textual storyboard. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

24.Using the Greenfoot IDE, which of the following programming statements tells the object to turn 38 degrees?

Mark forReview 

(1) Points

move():move(2);turn(38); (*)turn(38):

Correct

25.Which method is used to play sound in your Greenfoot game?

Mark forReview 

(1) Points

getSound methodfindSound methodplaySound method (*)importSound method

Correct

Section 3(Answer all questions in this section)

Page 10: Mid Java Fundamental

26.

From your Greenfoot lessons, an instance inherits all of the characteristics of the class, and thosecharacteristics cannot be changed. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Correct

27.

In Greenfoot, a subclass is created by right-clicking on a superclass. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

28.

From your Greenfoot lessons, which of the following is an example of changing test data during a Q/A test cycle?

Mark forReview 

(1) Points

Use a different operating system.Use the mouse instead of the keyboard.Use symbols instead of numbers. (*)All of the above.

Correct

29.

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

Mark forReview 

(1) Points

Page 11: Mid Java Fundamental

13 (*)456

Correct

30.

The image below is an example of what Greenfoot construct?

Mark forReview 

(1) Points

Method (*)ConstructorConditionalClass

Correct

Section 3(Answer all questions in this section)

Page 12: Mid Java Fundamental

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

Mark forReview 

(1) Points

True (*)False

Correct

32.From your Greenfoot lessons, source code is written in the Code editor. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

33.From your Greenfoot lessons, when does an if-else statement execute it's second code segment?

Mark forReview 

(1) Points

When a random number is less than 10.When an instance is created.After the first code segment is executed.If a condition is false. (*)If a condition is true.

Correct

34.From your Greenfoot lessons, which of the following comparison operators represents "greater than"?

Mark forReview 

(1) Points

> (*)<

Page 13: Mid Java Fundamental

= =! =

Correct

35.From your Greenfoot lessons, which of the following is not a characteristic of a static method?

Mark forReview 

(1) Points

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

Incorrect. Refer to Section 3 Lesson 5.

Section 3(Answer all questions in this section)

36.From your Greenfoot lessons, which axes definean object's position in a world?

Mark forReview 

(1) Points

(Choose all correct answers)

x (*)zy (*)w

Correct

37.From your Greenfoot lessons, abstraction techniques can only be used once in a class's source code. True or false?

Mark forReview 

(1) Points

Page 14: Mid Java Fundamental

TrueFalse (*)

Correct

38.In Greenfoot, we can use the act method in theclass to automatically create the Actor instances when the world is initialized. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Correct

39.We can use the Actor constructor to automatically create Actor instances when the Greenfoot world is initialized. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Correct

40.In Greenfoot, a defined variable is a variablethat is defined in an instance. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Incorrect. Refer to Section 3 Lesson 8.

Section 3(Answer all questions in this section)

41.In Greenfoot, a way to have all subclasses of a superclass inherit a method is by adding the

Mark for

Page 15: Mid Java Fundamental

method to the superclass. True or false? Review (1) Points

True (*)False

Correct

42.Use your Greenfoot knowledge to answer the question. One reason to write a defined methodin a class is to change the behavior of the class. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Incorrect. Refer to Section 3 Lesson 6.

43.Use your Greenfoot knowledge: An array object holds a single variable. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Correct

44.From your Greenfoot lessons, which symbol represents string concatenation?

Mark forReview 

(1) Points

Symbol &Symbol <Symbol =Symbol + (*)

Correct

Page 16: Mid Java Fundamental

45.From your Greenfoot lessons, what is a loop? Mark for

Review (1) Points

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

Incorrect. Refer to Section 3 Lesson 10.

Section 3(Answer all questions in this section)

46.In Greenfoot, what happens if the end to a while loop isn't established?

Mark forReview 

(1) Points

The code will keep executing and will neverstop. (*)The code will execute once and then stop, due to controls in Greenfoot.The code will prompt you to enter a loop counter.The code will not execute.

Correct

47.From the Greenfoot IDE, where are inherited methods located?

Mark forReview 

(1) Points

In the computer networkIn the Greenfoot image gallery

Page 17: Mid Java Fundamental

In the Scene editorIn the documentation (*)

Correct

48.From your Greenfoot lessons, when a method needs additional data to perform a task, this data comes from parameters. True or false?

Mark forReview 

(1) Points

True (*)False

Correct

49.In the Greenfoot IDE, which of the following are components of a parameter?

Mark forReview 

(1) Points

(Choose all correct answers)

Parameter type (*)Parameter returnParameter name (*)Parameter methodParameter void

Correct

50.In Greenfoot, a variable can be saved and accessed later, even if the instance no longerexists. True or false?

Mark forReview 

(1) Points

TrueFalse (*)

Correct