iGET

Java Programming - MCQ Practice Questions

Practice free Java Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

951 questions | 100% Free

Q.121Hard

In Java NIO, what is a key advantage of FileChannel over traditional I/O streams?

Q.122Hard

Which serialization approach maintains backward compatibility better?

Q.123Hard

For developing a high-performance file copying utility handling files up to 10GB, which approach is optimal?

Q.124Hard

Given the code: PrintWriter pw = new PrintWriter(new FileWriter("file.txt")); What issue might occur?

Q.125Hard

Which approach would you use to read and write objects to a file efficiently in a production application?

Q.126Hard

In a log aggregation system, what is the primary advantage of using RandomAccessFile over sequential streams?

Q.127Hard

What is the main advantage of using RandomAccessFile over sequential streams?

Q.128Hard

When deserializing an object, which methods are called in order?

Q.129Hard

Consider a scenario where you need to read a large binary file efficiently without loading it entirely into memory. Which approach combines best practices?

Q.130Hard

What is the primary advantage of PushbackInputStream?

Q.131Hard

In a multi-threaded application, multiple threads are writing to the same file simultaneously using FileOutputStream. What is the primary issue and best solution?

Q.132Hard

Consider code: String query = "SELECT * FROM users WHERE id=" + userId; stmt.executeQuery(query); What security issue exists?

Q.133Hard

How would you implement batch processing in JDBC for multiple INSERT operations?

Q.134Hard

What is the difference between execute(), executeQuery(), and executeUpdate()?

Q.135Hard

Which JDBC feature allows you to call stored procedures?

Q.136Hard

In JDBC, what does the ResultSet.TYPE_SCROLL_INSENSITIVE constant represent?

Q.137Hard

What is the difference between update() and updateRow() methods in ResultSet?

Q.138Hard

A developer wants to prevent SQL injection attacks while executing dynamic queries. Which approach is most secure?

Q.139Hard

What is the default transaction isolation level in JDBC when autocommit is disabled?

Q.140Hard

Which method is used to check if a CallableStatement has a return value from a stored procedure?