Q#1: What is the main purpose of serialization in Java?
(A) To delete an object
(B) To send an object to a stream
(C) To convert object into class
(D) To remove data from memory
Answer: (B) To send an object to a stream
Q#2: Which collection class works like a resizable array in Java?
(A) Vector
(B) Array
(C) ArrayList
(D) Stack
Answer: (C) ArrayList
Q#3: Which syntax is used to load the Oracle JDBC driver?
(A) Class.load(“oracle.jdbc.driver”)
(B) Class.forName(“oracle.jdbc.driver.OracleDriver”)
(C) Driver.loadOracle()
(D) DriverManager.load()
Answer: (B) Class.forName(“oracle.jdbc.driver.OracleDriver”)
Q#4: In ResultSet, what is the index number of the first row?
(A) 0
(B) 1
(C) 2
(D) -1
Answer: (B) 1
Q#5: Which method of ResultSet moves the cursor to the next row?
(A) move()
(B) next()
(C) forward()
(D) step()
Answer: (B) next()
Q#6: What is the advantage of a collection over an array?
(A) Faster execution
(B) No need to know the size beforehand
(C) Uses less memory
(D) Works only with objects
Answer: (B) No need to know the size beforehand
Q#7: Which method of ResultSetMetaData returns the suggested column label?
(A) getColumnName()
(B) getColumnLabel()
(C) getColumnType()
(D) getColumnCount()
Answer: (B) getColumnLabel()
Q#8: If a method is declared as protected, where can it be accessed?
(A) Only within the same class
(B) Only outside the class
(C) Within the class and its subclasses
(D) Only in main method
Answer: (C) Within the class and its subclasses
Q#9: How many methods are present in the WindowListener interface?
(A) 3
(B) 5
(C) 7
(D) 10
Answer: (C) 7
Q#10: Iterator in Java is a:
(A) Class
(B) Interface
(C) Method
(D) Package
Answer: (B) Interface
Q#11: Which method is used to execute SELECT SQL queries?
(A) executeUpdate()
(B) executeQuery()
(C) executeSelect()
(D) executeSQL()
Answer: (B) executeQuery()
Q#12: Which method is used to execute INSERT, UPDATE, or DELETE SQL statements?
(A) executeQuery()
(B) executeUpdate()
(C) executeSQL()
(D) executeInsert()
Answer: (B) executeUpdate()
Q#13: What does serialization convert an object into?
(A) Character stream
(B) Byte stream
(C) Integer stream
(D) Data packet
Answer: (B) Byte stream
Q#14: Which keyword is used to prevent a field from being serialized?
(A) static
(B) final
(C) transient
(D) private
Answer: (C) transient
Q#15: Which JDBC driver type is known as JDBC-ODBC Bridge?
(A) Type 1
(B) Type 2
(C) Type 3
(D) Type 4
Answer: (A) Type 1
Q#16: Which class hierarchy is character-oriented in Java streams?
(A) InputStream / OutputStream
(B) Reader / Writer
(C) DataStream
(D) FileStream
Answer: (B) Reader / Writer
Q#17: Which class hierarchy is byte-oriented in Java streams?
(A) Reader / Writer
(B) InputStream / OutputStream
(C) BufferReader
(D) PrintWriter
Answer: (B) InputStream / OutputStream
Q#18: What is a port in networking?
(A) Physical device
(B) Transport address for connection requests
(C) Type of protocol
(D) Network cable
Answer: (B) Transport address for connection requests
Q#19: Which class supports painting in Java GUI?
(A) Canvas
(B) Frame
(C) Panel
(D) All of these
Answer: (D) All of these
Q#20: Which statement about abstract classes is correct?
(A) They can be instantiated directly
(B) They cannot contain methods
(C) They cannot be instantiated
(D) They cannot contain variables
Answer: (C) They cannot be instantiated