JAVA EXAM ANSWERS
1(a) Logical operators are symbols used to combine or modify boolean expressions. They help in
decision making.
1(b) AND (&&): true if both are true. OR (||): true if one is true. NOT (!): reverses result.
1(c) Example: if(age >=18 && hasID) { [Link]('Allowed'); }
2(a) Math constants are fixed values in Java Math class. They improve accuracy and save time.
2(b) [Link] = 3.14159, used for circles. Math.E = 2.718, used in exponential calculations.
2(c) Circumference = 2 * [Link] * radius
3(a) Scanner reads input: nextLine() for String, nextInt() for int, nextDouble() for decimal.
4(a) drawOval() draws circle outline, drawPolygon() draws triangle.
4(b) drawOval() outline only, fillOval() fills shape.
5 Applet methods: init(), start(), stop(), destroy().