CIS 0083 - 2 Quiz #2
Name: / SSN (last 4 digits only):
Question 1: 2 points
Fill in the words TRUE, FALSE, BREAK, DO, WHILE:
Question 2: 3 points
Replace the following FOR loop by a WHILE loop:
For (int i=5; i>0; i--){
System.out.println(i+””);
if (i==3) break;
}
Question 3: 1 point
What’s the difference between a class and an object ?
· No difference, different name for the same thing
· Class defines the data type, objects hold the data
· Class holds the data, Object defines the type
Question 4: 2 points
The parameter ‘this’ is …
· …not needed. It is defined for reasons of compatibility with C++
· …optional. It can be used to pass the reference of an object calling the method of another one, but if not given it is implicitely defined by JAVA itself.
· … needed if the reference of an object calling a method of another one must be passed
Question 5: 1 point
In the JAVA naming standard for methods, a good name for a method that computes a robot’s position would be:
· CRP
· lookWhereTheRobotIsAndAfterYouDidThatReturnItsPositionAsAnInteger
· computeRobotPosition
· ComputeRobotPosition
Question 6: 1 point
Information Hiding
· Is used in databases to handle data of privacy with necessary care
· Is a collection of JAVA packages related to software used by military intelligence
· Is a technique to encapsulate objects to hide the implementation specifics