Skip to content
CS-406 · Programming Practices/Important Questions

Programming Practices (CS-406) - Important Questions

  1. Unit 314 Marks High Priority

    Write a Java program demonstrating thread creation using both a Thread subclass and a Runnable implementation. Start multiple threads, use join to wait for their completion, and ensure synchronized access to a shared counter so that final count is correct. Explain the thread lifecycle and illustrate the state transitions observed during your program execution.

    Core practical and theory covering thread creation, join, synchronized access and lifecycle; frequently emphasized in past papers and practical exams.

  2. Unit 310 Marks High Priority

    Explain the Java thread lifecycle in detail. Describe each state (New, Runnable, Blocked/Waiting, Timed Waiting, Terminated), the events or API calls that cause transitions between states, and provide short code snippets that illustrate typical transitions.

    Fundamental theory question describing states and transitions; commonly asked in descriptive sections.

  3. Unit 310 Marks High Priority

    Discuss synchronization mechanisms in Java. Explain synchronized methods and synchronized blocks, the concept of intrinsic locks (monitor), and the ReentrantLock class. Define deadlock and list strategies to prevent or recover from deadlocks. Support your answer with concise code examples.

    Covers core synchronization primitives and deadlock — central topic for concurrency questions.

  4. Unit 310 Marks High Priority

    Explain inter-thread communication using wait(), notify(), and notifyAll(). Provide a producer-consumer example using a bounded buffer that employs wait/notify for coordination. Also discuss higher-level alternatives using java.util.concurrent classes (for example, BlockingQueue) and when they are preferred.

    Practical inter-thread coordination is a staple practical/theory hybrid question.

  5. Unit 37 Marks High Priority

    Describe the Java concurrency utilities related to task execution: Executor framework, ThreadPoolExecutor, Callable and Future, and ScheduledExecutorService. Write code to submit tasks to a fixed thread pool and retrieve results using Future.

    Modern concurrency utilities are frequently tested in applied questions and viva/practicals.

  6. Unit 314 Marks High Priority

    Write JDBC code to connect to a MySQL or Oracle database and perform Create, Read, Update and Delete (CRUD) operations using PreparedStatement. Demonstrate proper exception handling and resource management using try-with-resources, and explain why PreparedStatement is preferred over Statement for parameterized queries.

    Core JDBC practical covering end-to-end CRUD, resource management and use of PreparedStatement; high relevance to lab and exam questions.

  7. Unit 310 Marks High Priority

    Explain the JDBC architecture and the role of JDBC drivers. Compare DriverManager and DataSource approaches for obtaining connections. Describe Statement, PreparedStatement and CallableStatement and list their advantages and typical use-cases.

    Covers foundational JDBC architecture and contrasts between common APIs; regular theory question.

  8. Unit 310 Marks High Priority

    Discuss transaction management in JDBC: auto-commit mode, explicit commit and rollback, use of savepoints, and common transaction isolation levels. Provide JDBC code that demonstrates disabling auto-commit, executing multiple statements within a transaction, and rolling back on error.

    Transaction management is a high-value topic combining SQL and JDBC control; important for reliability and ACID understanding.

  9. Unit 37 Marks Medium Priority

    Describe ResultSet types and concurrency modes in JDBC: TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE and CONCUR_READ_ONLY, CONCUR_UPDATABLE. Explain how to perform batch updates and how to retrieve auto-generated keys after an INSERT.

    ResultSet capabilities and batch processing are practical topics often examined in short-answer or program-writing questions.

  10. Unit 37 Marks Medium Priority

    Explain the purpose of connection pooling and how it improves database application performance. Demonstrate, at a high level, how to configure and use a DataSource-based connection pool (for example, HikariCP or Apache DBCP) in a Java application.

    Connection pooling is a practical optimization topic relevant to scalable database access and integration tasks.

Go to where you left off?

Quick Add to Notes

Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.

Create free account

Have an account? Log in