iGET

Java Programming - MCQ Practice Questions

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

958 questions | 100% Free

Q.121Hard

For encrypting data while writing to a file, which approach is most appropriate?

Q.122Hard

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

Q.123Hard

Which serialization approach maintains backward compatibility better?

Q.124Hard

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

Q.125Hard

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

Q.126Hard

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

Q.127Hard

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

Q.128Hard

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

Q.129Hard

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

Q.130Hard

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.131Hard

What is the primary advantage of PushbackInputStream?

Q.132Hard

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.133Hard

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

Q.134Hard

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

Q.135Hard

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

Q.136Hard

Which JDBC feature allows you to call stored procedures?

Q.137Hard

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

Q.138Hard

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

Q.139Hard

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

Q.140Hard

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