CSCI 120 Written Final!!!!
Relationship between methods in java to methods and functions in Alice
Accessor method - Alice function. Mutator method - Alice Method
What is the return type of a constructor?
Constructors do not have a return type! (NOT NULL!)
Except for the begin() method, every other event handler within WindowController accepts a parameter. What is the type of the parameter?
Location
Overloaded
Refers to two methods with the same name, but different formal parameter lists
if you define a class named SportsCar, what must be the name of the constructor?
SportsCar
If the condition of a while loop is always false:
The body of the loop will never execute
T/F Canvas is defined for us by the WindowController
True
The condition of an if statement can be:
a Boolean variable, a Boolean function call (that is, a method that returns a boolean), or a boolean expression
the construct "doTogether" is
a control statement
instance method
a method inside an object that operates on an object
formal parameter
a variable declaration in a method's definition that allows the method to accept values from the caller
instance variable
a variable inside an object that makes up part of its internal state
final
a variable modifier that indicates that the variable cannot be changed
Return statements must appear in
accessor methods
Methods:
allow you to hide complex details with abstraction, allow you to use divide and conquer methodology to break a large problem into smaller pieces, are a way to give name to a block of code
this
an implicit variable that refers to the object that is currently executing a method
relationship between classes and objects
and object is an instance of a class
a property variable provides you a place to store an object ______
attribute
A _______ variable can serve as a condition in an if or while statement
boolean
what is the return type of the contains method defined for shapes in the ObjectDraw library?
boolean
3+4 < 3*8 is a
boolean expression
myRect.contains(myPoint) is a
boolean expression
the condition of a while loop must be a:
boolean expression
correct way to access the width of the canvas
canvas.getWidth()
When defining one of the mouse event handlers, we can:
choose whatever name we like for the parameter variable
the items in the Alice gallery are
classes
constructor
code that is executed when an object is created
in programming, combining two strings a and b into a single string ab is called _________
concatenating
Program decision-making depends on
conditions
what is an equivalent statement to count++;
count = count +1;
T/F Objects drawn later in your program's execution will appear behind objects drawn earlier in the program
false
T/F When the flow of control reaches an if statement, it is possible that both the if part and the else part will be executed
false
T/F a method name should usually be a noun or noun phrase
false
T/F an Alice method produces a value
false
If you forget to update the condition inside the body of a counting loop:
infinite loop
to use the object draw library in a program, include a line before the class definition:
inport object draw.*;
property variable
long term storage of a value related to an object
a ______ is an invisible location in your world that has a position and an orientation
marker
a local variable lets you store a value within a(n) ______ for later use
method
in a user story, the verbs correspond to
methods
return statements:
must match the return type of the method, send a value back to the caller of the method, stop the execution of a method immediately, can include a complex expression of method invocation, can appear in a method with void return type as long as no expression follows the keyword return
A loop inside a loop is said to be
nested
Two methods with the same name and formal parameter lists, but different return values are:
not allowed
3+4 / 2 *8 is a
numeric expression
myRect.getWidth() is a
numeric expression
in a user story, the nouns correspond to
objects
A _______ is a variable that stores an argument
parameter
When writing a class that will create visible objects, we can access the canvas by
passing a DrawingCanvas into the Constructor as a parameter
to define a constant:
private final static int MY_NUMBER;
the value the function produces is whatever appears in the function's ___________
return statement
in Alice, methods stored in the scene are called _____ methods
scene
You can use De Morgan's laws to
simplify boolean expressions
assume your program has correctly created a FramedRect named square. The correct expansion to determine if a point is within the square is
square.contains(point)
a method-message can only resent from a place where a(n) _______ can appear
statement
"hello" + "world" is a
string expression
method (local) variable
temporary storage for a value only within a single method call
If the condition of a while loop is always true:
the loop will repeat forever (infinite loop)
encapsulation
the process of enclosing programming elements inside larger, more abstract entities
computer science is most accurately described as
the processing of info by algorithms
T/F Literals, variable names, constructions, and invocations of accessor methods can all be used as expressions
true
T/F functions can have parameters to store arguments passed by the sender of the message
true
T/F you may define a function in Alice
true
parameter
used to pass a value into a method
a function-message must be sent from a place where a(n) _____ can appear
value
a(n) __________ is a name that refers to a piece of the program's memory, in which a value can be stored, retrieved, and changed
variable
mutator methods usually have this return type
void