Top Posters
Since Sunday
o
1
1
A free membership is required to access uploaded content. Login or Register.

Programming in Java.docx

Uploaded: 6 years ago
Contributor: bio_man
Category: Computer Science
Type: Other
Rating: N/A
Helpful
Unhelpful
Filename:   Programming in Java.docx (22.76 kB)
Page Count: 4
Credit Cost: 1
Views: 124
Last Download: N/A
Transcript
Programming in Java Multiple Choice Questions Methods can be added to objects to move objects to define behavior to rotate objects to turn objects Answer: b move and turn are examples of built-in methods custom methods functions to manipulate objects all of the above Answer: a A variable is a name that represents a value reference to the memory location that holds a value both a) and b) none of the above Answer: c Variable declaration defines only the name of the variable an address in the memory the type of data the variable can hold both a) and c) Answer: d Numeric data types include: integers only characters and strings integers and floating point type only floating point type Answer: c A variable of a Boolean data type can hold any numeric values characters a true or false value all of the above Answer: c A variable declared in a method is called global data local data formal data actual data Answer: b A mathematical expression is a combination of operands and operators values variables parameters Answer: a Expression allows you to change the object’s behavior speed up the programming process calculate new values dynamically from current values a) and c) Answer: d The purpose of the function random number is only to get a random number between 0 and 1 to make an object behave differently to stop the animation at a random time all of the above Answer: b The function random number accepts parameters that define a maximum generated number’s value specify how many numbers need to be generated specify the range of the random number generated define a minimum generated number’s value Answer: c A Boolean parameter in the random number function specifies how many numbers need to be generated what is the data type of a generated number how generated numbers will be used the range of numbers generated Answer: b A method’s parameter can be only of the numeric data type any data type except object any data type including object only character data type Answer: c The number of parameters that the method can contain is only one usually two or three not more than three as many as needed Answer: d The parameters of a method cannot be changed within the method cannot be a constant makes the method useful in many situations all of the above Answer: c True or False Questions The most efficient approach to building a program is to develop one method that controls the entire animation. Answer: False Methods can be developed to define additional behavior for objects. Answer: True Code can be better organized if the programmer defines an appropriate set of methods. Answer: True A variable is a value that changes. Answer: False A variable can be used anywhere in the program, even before the declaration. Answer: False A variable declared in a method can only be used in that method. Answer: True Expressions can be used for calculations and use the current values of variables. Answer: True The random number generation program can only produce numbers within the range 0 to 1. Answer: False Only one or two parameters can be accepted by a method. Answer: False Parameters can have only numeric values. Answer: False Short Answer Questions 1) _______ define behaviors for objects. Answer: Methods Multiple methods allow you to better control the entire _______. Answer: animation Methods can consist of several _____ to other methods. Answer: calls Each variable must have a _____ that is a reference to its memory location. Answer: name ________ and ______ _____ are two types of numeric data that a variable can hold. Answer: integer, floating point Object properties are managed using ________. Answer: variables Variables declared within the method are called _____ variables. Answer: local All variables used in the method must be ________. Answer: declared An expression is a combination of ________ and _________. Answer: operators, operands Current values of variables can be used in a __________ _________ to calculate the value of another variable Answer: mathematical expression Methods used for object manipulation are either _______ or _________. Answer: built-in, custom The random number function generates numbers within the ____ , and it is controlled by some parameters accepted by that function. Answer: range To make an object behave differently over time, the programmer needs to make some parameter _______. Answer: random Writing methods based on the parameters’ values passed to them makes them more _____. Answer: useful For every parameter added to a method, _____ and _____ need to be specified. Answer: name, type

Related Downloads
Explore
Post your homework questions and get free online help from our incredible volunteers
  884 People Browsing
 136 Signed Up Today
Your Opinion
Which of the following is the best resource to supplement your studies:
Votes: 292