Test: Java Fundamentals Midterm Exam Review your answers, feedback, feedbac k, and question qu estion scores below. A An n asterisk (*) indicates a correct answer. Section 2 (Answer all questions in this section) 1n Alice, !rocedural abstraction is the conce!t of "akin# code easier to . understand and reuse. $rue or false%
&ark for Review (1) 'oints
$rue (*) alse orrect 2n Alice, if a !rocedure is declared for a clownish class, which classes . can use the !rocedure%
&ark for Review (1) 'oints
$he clownish class and Swi""er class lownish class (*) $he !aa"aish class, clownish class, and Swi""er class Any class with +ish+ in the class na"e orrect ro" your Alice lessons, which of the followin# is a tool to show the . lo#ic of an ani"ation%
&ark for Review (1) 'oints
-isual storyboard lowchart (*) 'ie chart Scene editor lass chart
ncorrect. Refer to Section 2 esson /. 0n Alice, which function is used to "ove an obect directly to the center . !oint of another obect%
&ark for Review (1) 'oints
#etbect #eturation #ete!th #etistance (*) ncorrect. Refer to Section 2 esson 3. /4hich of the followin# state"ents about what ha!!ens wh en the . followin# code is e5ecuted is false%
&ark for Review (1) 'oints
$he "essa#e +'rintin# So"e $e5t+ will be !rinted until loo!-al is no lon#er less than /. $he variable loo!-al is initiali6ed to 7. $he condition loo!-al 8 / is tested after the block is e5ecuted. (*) $he condition loo!-al 8 / returns a boolean value. 9one of the above. orrect :.f you want one "essa#e to dis!lay if a user is below the a#e of 1; and a
&ark for Review (1) 'oints
different "essa#e to dis!lay if the user is 1; or older, what ty!e of construct would you use% for all loo! do loo! while loo! if (*) ncorrect. Refer to Section 2 esson 10. 3. $he Alice control structure requires the false state"ent to be !o!ulated. $rue or false%
&ark for Review (1) 'oints
$rue alse (*) orrect ;. n Alice, o n rder and o $o#ether<
&ark for Review (1) 'oints
Are "ove state"ents Are control state"ents (*) Are co"!le5 state"ents 9one of the above orrect =. n Alice, the set-ehicle !rocedure will associate one obect to another. $rue or false%
&ark for Review (1) 'oints
$rue (*) alse ncorrect. Refer to Section 2 esson :. 17. 4hich of the followin# actions would require a control state"ent to control ani"ation ti"in#%
&ark for Review (1) 'oints
(hoose all correct answers) A bi!ed obect walkin#. (*) A rock obect turnin#. A fish swi""in#. (*) A bird flyin#. (*) ncorrect. Refer to Section 2 esson : 1n 1.Alice, how is a one> shot !rocedu re differen t fro" !rocedu res in the ode editor%
&ark for Review (1) 'oints
ne>shot !rocedures are only available for actin# obects, while !rocedures are available for all obects. ne>shot !rocedures are available in the ode editor, while !rocedures are available in the Scene editor. A one>shot !rocedure e5ecutes only one ti"e to re>!osition the obect, while !rocedures in the ode editor e5ecute every ti"e the Run button is clicked. (*) All of the above ncorrect. Refer to Section 2 esson 2.
12. ro" your Alice lessons, variables are fi5ed and cannot be chan#ed. $rue or false%
&ark for Review (1) 'oints
$rue alse (*) orrect 1. 4hich of the followin# !ro#ra""in# instructions co""ands the fish to continuously "ove forward a rando" s!eed between 7./ and 1.7 "eters, "inus 7.2/ "eters, until it collides with the shark%
(*)
&ark for Review (1) 'oints
orrect 10. ro" your Alice lessons, what does the ount control state"ent do%
&ark for Review (1) 'oints
?5ecutes state"ents a rando" nu"ber of ti"es. ?5ecutes state"ents si"ultaneously. ?5ecutes state"ents a s!ecific nu"ber of ti"es. (*) ?5ecutes state"ents while a condition is true. orrect 1/. ro" your Alice lessons, when testin# your ani"ation, you should test that co""ents were added below each sequence of instructions in the code. $rue or false%
&ark for Review (1) 'oints
$rue alse (*) orrect Section 2 (Answer all questions in this section) 1:.ro" your Alice lessons, at what !oint in the ani"ation !rocess do you confir" the ite"s on the +hecklist for Ani"ation o"!letion+%
&ark for Review (1) 'oints
@efore desi#nin# the ani"ation. urin# and after the ani"ation !rocess. (*) At the be#innin# of the ani"ation !rocess. After addin# each !rocedure to the ode editor. orrect
13.ebu##in# and testin# is the !rocess of runnin# the ani"ation one ti"e, and adustin# the control state"ents, !rocedures, and ar#u"ents.
&ark for Review (1) 'oints
$rue alse (*) ncorrect. Refer to Section 2 esson . 1;.ro" your Alice lessons, co"!lete the followin# sentence< 4hen coded, an event tri##ers a .
&ark for Review (1) 'oints
nfinite loo! Ballery 'rocedure (*) Scene orrect 1=.n Alice, which of the followin# !ro#ra""in# state"ents "oves the butterfly forward, double the distance to the tree%
&ark for Review (1) 'oints
this.@utterfly "ove forward Cthis.@utterfly #etistance$o this.$ree * 2D (*) this.@utterfly "ove backward Cthis.@utterfly #etistance$o this.$ree * 2D this.@utterfly "ove backward Cthis.@utterfly #etistance$o this.$ree E 2D this.@utterfly "ove forward Cthis.@utterfly #etistance$o this.$ree E 2D orrect 27.n Alice, which of the followin# !ro#ra""in# state"ents "oves the fish forward, the distance to the rock, "inus the d e!th of the rock%
&ark for Review (1) 'oints
this.ish "ove forward Cthis.Rock #etistance$o this.ish > this.ish #ete!thD this.ish "ove forward Cthis.ish #etistance$o this.Rock > this.Rock #ete!thD (*) this.ish "ove forward Cthis.Rock #etistance$o this.ish >
this.ish > 2D this.Rock "ove forward Cthis.Rock #etistance$o this.ish > this.ish > 2D orrect 2?5a"ine the followin# code. 4hat are the variables% 1.
&ark for Review (1) 'oints
(hoose all correct answers) ar#s n (*) i (*) t ncorr ect. Refer to Sectio n2 esso n 1. 22. 4hich of the followin# is not a valid arith"etic o!erator in Fava%
G
&ark for Review (1) 'oints
E > * H 9one of the above (*) orre ct
Section (Answer all questions in this section) 2. ro" your Breenfoot lessons, source code is written in the ode editor. $rue or false%
&ark for Review (1) 'oints
$rue (*) alse orre ct 20. n Breenfoot, what ha!!ens if the condition is false in an if>state"ent% $he !ro#ra""in# state"ents are e5ecuted. $he if>state"ent is e5ecuted. $he act "ethod is deleted. $he !ro#ra""in# state"ents are not e5ecuted. (*) orre ct
&ark for Review (1) 'oints
2/. Ise your Breenfoot knowled#e to answer the question. ne reason to write a defined "ethod in a class is to chan#e the behavior of the class. $rue or false%
&ark for Review (1) 'oints
$rue alse (*) ncorr ect. Refer to Sectio n esso n: &ark for Review
2:.ro" your Breenfoot lessons, how do you call a defined "ethod%
(1) 'oints
all the "ethod fro" the act "ethod. (*) all the "ethod fro" the defined "ethod. 4rite the "ethod in the 4orld su!erclass. 4rite the "ethod in the instance. 4rite the "ethod in the source code. orrect 23. 4hich of the followin# ty!e of audience should you ask to !lay your Breenfoot #a"e durin# the testin# !hase%
&ark for Review (1) 'oints
$estin# $ar#et (*)
'ri"ary 'ro#ra""er ncorrect. Refer to Section esson 0. 2;. ro" your Breenfoot lessons, a !roble" state"ent defines the !ur!ose for your #a"e. $rue or false%
&ark for Review (1) 'oints
$rue (*) alse orrect 2=. Isin# Breenfoot, how do we chan#e the si6e and resolution of the 4orld instance%
&ark for Review (1) 'oints
?dit the "ethods in the class. ?dit the values in the constructor. (*) elete the instance. ?dit the values in the classJs act "ethod. orrect 7. n Breenfoot, an if>state"ent is used to alternate between dis!layin# two i"a#es in an instance. $rue or false%
&ark for Review (1) 'oints
$rue alse (*) orrect 1.Isin# the Breenfoot ?, when is a constructor auto"atically e5ecuted%
&ark for Review (1) 'oints
4hen source code is written. 4hen a new i"a#e is added to the class. 4hen a new instance of the class is created. (*) 4hen the act "ethod is e5ecuted. orrect 2. ro" your Breenfoot lessons, which of the followin# is an e5a"!le of a ty!e of data !assed throu#h a !ara"eter%
&ark for Review (1) 'oints
ðods lasses nte#ers (*) Scenarios ncorrect. Refer to Section esson 2. . n Breenfoot, the !ro!erties of an instance can be "odified in the docu"entation. $rue or false%
&ark for Review (1) 'oints
$rue alse (*) ncorrect. Refer to Section esson 2. 0. ro" your Breenfoot lessons, which of the followin# are !ro!erties of an instance%
&ark for Review (1) 'oints
Si6e olor "a#e file ðods All of the above (*)
ncorrect. Refer to Section esson 2. /. n the followin# Breenfoot "ethod si#nature, which is the "ethod na"e%
&ark for Review (1) 'oints
void turneft() () void turneft (*) eft orrect :.ro" your Breenfoot lessons, which of the followin# is not a characteristic of a static "ethod%
&ark for Review (1) 'oints
@elon#s to a class itself @elon#s to an instance itself (*) Available for other classes to use with dot notation Si#nature contains the word static s a "ethod ncorrect. Refer to Section esson /. 3. ro" your Breenfoot lessons, dot notation allows you to use a "ethod fro" a different class, if the class you are !ro#ra""in# does not !ossess the "ethod. $rue or false%
$rue (*) alse orrect
&ark for Review (1) 'oints
;. 4hen a Breenfoot code se#"ent is e5ecuted in an if> state"ent, each line of code is e5ecuted in sequential order. $rue or false%
&ark for Review (1) 'oints
$rue (*) alse orrect =. n Breenfoot, you can use co"!arison o!erators to co"!are a variable to a rando" nu"ber. $rue or false%
&ark for Review (1) 'oints
$rue (*) alse orrect 07. ro" your Breenfoot lessons, the keyown "ethod is located in which class%
&ark for Review (1) 'oints
Actor Breenfoot (*) Breenfoot"a#e 4orld orrect 01.ro" your Breenfoot lessons, which of the followin# is not a ste! to creatin# a new subclass%
&ark for Review (1) 'oints
Ri#ht>click on a su!erclass. lick 9ew subclass... 9a"e the class. Select an i"a#e for the class. 'ro#ra" the class to "ove forward. (*) ncorrect. Refer to Section esson 1. 02. ro" your Breenfoot lessons, a scenario is a #a"e or si"ulation i"!le"ented in Breenfoot. $rue or false%
&ark for Review (1) 'oints
$rue (*) alse orrect 0. Kow would the followin# sentence be written in Breenfoot source code% f ukeJs le# is down, and the keyboard key +d+ is down...
&ark for Review (1) 'oints
if (LLisown M Breenfoot.isNeyown(+d+) ) if (Misown LL Breenfoot.isNeyown(+d+) ) if (isown LL Breenfoot.isNeyown(+d+) ) (*) if (MBreenfoot.isNeyown LL isown(+d+) ) orrect 00. ro" your Breenfoot lessons, what is a loo!%
&ark for Review (1) 'oints
A state"ent that e5ecutes one se#"ent of code. A state"ent that can e5ecute a section of code "ulti!le ti"es. (*) A state"ent that can e5ecute a section of code one ti"e. A state"ent that can e5ecute a "ethod "ulti!le ti"es. ncorrect. Refer to Section esson
0/. ro" your Breenfoot lessons, when do infinite loo!s occur%
&ark for Review (1) 'oints
4hen the loo! is e5ecuted. nly in while loo!s. 4hen the end to the code isnJt established. (*) 4hen the end to the act "ethod isnJt established. ncorrect. Refer to Section esson 17. Section (Answer all questions in this section) 0n the followin# Breenfoot array, what state"ent would you write to access :.the +a+ key% Neyna"es O C+a+, +b+, +c+, +d+DP
&ark for Review (1) 'oints
keyna"esQ2 keyna"esQ+a+ keyna"esQ7 (*) keyna"esQ+a+ key orrect 0ro" your Breenfoot lessons, which line of code is "issin# so"ethin#% 3.
&ark for Review (1) 'oints
1 (*) 0
/ : orrect 0n Breenfoot, the i"a#e below is an e5a"!le of what construct% ;.
&ark for Review (1) 'oints
ðod o""ent onstructor (*) lass ncorrect. Refer to Section esson 12. 0Ise your Breenfoot skills to answer the question. 4hat is incorrect in this =.code%
&ark for Review (1) 'oints
S!acin# "issin# urly brace "issin# 'arenthesis "issin# (*) o""a "issin# orrect
/ro" your Breenfoot lessons, which of the followin# are e5a"!les of 7.abstraction%
&ark for Review (1) 'oints
(hoose all correct answers) 'layin# a ran#e of sounds when keyboard keys are !ressed. (*) A sin#le instance dis!lays a sin#le i"a#e. Assi#nin# a different keyboard key to each instance. (*) 'ro#ra""in# a sin#le "ove"ent for a sin#le instance. Assi#nin# a different i"a#e file to each instance. (*) orrect