Programming Practices (CS-406) - Important Questions
-
Unit 210 Marks High Priority
Describe the Java Collections Framework and compare ArrayList, LinkedList and HashMap. For each, explain internal implementation, typical use-cases, and time complexity of common operations (add, get, remove, search).
Core derivation from Unit 2; frequently asked comparison of fundamental collection classes.
-
Unit 27 Marks High Priority
Explain the differences between the List, Set and Map interfaces in Java Collections. Give one real-world example where each interface is the appropriate choice and show short code snippets demonstrating basic usage.
Core interface-level distinctions in Unit 2; tests conceptual understanding and examples.
-
Unit 210 Marks High Priority
Write a Java program to sort a list of custom objects using Collections.sort. Implement both Comparable and a separate Comparator. Explain when to use each approach and state the time complexity of the sort operation.
Practical programming task reflecting common exam pattern: algorithm + code + complexity.
-
Unit 27 Marks High Priority
Explain fail-fast and fail-safe iterators in the Java Collections Framework. Illustrate with examples how ConcurrentModificationException can occur and demonstrate two ways to avoid it.
Important reliability/concurrency topic in Collections; often asked to explain behavior and remedies.
-
Unit 210 Marks High Priority
Discuss generics in Java. Explain generic classes and generic methods with examples. Describe bounded type parameters and list the advantages of using generics over raw types.
Fundamental generics concepts from Unit 2; high-value theoretical question.
-
Unit 27 Marks High Priority
Explain type erasure in Java generics. Provide examples that show limitations caused by type erasure (for example, creating generic arrays, instanceof checks) and explain the runtime consequences.
Key conceptual topic about generics runtime behavior; directly tests understanding of type erasure consequences.
-
Unit 210 Marks High Priority
Write a generic Stack<T> class in Java with methods push, pop and peek. Demonstrate its usage with Integer and String types and discuss time complexity of each operation.
Standard implementation question combining generics and data structure implementation skills.
-
Unit 27 Marks High Priority
Explain Java generics wildcards: <?>, <? extends T> and <? super T>. Give code examples for each and explain the PECS (Producer Extends, Consumer Super) guideline.
Wildcard usage is repeatedly examined; PECS and examples are central to Unit 2 generics questions.
-
Unit 210 Marks High Priority
Implement a singly linked list in Java with methods to insert at head, insert at tail, delete a node (by value), and search for a value. Explain the time complexity of each operation.
Core data structure implementation frequently asked; assesses coding and complexity analysis.
-
Unit 210 Marks High Priority
Implement Stack and Queue data structures in Java using (a) arrays and (b) linked lists. For each implementation, provide push/enqueue and pop/dequeue methods and compare advantages, disadvantages and time/space complexity.
Comparative implementation question covering stacks and queues using both arrays and linked lists; common practical exam question.
-
Unit 210 Marks High Priority
Explain binary tree traversal algorithms: inorder, preorder and postorder. Provide both recursive and iterative implementations for each traversal and analyze their time and space complexity.
Classical trees question assessing traversal algorithms and implementations; frequently appears in Unit 2.
-
Unit 214 Marks High Priority
Describe how Java's HashMap works internally. Explain hashing, bucket array, collision resolution, chaining, rehashing/resizing and how load factor affects performance. Contrast HashMap with Hashtable in terms of behavior and synchronization.
Deep internals question on hash-based collections; high-value and frequently asked in exams.
Quick Add to Notes
Save questions, your own notes and screenshots into notes filed by unit. It takes a free account.
Create free accountHave an account? Log in
Notes Panel