0% found this document useful (0 votes)
5 views8 pages

80 Advanced Java Viva Questions

The document contains 80 advanced Java viva questions along with their answers, covering various topics such as Applets, AWT, Swing, JDBC, RMI, Socket Programming, Servlets, JSP, Exception Handling, Multithreading, and GUI components. It provides concise definitions and differences between related concepts, making it a useful resource for Java learners and interview preparation. Key areas include event handling, database connectivity, and object-oriented programming principles.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views8 pages

80 Advanced Java Viva Questions

The document contains 80 advanced Java viva questions along with their answers, covering various topics such as Applets, AWT, Swing, JDBC, RMI, Socket Programming, Servlets, JSP, Exception Handling, Multithreading, and GUI components. It provides concise definitions and differences between related concepts, making it a useful resource for Java learners and interview preparation. Key areas include event handling, database connectivity, and object-oriented programming principles.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

80 Advanced Java Viva Questions with Answers

Q1. What is an Applet?

Answer: Applet is a small Java program that runs inside a browser or AppletViewer.

Q2. Difference between Applet and Application

Answer: Applet runs in browser while Application runs independently using JVM.

Q3. What is AWT?

Answer: AWT stands for Abstract Window Toolkit used for GUI programming.

Q4. Difference between AWT and Swing

Answer: AWT is heavyweight while Swing is lightweight and platform independent.

Q5. What is Swing?

Answer: Swing is a Java GUI toolkit with advanced components like JTable and JButton.

Q6. What is Event Handling?

Answer: Event handling manages user actions like mouse clicks and keyboard input.

Q7. What is ActionListener?

Answer: ActionListener handles action events like button clicks.

Q8. What is MouseListener?

Answer: MouseListener handles mouse events like clicks and movement.

Q9. What is KeyListener?

Answer: KeyListener handles keyboard events.

Q10. What is JDBC?

Answer: JDBC stands for Java Database Connectivity used to connect Java with databases.

Q11. What are JDBC steps?


Answer: Import package, load driver, create connection, execute query, close connection.

Q12. What is DriverManager?

Answer: DriverManager manages JDBC drivers and database connections.

Q13. What is Connection in JDBC?

Answer: Connection represents a session with database.

Q14. What is Statement?

Answer: Statement executes SQL queries.

Q15. What is PreparedStatement?

Answer: PreparedStatement is a precompiled SQL query.

Q16. Advantages of PreparedStatement

Answer: Faster execution and protection against SQL Injection.

Q17. What is ResultSet?

Answer: ResultSet stores records returned from SELECT query.

Q18. What is executeQuery()?

Answer: executeQuery() executes SELECT statement.

Q19. What is executeUpdate()?

Answer: executeUpdate() executes INSERT, UPDATE, DELETE queries.

Q20. What is SQL Injection?

Answer: SQL Injection is a database attack using malicious SQL input.

Q21. What is RMI?

Answer: RMI stands for Remote Method Invocation.

Q22. Components of RMI

Answer: Remote interface, remote object, registry, client, server.


Q23. What is rmiregistry?

Answer: rmiregistry is naming service in Java RMI.

Q24. What is Remote Interface?

Answer: Remote interface declares methods accessed remotely.

Q25. What is Socket Programming?

Answer: Socket Programming enables client-server communication.

Q26. What is ServerSocket?

Answer: ServerSocket waits for client requests.

Q27. What is Socket?

Answer: Socket represents endpoint for communication.

Q28. Difference between TCP and UDP

Answer: TCP is reliable while UDP is faster but unreliable.

Q29. Full form of TCP

Answer: Transmission Control Protocol.

Q30. Full form of UDP

Answer: User Datagram Protocol.

Q31. What is InetAddress?

Answer: InetAddress represents IP address.

Q32. What is URL?

Answer: URL stands for Uniform Resource Locator.

Q33. What is Servlet?

Answer: Servlet is Java program running on server.


Q34. Servlet life cycle

Answer: init(), service(), destroy().

Q35. What is GenericServlet?

Answer: GenericServlet is protocol-independent servlet.

Q36. What is HttpServlet?

Answer: HttpServlet handles HTTP requests.

Q37. Difference between GET and POST

Answer: GET sends data via URL while POST uses request body.

Q38. What is JSP?

Answer: JSP stands for Java Server Pages.

Q39. Advantages of JSP

Answer: Easy dynamic webpage creation.

Q40. What is implicit object in JSP?

Answer: Objects automatically available in JSP like request and response.

Q41. What is session tracking?

Answer: Session tracking maintains user state.

Q42. What is Cookie?

Answer: Cookie stores small client-side data.

Q43. What is Session?

Answer: Session stores server-side user data.

Q44. What is HashMap?

Answer: HashMap stores key-value pairs.

Q45. Difference between HashMap and Hashtable


Answer: Hashtable is synchronized while HashMap is not.

Q46. What is ArrayList?

Answer: ArrayList is dynamic array collection.

Q47. Difference between ArrayList and Vector

Answer: Vector is synchronized while ArrayList is faster.

Q48. What is Exception Handling?

Answer: Exception handling manages runtime errors.

Q49. What is try-catch block?

Answer: Used to handle exceptions.

Q50. What is finally block?

Answer: finally block always executes.

Q51. What is throw keyword?

Answer: throw explicitly throws exception.

Q52. What is throws keyword?

Answer: throws declares exception.

Q53. What is Multithreading?

Answer: Multithreading executes multiple threads simultaneously.

Q54. What is Thread class?

Answer: Thread class creates threads.

Q55. What is Runnable interface?

Answer: Runnable interface defines thread task.

Q56. Difference between process and thread


Answer: Thread is lightweight process.

Q57. What is synchronization?

Answer: Synchronization prevents data inconsistency.

Q58. What is deadlock?

Answer: Deadlock occurs when threads wait forever.

Q59. What is Layout Manager?

Answer: Layout Manager arranges GUI components.

Q60. What is FlowLayout?

Answer: FlowLayout arranges components left to right.

Q61. What is BorderLayout?

Answer: BorderLayout divides container into 5 regions.

Q62. What is GridLayout?

Answer: GridLayout arranges components in rows and columns.

Q63. What is CardLayout?

Answer: CardLayout switches between components.

Q64. What is JButton?

Answer: JButton is clickable Swing button.

Q65. What is JLabel?

Answer: JLabel displays text or images.

Q66. What is JTextField?

Answer: JTextField accepts single-line input.

Q67. What is JTextArea?

Answer: JTextArea accepts multi-line text.


Q68. What is JCheckBox?

Answer: JCheckBox allows selection.

Q69. What is JTable?

Answer: JTable displays tabular data.

Q70. What is JTree?

Answer: JTree displays hierarchical data.

Q71. What is paint() method?

Answer: paint() draws graphics.

Q72. What is Graphics class?

Answer: Graphics class is used for drawing.

Q73. What is serialization?

Answer: Serialization converts object to byte stream.

Q74. What is deserialization?

Answer: Deserialization converts byte stream to object.

Q75. What is File Handling?

Answer: File handling reads/writes files.

Q76. What is File class?

Answer: File class represents files/directories.

Q77. What is BufferedReader?

Answer: BufferedReader reads text efficiently.

Q78. What is PrintWriter?

Answer: PrintWriter writes formatted text.


Q79. What is package in Java?

Answer: Package groups related classes.

Q80. What is import statement?

Answer: import accesses package classes.

Q81. What is JVM?

Answer: JVM stands for Java Virtual Machine.

You might also like