PrepIQ Sun Certified Associate Java Platform Se Version 1 0 Ultimate Exam, Exams of Technology

An introductory Java SE exam focusing on basic programming constructs, data types, operators, encapsulation, classes/objects, simple exception handling, and Java development processes. Ideal for entry-level developers and students preparing for deeper Java certifications. Contains conceptual, code-interpretation, and beginner debugging questions.

Typology: Exams

2025/2026

Available from 06/29/2026

shilpi-jain-2
shilpi-jain-2 🇮🇳

1

(1)

25K documents

1 / 98

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PrepIQ Sun Certified Associate Java
Platform Se Version 1 0 Ultimate
Exam
**Question 1.** Which component of the Java platform is responsible for
converting `.java` source files into bytecode?
A) java interpreter
B) javac compiler
C) JVM class loader
D) JRE runtime
Answer: B
Explanation: The `javac` tool reads Java source files and produces `.class`
files containing bytecode that the JVM executes.
**Question 2.** In which of the following locations does the Java Virtual
Machine first look for a class when loading it?
A) The current working directory
B) The bootclasspath
C) The system classpath
D) The JAR file specified in the manifest
Answer: B
Explanation: The JVM’s bootstrap class loader searches the bootclasspath
(typically `rt.jar`) before delegating to other class loaders.
**Question 3.** Which of the following statements about the `main` method
is correct?
A) It must be declared as `public static void main(String args[])`
B) It can be overloaded with additional parameters
C) It may return an `int` value to the operating system
D) It must be placed inside an interface
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62

Partial preview of the text

Download PrepIQ Sun Certified Associate Java Platform Se Version 1 0 Ultimate Exam and more Exams Technology in PDF only on Docsity!

Platform Se Version 1 0 Ultimate

Exam

Question 1. Which component of the Java platform is responsible for converting .java source files into bytecode? A) java interpreter B) javac compiler C) JVM class loader D) JRE runtime Answer: B Explanation: The javac tool reads Java source files and produces .class files containing bytecode that the JVM executes. Question 2. In which of the following locations does the Java Virtual Machine first look for a class when loading it? A) The current working directory B) The bootclasspath C) The system classpath D) The JAR file specified in the manifest Answer: B Explanation: The JVM’s bootstrap class loader searches the bootclasspath (typically rt.jar) before delegating to other class loaders. Question 3. Which of the following statements about the main method is correct? A) It must be declared as public static void main(String args[]) B) It can be overloaded with additional parameters C) It may return an int value to the operating system D) It must be placed inside an interface

Platform Se Version 1 0 Ultimate

Exam

Answer: A Explanation: The entry point for a Java application is a public static void main(String[] args) method. Overloading is allowed but the JVM looks only for this exact signature. Question 4. Which of the following is not a primitive data type in Java? A) byte B) short C) String D) float Answer: C Explanation: String is a reference type, whereas the other options are primitive types. Question 5. What is the result of the expression byte b = 10; b = b + 5;? A) Compiles successfully, b becomes 15 B) Compilation error: possible loss of precision C) Runtime ArithmeticException D) b becomes 0 due to overflow Answer: B Explanation: b + 5 is promoted to int; assigning back to a byte requires an explicit cast. Question 6. Which literal correctly represents the long value 12345678901?

Platform Se Version 1 0 Ultimate

Exam

Question 9. Which keyword is used to prevent a class from being subclassed? A) static B) final C) abstract D) private Answer: B Explanation: Declaring a class as final forbids any other class from extending it. Question 10. Which of the following correctly demonstrates method overloading? A) void process(int a) {} and int process(int a) {} B) void compute(int a) {} and void compute(double a) {} C) void display() {} and static void display() {} D) void run() {} and void run(int a, int b) {} Answer: B Explanation: Overloading requires different parameter lists; return type alone (A) does not constitute overloading. Question 11. In Java, which of the following statements about the static keyword is false? A) A static method can be called without creating an instance. B) Static variables are shared among all instances of a class. C) A static method can directly access instance variables. D) Static blocks are executed when the class is loaded.

Platform Se Version 1 0 Ultimate

Exam

Answer: C Explanation: Static methods cannot reference instance variables because they belong to the class, not any particular object. Question 12. Which access modifier provides the widest visibility? A) private B) protected C) default (package-private) D) public Answer: D Explanation: public members are accessible from any other class, regardless of package. Question 13. Which statement correctly uses the super keyword? A) super = this; B) super(); inside a constructor to invoke the superclass constructor. C) super.method(); to call a static method of the superclass. D) super can be used to access private fields of the superclass. Answer: B Explanation: super(); must be the first statement in a subclass constructor to invoke the immediate superclass constructor. Question 14. Which of the following is not a valid switch expression type in Java SE 8? A) int B) String

Platform Se Version 1 0 Ultimate

Exam

C) do-while loop D) foreach loop Answer: C Explanation: The condition in a do-while loop is evaluated after the body, ensuring one execution. Question 17. Which of the following correctly creates a two-dimensional array of integers with 3 rows and 4 columns? A) int[][] matrix = new int[3][4]; B) int[3][4] matrix = new int[][]; C) int matrix = new int[3][4]; D) int[][] matrix = new int[4][3]; Answer: A Explanation: The syntax new int[rows][columns] allocates a rectangular 2 - D array. Question 18. What is the output of the following code snippet?

String s1 = "Java"; String s2 = new String("Java"); System.out.println(s1 == s2);

A) true B) false C) Compilation error

Platform Se Version 1 0 Ultimate

Exam

D) Runtime exception Answer: B Explanation: == compares object references. s1 refers to a string literal in the intern pool, while s2 refers to a distinct object created with new. Question 19. Which method of the String class returns a new string that is a substring from index 2 (inclusive) to index 5 (exclusive)? A) substring(2,5) B) subString(2,5) C) slice(2,5) D) sub(2,5) Answer: A Explanation: The correct method name is substring, with the specified start (inclusive) and end (exclusive) indices. Question 20. Which of the following statements about the StringBuilder class is true? A) StringBuilder objects are immutable. B) StringBuilder is synchronized. C) StringBuilder is preferred over StringBuffer when thread safety is not required. D) StringBuilder cannot be converted to a String. Answer: C Explanation: StringBuilder is mutable and not synchronized, making it faster than StringBuffer in single-threaded contexts. Question 21. What is the result of the expression 5 + 2 * 3 in Java?

Platform Se Version 1 0 Ultimate

Exam

Explanation: Autoboxing converts any primitive to its wrapper; unboxing a null wrapper triggers NullPointerException. Question 24. Which of the following is a checked exception? A) NullPointerException B) ArrayIndexOutOfBoundsException C) IOException D) IllegalArgumentException Answer: C Explanation: IOException is a subclass of Exception (not RuntimeException) and must be declared or caught. Question 25. Which statement correctly re-throws a caught exception preserving the original stack trace? A) throw e; inside the catch block B) throw new Exception(e); C) throw e.initCause(e); D) throw e.getCause(); Answer: A Explanation: Re-throwing the same exception object (throw e;) maintains its original stack trace. Question 26. Which keyword is used to declare an abstract method? A) abstract B) interface C) virtual

Platform Se Version 1 0 Ultimate

Exam

D) default Answer: A Explanation: The abstract modifier marks a method without a body, requiring subclasses to implement it. Question 27. What is the output of the following code?

int[] a = {1,2,3}; System.out.println(a.length);

A) 3 B) 4 C) 0 D) Compilation error Answer: A Explanation: The length field of an array returns the number of elements; here it is 3. Question 28. Which of the following statements about the final keyword when applied to a method is true? A) The method cannot be overridden in a subclass. B) The method must be static. C) The method cannot be called from outside its class. D) The method can only be called once. Answer: A

Platform Se Version 1 0 Ultimate

Exam

B) final static int MAX = 100; C) static final int MAX = 100; D) All of the above are correct. Answer: D Explanation: All three syntaxes are valid; order of static and final modifiers does not matter. Question 32. Which of the following statements about the instanceof operator is true? A) It can be used with primitive types. B) It returns true if the object is null. C) It checks whether an object is an instance of a specific class or interface. D) It can be overridden by user code. Answer: C Explanation: instanceof evaluates to false for null and works only with reference types. Question 33. Which of the following is the correct way to define a generic class that holds objects of type T? A) class Box { private T value; } B) class Box { private T value; public T get() { return value; } } C) Both A and B are correct. D) class Box { private Object value; } Answer: C Explanation: Both snippets correctly declare a generic class; option B adds a getter but still valid.

Platform Se Version 1 0 Ultimate

Exam

Question 34. What will be printed by the following code?

int x = 5; System.out.println(x++ + ++x);

A) 11 B) 12 C) 13 D) 14 Answer: C Explanation: x++ yields 5 (x becomes 6). ++x then increments to 7 and yields 7. Sum = 5 + 7 = 12? Wait compute: after first post-increment, x=6. Pre-increment makes it 7, value 7. 5+7=12. Actually answer should be 12. Let's recalc: initial x=5, expression evaluation left-to-right: x++ returns 5, x becomes 6. ++x increments to 7, returns 7. 5+7=12. So answer B. Answer: B Explanation: Post-increment returns the original value; pre-increment returns the incremented value. The sum is 12. Question 35. Which of the following statements about the transient keyword is correct? A) It prevents a field from being serialized. B) It makes a variable thread-local. C) It forces a field to be final. D) It allows a method to be overridden. Answer: A

Platform Se Version 1 0 Ultimate

Exam

D) Guarantees that the program will not terminate. Answer: A Explanation: Assertions can be enabled at runtime (-ea flag); if the condition evaluates to false, an AssertionError is thrown. Question 39. Which of the following statements about the java.util.Collections class is true? A) It provides only static methods for sorting lists. B) It can be instantiated to hold collection utilities. C) It contains a method unmodifiableList(List). D) It implements the List interface. Answer: C Explanation: Collections.unmodifiableList returns a read-only view of the specified list. Question 40. Which of the following is the correct way to read a line of text from the console using java.util.Scanner? A) Scanner sc = new Scanner(System.in); String line = sc.nextLine(); B) Scanner sc = new Scanner(System.in); String line = sc.readLine(); C) Scanner sc = new Scanner(); String line = sc.next(); D) Scanner sc = new Scanner(); String line = sc.read(); Answer: A Explanation: Scanner.nextLine() reads the remainder of the current line, including spaces. Question 41. Which of the following statements about the java.lang.Thread class is false?

Platform Se Version 1 0 Ultimate

Exam

A) The run() method is invoked automatically when start() is called. B) A thread can be put to sleep using Thread.sleep(milliseconds). C) The interrupt() method sets the thread’s interrupt status. D) Extending Thread is the only way to create a new thread. Answer: D Explanation: Implementing Runnable and passing it to a Thread object is another valid way to create a thread. Question 42. Which of the following statements correctly describes the volatile keyword? A) It guarantees atomicity of compound actions. B) It ensures that writes to the variable are immediately visible to other threads. C) It makes a variable immutable. D) It can be applied only to methods. Answer: B Explanation: volatile forces reads/writes to go directly to main memory, providing visibility but not atomicity. Question 43. Which of the following is the result of Math.pow(2, 3)? A) 6 B) 8 C) 9 D) 2.0 Answer: B Explanation: Math.pow returns a double representing 2 raised to the power of 3, which is 8.0; printed as 8.0 but the numeric value is 8.

Platform Se Version 1 0 Ultimate

Exam

Answer: C Explanation: An overriding method may throw the same, fewer, or more specific (subclass) checked exceptions. It cannot have a more restrictive access level, nor be static. Question 47. Which of the following statements about the java.util.HashMap class is true? A) It maintains insertion order. B) It allows at most one null key. C) It is thread-safe without external synchronization. D) Its size() method runs in O(log n) time. Answer: B Explanation: HashMap permits a single null key and multiple null values; it does not guarantee order or thread safety. Question 48. Which of the following statements correctly creates a List of strings using the Arrays.asList method? A) List list = Arrays.asList("a","b","c"); B) List list = new Arrays.asList("a","b","c"); C) List list = Arrays.asList(new String[]{"a","b","c"}); D) Both A and C are correct. Answer: D Explanation: Both syntaxes produce a fixed-size list backed by the provided array. Question 49. Which of the following is the correct way to declare a variable that can hold any subclass of Number?

Platform Se Version 1 0 Ultimate

Exam

A) Number n; B) Number n; C) Number n; D) Number n; Answer: C Explanation: ? extends Number denotes an unknown type that is a subclass of Number. Question 50. Which of the following statements about the java.lang.String method intern() is true? A) It creates a new String object each time it is called. B) It returns a reference to a canonical representation from the string pool. C) It removes the string from the pool. D) It can only be called on string literals. Answer: B Explanation: intern() ensures that identical strings share the same reference from the pool. Question 51. What is the result of the following code?

int a = 10; int b = ++a + a++; System.out.println(b);

A) 22