Midwkey - AP Computer Science Midterm Name _ Answer the...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
AP Computer Science Midterm Name _______________________________ Answer the following questions by bubbling in A (True) or B (False) on the scantron sheet. 1. In Java, some methods may be defined outside of all classes. 2. A class’ constructor can call that class’s methods. 3. You must construct at least one instance of a class to use the class’s static methods. 4. Constructors never return any values. 5. Literal strings are objects of the String type. 6. If the return type of a method is a class, the method returns a reference to an object of that class. 7. A void method must have at least one return . 8. The order of a method’s arguments is important only when they have the same type. 9. Only static fields can be declared “final.” 10. A field in a class may be public or private, but usually all fields are declared private. 11. A local variable may be initialized in one method or constructor and used in another method. 12. A Boolean variable can only have values true or false. 13. Declarations of fields must be placed at the top of the class, before all the constructors and methods. 14. When an (int) cast is applied to a double value, it rounds the value to the nearest integer. 15. Logical operators apply only to Boolean variables or expressions. 16. Given int n = 2, b = 3; double x = 2.5, y; what is the result from the following statement? y = (x * n + b / n) / 2; A. y = 2.0 B. y = 3.0 C. y = 3.25 D. Error message E. None of the above 17. Which of the following features indicates that a method is recursive? A. It includes at least one for statement B. It isolates the case when its parameter is equal to 1 and deals with it separately C. It decreases the value of its parameter within a loop D. It calls itself
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
18. What is called “garbage collection”? A. Removing .class files after their source code has been removed or modified B. Removing objects that are no longer used in the program and releasing their memory C. Removing debugging information from .class files D. Removing all remaining events from the program’s queue when the program finishes
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

Midwkey - AP Computer Science Midterm Name _ Answer the...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online