Professional Documents
Culture Documents
Third Quarter Exam Computer Programming Java
Third Quarter Exam Computer Programming Java
Department of Education
Tarlac City Schools Division
TIBAG HIGH SCHOOL
(Formerly Maliwalo National High School-Annex)
Tibag, Tarlac City
(SY:2018-2019)
________________
Parent’s Signature
Name:__________________ Date:______________
Section:_________________ Score:_____________
____3.With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?
1. x++;
2. x = x + 1;
3. x += 1;
4. x =+ 1;
A. 1, 2 & 3 B. 1 & 4 C. 1, 2, 3 & 4 D. 3 & 2
____13. An expression involving byte, int, and literal numbers is promoted to which of these?
A. int B. long C. byte D. float
____14. Which data type value is returned by all transcendental math functions?
A. int B. float C. double D. long
____16. Which of these coding types is used for data type characters in Java?
A. ASCII B. ISO-LATIN-1 C. UNICODE D. None of the mentioned
____26. To prevent any method from overriding, we declare the method as,
A. static B. const C. final D. abstract
____34. What is the type and value of the following expression? (Notice the integer division)
-4 + 1/2 + 2*-3 + 5.0
A. int -5 B. double -4.5 C. int -4 D. double -5.0
____37. Which of the following variable declaration would NOT compile in a java program?
A. int var; B. int VAR; C. int var1; D. int 1_var;.
____40. A constructor
A. Must have the same name as the class it is declared within.
B. Is used to create objects.
C. May be declared private
D. A., B. and C. above.
____41. Consider,
public class MyClass
{
public MyClass(){/code/}
// more code…
}
To instantiate MyClass, you would write?
A. MyClass mc = new MyClass(); B. MyClass mc = MyClass();
C. MyClass mc = MyClass; D. MyClass mc = new MyClass;.
___45. The java run time system automatically calls this method while garbage collection.
A. finalizer() B. finalize() C. finally() D. finalized()
Prepared by:
Noted: