Showing posts with label Languages. Show all posts
Showing posts with label Languages. Show all posts

18 January 2026

#PySpark


Key Concepts


S.No Topic Sub-topic
1 PySpark Fundamentals Spark architecture, Driver, Executors, Cluster Manager, Application, Job, Stage, Task
2 Spark Execution Model DAG, lineage, transformations, actions, lazy evaluation, narrow transformation, wide transformation
3 PySpark Environment SparkSession, SparkContext, configuration, local mode, cluster mode, spark-submit
4 DataFrames DataFrame creation, schema, columns, rows, select, alias, literals, expressions
5 Data Types & Schema StructType, StructField, primitive types, ArrayType, MapType, StructType, schema evolution
6 Data Reading CSV, JSON, Parquet, ORC, JDBC, partitioned files, compression
7 Data Writing Write modes, partitionBy, bucketing, overwrite, append, dynamic partition overwrite, file sizing
8 Column Operations withColumn, drop, cast, when/otherwise, regexp, string functions, date functions
9 Filtering & Sorting filter, where, orderBy, sort, isin, between, null handling, complex conditions
10 Aggregations groupBy, agg, count, sum, avg, min, max, countDistinct, rollup, cube
11 Joins Inner, left, right, full, cross, semi, anti joins, join conditions, duplicate columns
12 Window Functions WindowSpec, partitionBy, orderBy, row_number, rank, dense_rank, lag, lead
13 Spark SQL Temporary views, global views, SQL expressions, CTEs, SQL vs DataFrame API
14 Advanced DataFrame Operations Union, unionByName, explode, posexplode, pivot, unpivot, arrays, maps, structs
15 Null & Data Quality NULL handling, fillna, dropna, replace, duplicate handling, validation, bad records
16 RDD RDD creation, map, flatMap, filter, reduce, aggregate, pair RDDs, RDD vs DataFrame
17 UDF Python UDF, pandas UDF, built-in functions, UDF overhead, vectorization, UDF alternatives
18 Performance Fundamentals Caching, persistence, storage levels, lazy evaluation, partitioning, parallelism
19 Partitioning & Shuffle repartition, coalesce, shuffle partitions, partition size, shuffle optimization
20 Join Optimization Broadcast join, shuffle hash join, sort merge join, join hints, broadcast threshold
21 Spark Optimization Catalyst Optimizer, Tungsten, predicate pushdown, projection pruning, whole-stage code generation
22 Explain Plan & Debugging explain, logical plan, physical plan, Spark UI, stages, tasks, SQL tab, executor metrics
23 Data Skew Skew detection, hot keys, salting, broadcast strategy, AQE skew join, partition balancing
24 Adaptive Query Execution AQE, dynamic coalescing, skew join optimization, dynamic partition pruning, runtime optimization
25 Memory Management Executor memory, driver memory, overhead memory, garbage collection, serialization, executor sizing
26 Structured Streaming Streaming DataFrame, readStream, writeStream, triggers, checkpoints, output modes
27 Streaming Sources & Sinks Kafka, files, console, memory, foreachBatch, exactly-once concepts, checkpointing
28 Delta Lake ACID, MERGE, time travel, schema evolution, optimization, partitioning
29 Apache Iceberg Tables, catalogs, snapshots, partition evolution, schema evolution, time travel
30 Production PySpark Logging, configuration, testing, error handling, monitoring, deployment, CI/CD, security

Interview question

What is PySpark and how is it different from Apache Spark?
Why is PySpark used for large-scale data processing?
What are the main components of PySpark?
What is SparkSession in PySpark?
What is SparkContext and how is it different from SparkSession?
What is the difference between SparkSession, SparkContext, and SQLContext?
What is a Spark application in PySpark?
What is a driver program in PySpark?
What are executors in PySpark?
What is a cluster manager in Spark?
What are the different cluster deployment modes in Spark?
What is the difference between client mode and cluster mode?
What is an RDD in PySpark?
What are the main characteristics of an RDD?
What is the difference between RDD and DataFrame?
What is the difference between DataFrame and Dataset?
Why are DataFrames preferred over RDDs in most PySpark applications?
What is lazy evaluation in PySpark?
What are transformations and actions in PySpark?
What is the difference between narrow and wide transformations?
What is a shuffle operation in PySpark?
Which PySpark operations cause a shuffle?
What is the difference between map(), flatMap(), and mapPartitions()?
What is the difference between map() and filter()?
What is reduceByKey() in PySpark?
What is the difference between reduceByKey() and groupByKey()?
What is aggregateByKey() and when should you use it?
What is combineByKey() in PySpark?
What is the difference between sortByKey() and sortBy()?
What is a Pair RDD in PySpark?
What is partitioning in PySpark?
What is a partition?
How does PySpark determine the number of partitions?
What is repartition()?
What is coalesce()?
What is the difference between repartition() and coalesce()?
What is data skew in PySpark?
How do you identify data skew in PySpark?
How do you handle data skew in PySpark?
What is a DataFrame in PySpark?
How do you create a DataFrame in PySpark?
How do you define a schema in PySpark?
What is the difference between inferSchema and explicitly defining a schema?
What are StructType and StructField in PySpark?
What are the commonly used PySpark data types?
How do you inspect the schema of a DataFrame?
What is the difference between show(), display(), and collect()?
What is the difference between count(), collect(), and take()?
How do you select columns from a PySpark DataFrame?
What is the difference between select() and selectExpr()?
How do you rename columns in PySpark?
How do you add a new column using withColumn()?
What is the difference between withColumn() and withColumns()?
How do you drop a column from a DataFrame?
How do you filter rows in PySpark?
What is the difference between filter() and where()?
How do you remove duplicate records in PySpark?
What is the difference between distinct() and dropDuplicates()?
How do you sort a DataFrame in PySpark?
What is the difference between orderBy() and sort()?
How do you handle null values in PySpark?
What is the difference between isNull() and isNotNull()?
How do you replace null values using fillna()?
How do you replace values using replace()?
What is groupBy() in PySpark?
What are aggregate functions in PySpark?
How do you calculate sum, average, minimum, and maximum in PySpark?
What is the difference between groupBy().agg() and groupBy().sum()?
How do you perform joins in PySpark?
What are the different types of joins supported by PySpark?
What is the difference between inner join and left join?
What is a broadcast join in PySpark?
When should you use a broadcast join?
What is the difference between broadcast join and shuffle join?
What is a cross join and why can it be expensive?
How do you join two DataFrames with different column names?
How do you handle duplicate columns after a join?
What are window functions in PySpark?
What is Window.partitionBy()?
What is Window.orderBy()?
What is the difference between row_number(), rank(), and dense_rank()?
How do you find the top N records per group using window functions?
How do you calculate running totals using PySpark window functions?
How do you calculate lag and lead values in PySpark?
What are PySpark SQL functions?
What is the difference between built-in functions and UDFs?
What is a PySpark UDF?
Why should UDFs generally be avoided when built-in functions are available?
What is a Pandas UDF in PySpark?
What is the difference between a regular Python UDF and a Pandas UDF?
What is vectorized execution in PySpark?
How do you read CSV, JSON, and Parquet files using PySpark?
Why is Parquet preferred for analytical workloads in PySpark?
What is partition pruning in PySpark?
What is predicate pushdown?
What is column pruning?
What is caching in PySpark?
What is the difference between cache() and persist()?
What are the different storage levels in PySpark?
When should you cache a DataFrame?
What is checkpointing in PySpark?
What is the difference between caching and checkpointing?
What is Spark Catalyst Optimizer?
What is Tungsten in Apache Spark?
What is Adaptive Query Execution (AQE) in Spark?
How does AQE improve PySpark query performance?
How do you optimize a slow PySpark job?
How do you monitor and troubleshoot a PySpark application?
What is the Spark UI and how is it used for performance debugging?
What are stages, tasks, and jobs in Spark?
How do you identify a bottleneck in a PySpark job?
How do you reduce shuffle operations in PySpark?
What are common causes of out-of-memory errors in PySpark?
How do you handle executor memory issues in PySpark?
How do you optimize PySpark code for production workloads?
What are common PySpark performance optimization techniques used in real-world projects?

Related Topics


12 January 2026

#MultiThread

#MultiThread

Key Concepts


S.No Topic Sub-Topics
1MultithreadingWhat is Thread, Process vs Thread, Benefits of Multithreading, Applications, Thread Lifecycle Overview
2Thread ClassCreating Thread by extending Thread, start(), run(), sleep(), join(), getName()
3Runnable InterfaceImplementing Runnable, Passing to Thread, Advantages, run() vs start(), Lambda Runnable
4Thread LifecycleNew, Runnable, Running, Waiting, Timed Waiting, Terminated, Thread State Transitions
5Thread MethodssetName/getName, setPriority/getPriority, isAlive(), yield(), interrupt()
6Thread PriorityMin/Max/Normal Priority, setPriority, Thread Scheduling, Preemption, Fairness
7Thread Sleep & Joinsleep(), join(), wait vs sleep, timed join, practical examples
8Thread Communicationwait(), notify(), notifyAll(), producer-consumer basics, synchronized block
9Synchronized MethodsMethod-level sync, block-level sync, object lock, class-level lock, best practices
10Inter-thread CommunicationProducer-Consumer Problem, BlockingQueue, wait/notify, ReentrantLock with Condition, deadlock prevention
11Reentrant LocksLock interface, ReentrantLock, tryLock(), lockInterruptibly(), fairness, conditions
12DeadlockWhat is Deadlock, Conditions, Prevention, Avoidance, Detection, Recovery
13Starvation & LivelockStarvation, Livelock, Examples, Priority Inversion, Solutions
14Thread SafetyDefinition, Thread-safe classes, Immutable Objects, Synchronization, Atomic variables
15Atomic ClassesAtomicInteger, AtomicLong, AtomicReference, compareAndSet, use cases
16Volatile KeywordWhat is volatile, visibility, happens-before, example usage, memory consistency
17Concurrent CollectionsConcurrentHashMap, CopyOnWriteArrayList, BlockingQueue, ConcurrentSkipListMap, benefits
18Executor FrameworkExecutor, ExecutorService, ThreadPoolExecutor, ScheduledExecutorService, shutdown
19Thread PoolsFixedPool, CachedPool, SingleThreadPool, ScheduledPool, Advantages
20Callable & FutureCallable Interface, Future, submit(), get(), timeout handling, cancelling tasks
21ForkJoin FrameworkForkJoinPool, RecursiveTask, RecursiveAction, work-stealing, parallel computation
22Parallel StreamsStream API, parallel(), ForkJoin usage, performance tips, pitfalls
23ThreadLocalThreadLocal variables, usage, memory leak, InheritableThreadLocal, examples
24Synchronization UtilitiesCountDownLatch, CyclicBarrier, Semaphore, Phaser, Exchanger
25Deadlock Prevention PatternsLock Ordering, TryLock, Timeout, Avoid Nested Locks, Resource hierarchy
26Best PracticesMinimize synchronized code, prefer high-level concurrency, immutable objects, use executor, avoid busy wait
27Performance TuningThread pool sizing, contention reduction, CPU-bound vs IO-bound, measuring, profiling
28Common Concurrency BugsRace conditions, deadlocks, livelocks, visibility issues, fixes
29Real-world ExamplesProducer-Consumer app, Web server handling requests, parallel processing, async tasks, thread-safe cache
30Interview & RevisionKey methods, concurrency concepts, common pitfalls, multithreading Q&A, mini projects

Interview question

Basic Level

  • What is a Thread?
  • What is Multithreading?
  • What is the difference between Process and Thread?
  • What are the advantages of Multithreading?
  • What is Context Switching?
  • What is Thread Lifecycle?
  • What are the different Thread States?
  • How do you create a Thread in Java?
  • What is the Runnable interface?
  • What is the difference between Thread and Runnable?
  • What is the start() method?
  • What is the run() method?
  • Why should we not directly call run()?
  • What is Thread Priority?
  • What is Daemon Thread?
  • How do you create a Daemon Thread?
  • What is the purpose of the join() method?
  • What is the sleep() method used for?
  • What is thread scheduling?
  • What is time slicing?
  • What is thread safety?
  • What is synchronization?
  • What is a synchronized method?
  • What is a synchronized block?
  • What is the volatile keyword?

Intermediate Level

  • What is Inter-thread communication?
  • What are wait(), notify(), notifyAll() used for?
  • Why must wait/notify be called inside synchronized block?
  • What is a race condition?
  • What is deadlock?
  • How do you avoid deadlock?
  • What is livelock?
  • What is starvation?
  • What is a monitor in Java?
  • What is reentrant synchronization?
  • What is a ThreadGroup?
  • What is ThreadLocal?
  • What is the Executor framework?
  • What is ExecutorService?
  • What is a ThreadPool?
  • What is Callable?
  • What is Future?
  • What is FutureTask?
  • What is ScheduledExecutorService?
  • What is a RejectedExecutionHandler?
  • What is a BlockingQueue?
  • What is the difference between synchronized and Lock?
  • What is ReentrantLock?
  • What is ReadWriteLock?
  • What is Condition interface?

Advanced Level

  • What is Fork/Join framework?
  • What is Work Stealing Algorithm?
  • What is ConcurrentHashMap?
  • How does ConcurrentHashMap achieve thread safety?
  • What is CopyOnWriteArrayList?
  • What is CAS (Compare and Swap)?
  • What are Atomic classes?
  • What is the difference between Atomic and volatile?
  • What is StampedLock?
  • What is Phaser?
  • What is CyclicBarrier?
  • What is CountDownLatch?
  • What is Semaphore?
  • What is Exchanger?
  • What is ThreadPoolExecutor?
  • How does ThreadPoolExecutor manage threads internally?
  • What is ForkJoinPool?
  • What is parallel stream?
  • How does parallel stream work internally?
  • What is thread contention?
  • What is false sharing?
  • How do you debug concurrency issues?
  • What is Memory Consistency Error?
  • What is Happens-Before relationship?
  • What is Java Memory Model?

Expert Level

  • How to design highly scalable multithreaded systems?
  • What are lock-free algorithms?
  • What are wait-free algorithms?
  • What is the difference between blocking vs non-blocking algorithms?
  • How do you reduce lock contention?
  • How does JVM handle thread scheduling internally?
  • What are advanced optimizations in modern JVM for concurrency?
  • Explain the internals of synchronized keyword.
  • Explain biased locking.
  • Explain lightweight locking.
  • What is escape analysis?
  • How does JIT optimize multithreaded code?
  • How do you detect deadlocks in production?
  • How do you avoid deadlocks using ordering strategies?
  • How do you tune thread pools for high throughput?
  • What is backpressure in multithreading systems?
  • How do you design producer?consumer systems at scale?
  • How do you build custom thread pools?
  • How do you test multithreaded code effectively?
  • What is the role of memory barriers in concurrency?
  • How do you ensure safe publication of objects?
  • What is double-checked locking?
  • Why was double-checked locking broken before Java 5?
  • How do you build lock-free data structures?
  • How do reactive systems differ from traditional multithreading?

Related Topics


11 January 2026

#Pandas

#Pandas

Key Concepts


S.No Topic Sub-Topics
1PandasOverview, Installation, Series, DataFrame, Basic operations
2Series BasicsCreating Series, Indexing, Slicing, Series methods, Data types
3DataFrame BasicsCreate DataFrame, Index/Columns, Shape, dtypes, head/tail
4Data Selectionloc, iloc, ix, column selection, row selection
5Data FilteringBoolean indexing, conditions, isin, between, query()
6Missing Dataisnull, notnull, fillna, dropna, interpolation
7Data CleaningDuplicates, rename, replace, strip whitespaces, type conversion
8Data Transformationapply, map, applymap, lambda functions, vectorized operations
9Aggregation & Groupinggroupby, aggregate, transform, filter, pivot tables
10Sorting & Rankingsort_values, sort_index, rank, ascending/descending, multi-level sorting
11Indexing & MultiIndexset_index, reset_index, hierarchical index, slicing, cross-section
12Concatenation & Mergingconcat, append, merge, join, indicator
13Reshaping Datamelt, pivot, stack, unstack, wide to long format
14Time Series BasicsDatetime conversion, date_range, indexing, resampling, frequency
15Time Series Advancedrolling, expanding, shifting, lag/lead, moving average
16String Operationsstr methods, contains, replace, split, regex
17Visualization with Pandasplot, line, bar, histogram, scatter
18Reading/Writing Dataread_csv, read_excel, read_json, to_csv, to_excel
19Advanced I/Oread_sql, read_parquet, read_hdf, read_pickle, compression
20Exploratory Data Analysisdescribe, info, value_counts, correlation, unique
21Multi-Column Operationsarithmetic, apply, assign, lambda, broadcasting
22Window Functionsrolling, expanding, ewm, groupby with window, custom functions
23Categorical Datacategory dtype, conversion, codes, sorting, filtering
24Sampling & Subsettingsample, head/tail, nth, slicing, random sampling
25Performance Optimizationvectorization, eval/query, categorical, chunking, memory usage
26MultiIndex Advancedstack/unstack, xs, swaplevel, sortlevel, indexing tricks
27Custom Functionsapply, pipe, lambda, function chaining, reusable utilities
28Integration with NumPy & SciPyarray operations, broadcasting, linear algebra, statistical functions, interoperability
29Real World Data ProjectsEDA, cleaning, aggregation, visualization, export results
30End-to-End ProjectData collection, cleaning, analysis, feature engineering, visualization

Interview question


Related Topics


#Keras

#Keras

Key Concepts


S.No Topic Sub-Topics
1KerasOverview, Installation, Backend (TensorFlow), High-level API, Use cases
2Core ConceptsLayers, Models, Tensors, Activation functions, Input/Output shapes
3Sequential API BasicsSequential model, Adding layers, compile(), fit(), evaluate()
4Sequential API AdvancedMultiple layers, Dropout, Flatten, Dense, Activation layers
5Functional API BasicsInput(), Model(), multi-input/output, shared layers, layer connections
6Functional API AdvancedResidual connections, Branching models, Merging layers, Concatenate, Add layers
7Loss FunctionsBinary crossentropy, Categorical crossentropy, MSE, Custom loss, Sparse loss
8OptimizersSGD, Adam, RMSProp, learning rate, custom optimizer
9MetricsAccuracy, Precision, Recall, F1-score, Custom metrics
10CallbacksEarlyStopping, ModelCheckpoint, ReduceLROnPlateau, TensorBoard, custom callbacks
11Data PreprocessingNormalization, Standardization, One-hot encoding, ImageDataGenerator, Tokenizer
12RegularizationDropout, L1/L2, BatchNormalization, Weight constraints, Data augmentation
13Dense NetworksFeedforward networks, Layer configuration, Activation functions, Compile, Fit
14Convolutional Networks (CNN)Conv2D, MaxPooling2D, Flatten, Filters, Kernels
15Advanced CNNTransfer learning, Pretrained models, Fine-tuning, Data augmentation, Regularization
16Recurrent Networks (RNN)SimpleRNN, LSTM, GRU, sequence input, return sequences
17Advanced RNNBidirectional RNN, stacked RNN, attention mechanism, masking, stateful RNN
18Embedding LayersWord embeddings, Embedding layer, pretrained embeddings, input_dim, output_dim
19AutoencodersEncoder-Decoder, Dimensionality reduction, Reconstruction loss, Activation, Custom models
20GANs BasicsGenerator, Discriminator, Adversarial loss, Training loop, Applications
21GANs AdvancedConditional GAN, DCGAN, WGAN, Training stability, Image generation
22Custom LayersLayer subclassing, call(), build(), trainable weights, forward pass
23Custom ModelsModel subclassing, forward pass, training loop, GradientTape, metrics
24Model Saving & Loadingsave(), load_model(), SavedModel format, HDF5 format, weights only
25TensorBoardVisualization, Scalars, Images, Graphs, Embeddings
26Performance OptimizationMixed precision, GPU/TPU usage, Batch size, Learning rate tuning, Profiling
27Distributed TrainingMirroredStrategy, Multi-GPU, TPU, ParameterServerStrategy, Dataset sharding
28Integration with TensorFlowtf.data, tf.keras, TensorFlow Hub, Custom training loops, SavedModel export
29End-to-End NLP ProjectText preprocessing, Tokenization, Embeddings, LSTM/Transformer model, Evaluation
30End-to-End CV ProjectData preprocessing, CNN/Transfer learning, Training, Evaluation, Deployment

Interview question


Related Topics


#NumPy


Key Concepts


S.No Topic Sub Topic
1 NumPy Installation, Import, ndarray, dimensions, shape, size, dtype, ndim
2 Array Creation array(), zeros(), ones(), empty(), full(), arange(), linspace()
3 Array Data Types int, float, bool, complex, string, object, astype()
4 Array Indexing Positive indexing, negative indexing, slicing, multidimensional indexing, row/column access, step slicing, assignment
5 Boolean Indexing Boolean arrays, conditions, multiple conditions, where(), nonzero(), filtering, conditional replacement
6 Fancy Indexing Integer indexing, index arrays, row selection, column selection, combined indexing, advanced assignment, copy behavior
7 Array Shape reshape(), shape, resize(), ravel(), flatten(), squeeze(), expand_dims()
8 Array Joining concatenate(), stack(), hstack(), vstack(), dstack(), column_stack(), split()
9 Array Transformation transpose(), T, swapaxes(), moveaxis(), flip(), rot90(), roll()
10 Broadcasting Broadcasting rules, scalar broadcasting, vector broadcasting, matrix broadcasting, incompatible shapes, broadcast_to()
11 Mathematical Operations Addition, subtraction, multiplication, division, power, modulus, absolute values
12 Statistical Operations sum(), mean(), median(), std(), var(), min(), max()
13 Axis Operations axis=0, axis=1, multidimensional axes, aggregation, keepdims, axis debugging
14 Universal Functions sqrt(), exp(), log(), sin(), cos(), round(), floor(), ceil()
15 Aggregation & Searching argmin(), argmax(), unique(), sort(), argsort(), searchsorted(), count_nonzero()
16 Sorting & Selection sort(), argsort(), partition(), argpartition(), top-K selection, ranking
17 Random Numbers default_rng(), random integers, random floats, normal distribution, uniform distribution, random choice
18 Probability Distributions Normal, binomial, Poisson, exponential, uniform, multinomial, sampling
19 Linear Algebra dot(), matmul(), @, matrix multiplication, transpose, inverse, determinant
20 Advanced Linear Algebra Eigenvalues, eigenvectors, norms, rank, solve equations, matrix decomposition
21 Memory & Views Views, copies, shallow copy, deep copy, memory layout, strides, contiguous arrays
22 Vectorization Vectorized operations, loops vs vectorization, ufuncs, broadcasting, bulk operations
23 Missing & Special Values NaN, Inf, isnan(), isinf(), isfinite(), nanmean(), nanmedian()
24 File Operations loadtxt(), savetxt(), genfromtxt(), .npy, .npz, save(), load()
25 Structured Arrays Structured dtype, fields, records, record arrays, field access, sorting, filtering
26 NumPy for Data Science Data preprocessing, normalization, standardization, feature arrays, numerical transformations
27 NumPy for Machine Learning Feature matrix, target vector, train/test arrays, distance calculations, normalization, one-hot representation
28 NumPy for AI Embeddings, cosine similarity, vector operations, batch processing, tensor-like operations, similarity matrices
29 Performance Optimization Vectorization, memory usage, dtype optimization, broadcasting, views, profiling, unnecessary copies
30 Expert Project Data preprocessing, statistical analysis, matrix operations, similarity search, ML preprocessing, end-to-end NumPy project

Interview question

1. What is NumPy and why is it used in Python?
2. What are the main advantages of NumPy over Python lists?
3. What is an ndarray in NumPy?
4. How do you install NumPy?
5. How do you import NumPy in Python?
6. What is the difference between a NumPy array and a Python list?
7. What is vectorization in NumPy?
8. Why are NumPy operations faster than Python loops?
9. What is the shape of a NumPy array?
10. What is ndim in NumPy?
11. What is the size attribute of a NumPy array?
12. What is dtype in NumPy?
13. How do you check the shape, size, and dimensions of an array?
14. How do you create a NumPy array?
15. How do you create an array of zeros?
16. How do you create an array of ones?
17. How do you create an empty NumPy array?
18. How do you create an array filled with a specific value?
19. What is the difference between np.zeros() and np.empty()?
20. How do you create an identity matrix?
21. What is the difference between np.eye() and np.identity()?
22. How do you create a sequence of numbers using NumPy?
23. What is the difference between np.arange() and np.linspace()?
24. How do you create evenly spaced values in NumPy?
25. How do you specify the data type while creating an array?
26. How do you convert a NumPy array to another dtype?
27. What is astype() in NumPy?
28. What happens when NumPy arrays contain mixed data types?
29. What are NumPy scalar types?
30. What is type promotion in NumPy?
31. How do you access elements of a NumPy array?
32. How does negative indexing work in NumPy?
33. How do you slice a one-dimensional NumPy array?
34. How do you slice a two-dimensional NumPy array?
35. How do you select a specific row from a NumPy matrix?
36. How do you select a specific column from a NumPy matrix?
37. How do you select alternate elements from an array?
38. What is boolean indexing in NumPy?
39. How do you filter elements using a condition?
40. How do you filter values greater than a specific number?
41. How do you apply multiple conditions in NumPy?
42. What is fancy indexing in NumPy?
43. What is the difference between slicing and fancy indexing?
44. How do you select multiple rows using NumPy indexing?
45. How do you select multiple columns using NumPy indexing?
46. How do you replace elements based on a condition?
47. What is np.where()?
48. What is np.nonzero()?
49. How do you find the indices of elements satisfying a condition?
50. How do you reverse a NumPy array?
51. What is reshape() in NumPy?
52. What is the difference between reshape() and resize()?
53. What is ravel() in NumPy?
54. What is flatten() in NumPy?
55. What is the difference between ravel() and flatten()?
56. What is squeeze() in NumPy?
57. What is expand_dims()?
58. How do you convert a one-dimensional array into a column vector?
59. How do you convert a one-dimensional array into a row vector?
60. What happens if the dimensions passed to reshape() are incompatible?
61. What is broadcasting in NumPy?
62. What are the rules of NumPy broadcasting?
63. Why is broadcasting useful?
64. What happens when two arrays have incompatible shapes for broadcasting?
65. How does scalar broadcasting work?
66. How does broadcasting work with two-dimensional arrays?
67. What is np.broadcast_to()?
68. What is the difference between broadcasting and copying?
69. How can broadcasting improve performance?
70. Give an example of a broadcasting error.
71. How do you concatenate NumPy arrays?
72. What is np.concatenate()?
73. What is np.stack()?
74. What is the difference between concatenate() and stack()?
75. What is np.vstack()?
76. What is np.hstack()?
77. What is np.dstack()?
78. What is np.column_stack()?
79. How do you split a NumPy array?
80. What is the difference between split(), hsplit(), and vsplit()?
81. How do you transpose a NumPy array?
82. What is the difference between transpose() and .T?
83. What is swapaxes()?
84. What is moveaxis()?
85. What is np.flip()?
86. What is np.rot90()?
87. What is np.roll()?
88. How do you swap rows and columns in NumPy?
89. How do you rotate a matrix using NumPy?
90. How do you reverse rows and columns independently?
91. How do you perform element-wise addition in NumPy?
92. How do you perform element-wise subtraction?
93. How do you perform element-wise multiplication?
94. What is the difference between * and @ in NumPy?
95. How do you perform element-wise division?
96. How do you calculate powers of NumPy arrays?
97. How do you calculate absolute values?
98. How do you calculate square roots using NumPy?
99. How do you calculate exponential values?
100. How do you calculate logarithms using NumPy?
101. What are universal functions (ufuncs) in NumPy?
102. What are the advantages of NumPy ufuncs?
103. What is np.sqrt()?
104. What is np.exp()?
105. What is np.log()?
106. What is np.sin() and np.cos()?
107. What are np.floor() and np.ceil()?
108. What is np.round()?
109. How do you perform element-wise mathematical operations efficiently?
110. How do ufuncs differ from Python functions?
111. How do you calculate the sum of an array?
112. How do you calculate the mean?
113. How do you calculate the median?
114. How do you calculate standard deviation?
115. How do you calculate variance?
116. How do you find minimum and maximum values?
117. What is the axis parameter in NumPy?
118. What does axis=0 mean?
119. What does axis=1 mean?
120. What is keepdims in NumPy aggregation?
121. What is the difference between min() and argmin()?
122. What is the difference between max() and argmax()?
123. How do you find the index of the maximum value?
124. How do you find unique values in an array?
125. What is np.unique()?
126. How do you count non-zero elements?
127. What is np.count_nonzero()?
128. How do you sort a NumPy array?
129. What is np.argsort()?
130. What is the difference between sort() and argsort()?
131. What is np.partition()?
132. What is np.argpartition()?
133. How do you find the top-K values efficiently?
134. What is np.searchsorted()?
135. How do you perform ranking using NumPy?
136. How do you generate random numbers in NumPy?
137. What is np.random.default_rng()?
138. Why is default_rng() preferred for new code?
139. How do you generate random integers?
140. How do you generate random floating-point numbers?
141. How do you generate normally distributed values?
142. How do you generate uniformly distributed values?
143. How do you randomly select elements from an array?
144. What is random seed and why is it important?
145. How do you create reproducible random results?
146. What probability distributions are available in NumPy?
147. How do you generate binomially distributed data?
148. How do you generate Poisson-distributed data?
149. How do you generate exponentially distributed data?
150. How do you generate samples from a normal distribution?
151. What is NumPy linear algebra?
152. What is np.dot()?
153. What is np.matmul()?
154. What is the difference between dot() and matmul()?
155. What is the @ operator in NumPy?
156. How do you calculate the determinant of a matrix?
157. How do you calculate the inverse of a matrix?
158. How do you solve a system of linear equations?
159. How do you calculate matrix rank?
160. What are eigenvalues and eigenvectors in NumPy?
161. What is np.linalg.norm()?
162. What is matrix decomposition?
163. What is singular value decomposition (SVD)?
164. What is QR decomposition?
165. Why is NumPy linear algebra important for machine learning?
166. What is the difference between a view and a copy?
167. How do you create an explicit copy of an array?
168. What is np.copy()?
169. Why can modifying a view modify the original array?
170. How can you determine whether two arrays share memory?
171. What are strides in NumPy?
172. What is memory layout in NumPy?
173. What is C-order memory layout?
174. What is Fortran-order memory layout?
175. Why is memory layout important for performance?
176. How do you handle NaN values in NumPy?
177. What is np.isnan()?
178. What is np.isinf()?
179. What is np.isfinite()?
180. What is the difference between mean() and nanmean()?
181. How do you replace NaN values?
182. How do you identify infinite values?
183. How do you save a NumPy array to a file?
184. What is the .npy format?
185. What is the .npz format?
186. What is the difference between np.save() and np.savetxt()?
187. How do you load a NumPy array from a file?
188. What is np.loadtxt()?
189. What is np.genfromtxt()?
190. When should you use NumPy instead of Pandas?
191. How is NumPy used in machine learning?
192. How is NumPy used for feature preprocessing?
193. How do you normalize data using NumPy?
194. How do you standardize data using NumPy?
195. How do you calculate Euclidean distance using NumPy?
196. How do you calculate cosine similarity using NumPy?
197. How can NumPy be used to process embeddings?
198. How do you optimize NumPy code for large datasets?
199. How do vectorization and broadcasting improve NumPy performance?
200. How would you design an end-to-end NumPy data-processing pipeline?

Related Topics


30 May 2024

#CoreJava


Key Concepts


Topic Sub Topic
Java JDK/JRE/JVM, Java 21 features, compilation, bytecode, runtime architecture
OOP & Design Encapsulation, inheritance, polymorphism, abstraction, composition, SOLID
Classes & Objects Constructors, records, enums, sealed classes, immutable objects
Interfaces Default methods, functional interfaces, interface-based agent/tool contracts
Generics Generic classes, methods, wildcards, bounded types, type-safe AI components
Collections Framework List, Set, Map, Queue, Deque, selection strategies for AI workloads
HashMap Internals Hashing, buckets, collisions, resizing, treeification, performance
Java Streams map, filter, reduce, collect, grouping, parallel streams, AI data pipelines
Functional Programming Lambda, method references, predicates, functions, consumers, suppliers
Exception Handling Checked/unchecked exceptions, custom exceptions, resilient AI services
I/O & NIO Files, Path, Channels, Buffers, asynchronous I/O, document ingestion
Date & Time API LocalDate, Instant, Duration, ZoneId, timestamps for AI workflows
Concurrency Threads, Runnable, Callable, synchronization, locks
Executors ExecutorService, ScheduledExecutorService, thread pools, task orchestration
CompletableFuture Async composition, chaining, parallel calls, error recovery for LLM APIs
Virtual Threads Java 21 virtual threads, blocking I/O, high-concurrency AI services
Synchronization synchronized, Lock, ReentrantLock, atomic classes, concurrent collections
Java Memory Model Heap, stack, happens-before, visibility, volatile, safe publication
JVM Internals Class loading, runtime areas, JIT, bytecode, JVM execution lifecycle
Garbage Collection G1 GC, generational GC, GC tuning, memory behavior of AI applications
Performance Engineering Profiling, CPU/memory bottlenecks, allocation, latency, throughput
Reflection & Annotations Reflection API, custom annotations, runtime metadata, tool discovery
Serialization JSON, Jackson, Java serialization, DTOs, structured AI messages
HTTP Client Java HttpClient, REST calls, async requests, LLM provider integration
Networking HTTP/HTTPS, connection pooling, retries, timeouts, resilient AI API communication
Design Patterns Factory, Builder, Strategy, Observer, Adapter, Chain of Responsibility
AI-Oriented Design Patterns Tool Registry, Agent Loop, Router, Planner, Memory, ReAct-style orchestration
Clean Architecture Domain, application, infrastructure layers, AI provider abstraction
Testing JUnit, Mockito, integration testing, async testing, AI service testing
Production Agentic AI Java + Spring AI, LLM integration, RAG, tool calling, memory, MCP, LangGraph4j-style orchestration, observability


Interview Question


What is Java?
What the features of Java?
What is JVM?
What is JRE?
What is JDK?
What is the difference between JDK, JRE, and JVM?
How does Java achieve platform independence?
What is bytecode?
What is the main() method?
Can we overload the main() method?
Can we override the main() method?
What are command-line arguments?
What are variables in Java?
What are primitive data types?
What is type casting?
What is implicit casting?
What is explicit casting?
What are operators in Java?
What is the difference between == and equals()?
What is the difference between = and ==?
What is an object?
What is a class?
What is an instance variable?
What is a local variable?
What is a static variable?
What is a constructor?
What is the difference between constructor and method?
Can constructors be inherited?
Can constructors be private?
What is constructor overloading?
What is method overloading?
What is method overriding?
What is polymorphism?
What are the types of polymorphism?
What is inheritance?
What are the types of inheritance?
Why does Java not support multiple inheritance with classes?
What is encapsulation?
What is abstraction?
What is an abstract class?
What is an interface?
What is the difference between abstract class and interface?
Can an interface have default methods?
Can an interface have static methods?
What are marker interfaces?
What are access modifiers?
What is the difference between public, protected, default, and private?
What is the final keyword?
What is the finally block?
What is finalize()?
What is the difference between final, finally, and finalize()?
What is the static keyword?
What is a static block?
Can we override static methods?
What is the this keyword?
What is the super keyword?
What is object cloning?
What is shallow copy?
What is deep copy?
What is the Object class?
What are the methods of Object class?
What is hashCode()?
What is equals() contract?
What is toString()?
What is the difference between String, StringBuilder, and StringBuffer?
Why is String immutable?
What is the String Constant Pool?
What is intern()?
How are strings stored in memory?
What is garbage collection?
How does Garbage Collector work?
What are GC roots?
Can garbage collection be forced?
What are memory leaks in Java?
What is heap memory?
What is stack memory?
What is Metaspace?
What is OutOfMemoryError?
What is StackOverflowError?
What is exception handling?
What is the difference between checked and unchecked exceptions?
What is the difference between Error and Exception?
What is try-catch-finally?
What is try-with-resources?
How do you create a custom exception?
What is throw?
What is throws?
Can we catch multiple exceptions?
What is multi-catch?
What is reflection?
What is the Reflection API?
What are annotations?
What are built-in annotations?
What are custom annotations?
What is serialization?
What is deserialization?
What is transient?
What is volatile?
What is enum?
What is var in Java?
What are wrapper classes?
What is autoboxing and unboxing?
What is package?
What is import statement?
What is package-private access?
What is Java Memory Model?
What is pass-by-value in Java?
What is the difference between compile-time and runtime polymorphism?
What is covariant return type?
What is anonymous class?
What is inner class?
What is local inner class?
What is static nested class?
What is lambda expression?
What is functional interface?
What is method reference?
What are streams in Java?
What is Optional?
What is record in Java?
What is sealed class?
What is switch expression?
What are text blocks?
What are modules in Java?
How do you improve Java performance?
What are common Java coding best practices?
Explain SOLID principles in Java.
What are common Java interview coding questions?
How do you debug Java applications?
What are JVM arguments?
What are JVM startup options?
Explain Java execution flow from source code to bytecode.
Explain the class loading process in Java.
What are ClassLoaders?
What is Bootstrap ClassLoader?
What is Extension ClassLoader?
What is Application ClassLoader?
What is dynamic class loading?
How do you prevent object creation?
What is Singleton class?
How do you implement Singleton in Java?
What are immutable classes?
How do you create an immutable class?
What are design patterns commonly used in Java?
Explain Factory Pattern.
Explain Builder Pattern.
Explain Strategy Pattern.
Explain Observer Pattern.
What are Java 8 features?
What are Java 11 features?
What are Java 17 features?
What are Java 21 features?
What are the most frequently asked Core Java interview questions for experienced developers?
What is the Java Memory Model (JMM)?
Explain happens-before relationship in Java.
What is safe publication of objects?
What is escape analysis?
What is TLAB (Thread Local Allocation Buffer)?
What is object header in Java?
What is compressed OOPs?
How is memory allocated for objects?
What happens when new keyword is executed?
How does Java allocate arrays in memory?
What is class loading?
Explain the delegation model of ClassLoader.
What is custom ClassLoader?
When is a class initialized?
Difference between loading, linking, and initialization?
What is class unloading?
Can classes be unloaded from JVM?
What is static initialization order?
What is instance initialization block?
Execution order of constructors, static blocks, and instance blocks?
Difference between Comparable and Comparator?
How does compareTo() work?
How does Comparator chaining work?
What is natural ordering?
What is custom sorting?
What is immutable object?
Why should immutable classes be final?
Can immutable classes contain mutable fields?
How do you make defensive copies?
Advantages of immutable objects?
Difference between StringBuilder and StringBuffer?
Why is String immutable?
How is String Pool implemented?
Difference between new String() and string literal?
How does intern() work?
Can String Pool cause memory issues?
Explain hashCode() and equals() contract.
What happens if hashCode() is not overridden?
Can two unequal objects have same hashCode()?
Can equal objects have different hashCode()?
How do HashMap and equals() work together?
Explain finalize() deprecation.
What is Cleaner API?
What are Weak References?
What are Soft References?
What are Phantom References?
Difference between WeakHashMap and HashMap?
What are JVM memory regions?
Difference between Heap and Metaspace?
What is Eden Space?
What are Survivor Spaces?
What is Old Generation?
Explain Minor GC.
Explain Major GC.
Explain Full GC.
What causes Full GC?
How do you analyze GC logs?
Difference between Serial GC, Parallel GC, CMS, G1, ZGC, and Shenandoah?
What is G1 Garbage Collector?
What is ZGC?
What is Shenandoah GC?
When should you use Parallel GC?
Explain reflection with example.
What are drawbacks of Reflection?
How do you invoke methods using Reflection?
How do frameworks use Reflection?
Can private methods be invoked using Reflection?
What are annotations?
Difference between RetentionPolicy values?
What are meta-annotations?
How do custom annotations work?
What is @Inherited annotation?
Difference between checked and unchecked exceptions?
Can overridden methods throw broader exceptions?
Can constructors throw exceptions?
How does exception propagation work?
Best practices for exception handling?
What is serialization?
How does Serializable work internally?
What is serialVersionUID?
What happens if serialVersionUID changes?
What is Externalizable?
Difference between Serializable and Externalizable?
Explain transient keyword.
Explain volatile keyword.
Difference between transient and volatile?
What are lambda expressions?
How are lambda expressions implemented internally?
What is invokedynamic?
Difference between lambda and anonymous class?
What is functional interface?
Explain Optional class.
Difference between orElse() and orElseGet()?
What is Optional.flatMap()?
Common mistakes while using Optional?
Explain Java Streams.
Difference between map() and flatMap()?
Difference between filter() and peek()?
Difference between limit() and skip()?
Difference between findAny() and findFirst()?
Difference between reduce() and collect()?
What is Collector?
How does parallelStream() work?
When should parallel streams be avoided?
Explain var keyword.
What are records?
What are sealed classes?
What are text blocks?
Explain pattern matching in Java.
What are switch expressions?
What are modules in Java?
Explain module-info.java.
Benefits of Java Modules?
What is Process API?
What is VarHandle?
What is MethodHandle?
Difference between Reflection and MethodHandle?
Explain JVM architecture.
How does JIT compiler work?
What is HotSpot JVM?
What is C1 and C2 compiler?
What is GraalVM?
How do you troubleshoot OutOfMemoryError?
How do you analyze heap dumps?
How do you identify memory leaks?
How do you profile Java applications?
What tools do you use for JVM monitoring?
Difference between fail-fast and fail-safe iterators?
How does ConcurrentModificationException occur?
What is modCount?
Explain Java coding best practices.
What are common Core Java interview coding questions?
What are common Java performance tuning techniques?
What are common Java design mistakes?
What are the most frequently asked Core Java interview questions for 10+ years experienced developers?
What is Object-Oriented Programming, and what problems does it solve?
What are the four fundamental principles of OOP?
What is the difference between a class and an object?
What is encapsulation, and why is it important?
How do you achieve encapsulation in Java?
What is abstraction, and how is it different from encapsulation?
How do abstract classes support abstraction?
How do interfaces support abstraction?
What is inheritance, and why is it used?
What are the different types of inheritance?
Why does Java not support multiple inheritance through classes?
How can Java achieve multiple inheritance using interfaces?
What is polymorphism?
What is compile-time polymorphism?
What is runtime polymorphism?
What is method overloading?
What is method overriding?
What is the difference between method overloading and method overriding?
Can a static method be overridden?
Can a private method be overridden?
Can a final method be overridden?
What is dynamic method dispatch?
What is upcasting in OOP?
What is downcasting, and what risks are associated with it?
What is the difference between IS-A and HAS-A relationships?
What is composition?
What is aggregation?
What is the difference between composition and aggregation?
Why is composition often preferred over inheritance?
What is association in OOP?
What is dependency in object-oriented design?
What is object coupling?
What is cohesion?
Why should high cohesion and low coupling be preferred?
What is an immutable object?
How do you design an immutable class in Java?
Why is String immutable in Java?
What is the role of constructors in object creation?
Can constructors be inherited or overridden?
What is constructor chaining?
What is the difference between this and super?
What is the difference between an abstract class and an interface?
When would you choose an abstract class over an interface?
When would you choose composition over inheritance?
What is the Open/Closed Principle?
What is the Single Responsibility Principle?
What is the Liskov Substitution Principle?
What is the Interface Segregation Principle?
What is the Dependency Inversion Principle?
How do SOLID principles improve object-oriented design?
What is the difference between abstraction and polymorphism?
How does encapsulation improve maintainability?
How does inheritance affect coupling?
What are the disadvantages of excessive inheritance?
What is the fragile base class problem?
What is the diamond problem in multiple inheritance?
How does Java resolve default method conflicts in interfaces?
What happens when two interfaces contain the same default method?
What is the difference between an object reference and an object?
What happens internally when an object is created using new?
What is object identity versus object equality?
What is the contract between equals() and hashCode()?
Why should equals() and hashCode() be overridden together?
What is shallow copying?
What is deep copying?
How does cloning relate to OOP design?
What is an interface in Java?
What is an abstract class in Java?
What is the difference between an interface and an abstract class?
When should you use an interface instead of an abstract class?
When should you use an abstract class instead of an interface?
Can an interface contain concrete methods?
What are default methods in interfaces?
What are static methods in interfaces?
Can an interface have private methods?
Can an interface have constructors?
Can an abstract class have constructors?
Can an abstract class contain both abstract and concrete methods?
Can an abstract class contain instance variables?
Can an interface contain variables?
Why are interface variables implicitly public, static, and final?
Can an interface extend another interface?
Can an interface extend multiple interfaces?
Can an abstract class implement an interface?
Can an abstract class extend another abstract class?
Can a concrete class extend an abstract class and implement an interface?
Can a class implement multiple interfaces?
Why does Java support multiple inheritance through interfaces?
What is the diamond problem with interfaces?
How does Java resolve conflicting default methods?
What happens when two interfaces provide the same default method?
Can a class override a default method from an interface?
Can an interface extend an interface containing default methods?
Can an abstract class implement an interface without implementing all methods?
What happens if a concrete class does not implement all interface methods?
Can an interface contain abstract methods without the abstract keyword?
Are interface methods public by default?
What is the visibility requirement when implementing an interface method?
Can an interface method be protected or private?
Can an abstract class method be private?
Can an abstract method be static?
Can an abstract method be final?
Can an abstract class be final?
Can an interface be final?
Can an interface be instantiated?
Can an abstract class be instantiated?
Can an interface reference point to an implementing class object?
What is interface-based programming?
How does programming to an interface reduce coupling?
How do interfaces support polymorphism?
How does an abstract class support code reuse?
What is the difference between abstraction and implementation hiding?
How do interfaces help achieve loose coupling?
How do interfaces support dependency inversion?
How are interfaces used with dependency injection in Spring?
What is a functional interface?
What is the purpose of the @FunctionalInterface annotation?
Can a functional interface contain default and static methods?
Can a functional interface extend another interface?
What happens if a functional interface contains two abstract methods?
What is a marker interface?
What are examples of marker interfaces in Java?
What is the difference between a marker interface and an annotation?
What is a sealed interface?
What is a sealed abstract class?
How do sealed classes and interfaces control inheritance?
What is the difference between sealed, non-sealed, and final classes?
Can an interface extend a sealed interface?
Can an abstract class implement a sealed interface?
How would you design an extensible API using interfaces?
How would you design a common base workflow using an abstract class?
How does the Template Method pattern relate to abstract classes?
Why are interfaces commonly preferred for contracts?
What are the limitations of abstract classes?
What are the limitations of interfaces?
How have interfaces evolved from Java 7 to Java 8, 9, 11, 17, and 21?
What changed for interfaces in Java 8?
What changed for interfaces in Java 9?
Can an interface have private methods in modern Java?
Can an interface have static initialization blocks?
Can an abstract class contain static methods and variables?
Can an abstract class implement multiple interfaces?
Can an interface inherit methods from Object?
Can an interface override equals(), hashCode(), or toString()?
What happens if an interface declares a default method with the same signature as Object?
How does method resolution work between superclass and interface default methods?
What happens when a superclass and interface provide methods with the same signature?
Can two unrelated interfaces have methods with the same name and parameters?
How does Java handle covariant return types in interface implementations?
Can an interface method throw checked exceptions?
Can an implementing class reduce the checked exceptions declared by an interface method?
Can an implementing class change the return type of an interface method?
What is the difference between inheritance and interface implementation?
What is the difference between extends and implements?
Can a class extend one class and implement multiple interfaces?
Can an interface inherit state from another interface?
How would you migrate an abstract class design to interfaces?
How do interfaces improve testability and mocking?
When can excessive use of interfaces become a design problem?
How would you choose between interface, abstract class, and concrete class in a real project?

23 June 2021

#Collections

#Collections

Key Concepts


S.No Topic Sub-Topics
1CollectionsCollection, Collection vs Collections, Hierarchy, Root Interfaces, Use Cases
2Core InterfacesCollection, List, Set, Map, Queue, Marker Interfaces
3Iterable & IteratorsIterable, Iterator, ListIterator, forEach, Fail-fast
4List InterfaceIndexed Access, Order, Duplicate, add/remove, ListIterator
5ArrayListInternal Array, resize, load factor, random access, use cases
6LinkedListDoubly Linked, node structure, insertion cost, Deque support, use cases
7Vector & StackLegacy Classes, Synchronization, performance, Stack methods, use cases
8Set InterfaceUniqueness, hashing logic, duplicate detection, equals, hashCode
9HashSetHash table, buckets, collisions, load factor, iterator order
10LinkedHashSetInsertion order, doubly-linked buckets, access order, LRU
11TreeSetSorted, NavigableSet, Red-Black Tree, compareTo, Comparator
12Map InterfaceKey/Value, uniqueness of key, null handling, entrySet, hashing
13HashMapHashing, buckets, resizing, tree bins, load factor, collisions
14LinkedHashMapOrder, access-order mode, LRU cache, removeEldestEntry, use cases
15TreeMapRed-Black Tree, sorting keys, NavigableMap, comparator, range queries
16ConcurrentHashMapSegments, Lock-free, CAS, performance, concurrency model
17WeakHashMapGC aware keys, WeakReference, caching, memory leaks
18IdentityHashMapReference equality, == vs equals, special use cases, pitfalls
19EnumMap & EnumSetBitwise storage, speed, memory, enum key benefits
20Queue InterfaceFIFO behavior, offer/poll, peek, priority queue, Deque
21Deque InterfaceDouble-ended queue, addFirst/addLast, stack vs queue
22PriorityQueueHeap, priority logic, compareTo, ordering, use cases
23BlockingQueueProducer-consumer, put/take methods, thread safety, use cases
24CopyOnWrite CollectionsCopyOnWriteArrayList, snapshot, safety, performance trade-offs
25Collections Utility Classsort, reverse, shuffle, binarySearch, unmodifiable, synchronized
26Stream CollectorstoList, toSet, toMap, groupingBy, partitioningBy, mapping
27Custom ComparatorComparator interface, compare method, chaining, reversed, nullsFirst
28Big-O PerformanceComplexity, add/remove, get, contains, load factor, resizing
29Choosing Right CollectionDecision matrix, use cases, performance tuning, trade-offs
30Best Practices & PatternsImmutability, safe iteration, fail-fast, defensive copy, caching

Interview question

Basic

  1. What is the Java Collections Framework?
  2. Difference between Collection and Collections in Java?
  3. What are the main interfaces in the Java Collections Framework?
  4. Difference between List, Set, and Map?
  5. What is the difference between Array and ArrayList?
  6. What is the difference between ArrayList and LinkedList?
  7. Difference between HashSet and TreeSet?
  8. What is the difference between HashMap and Hashtable?
  9. What is the difference between HashMap and LinkedHashMap?
  10. What is the difference between HashMap and TreeMap?
  11. What is the default load factor of HashMap?
  12. How does HashMap handle collisions?
  13. What is the initial capacity of HashMap?
  14. What is the difference between fail-fast and fail-safe iterators?
  15. How do you iterate over a List in Java?
  16. How do you sort a List in Java?
  17. How do you reverse a List in Java?
  18. What is the use of Collections utility class?
  19. How do you make a List thread-safe?
  20. What is the difference between synchronized collections and concurrent collections?
  21. What is the difference between ArrayDeque and LinkedList as a Queue?
  22. What is the difference between Stack and Deque?
  23. What is the difference between PriorityQueue and TreeSet?
  24. How does PriorityQueue maintain ordering?
  25. What is the difference between Comparable and Comparator?

Intermediate

  1. Explain how HashMap works internally.
  2. What is the role of hashCode() and equals() in collections?
  3. Why are hashCode() and equals() important in HashMap/HashSet?
  4. What happens if you override equals() but not hashCode()?
  5. What happens if you override hashCode() but not equals()?
  6. What is the difference between shallow copy and deep copy in collections?
  7. How do you create an immutable collection in Java?
  8. What is the difference between unmodifiable and immutable collections?
  9. What are WeakHashMap and its use cases?
  10. How does IdentityHashMap differ from HashMap?
  11. What is EnumSet and EnumMap?
  12. What is the difference between LinkedHashSet and TreeSet?
  13. How does ConcurrentHashMap achieve thread safety?
  14. What is the difference between CopyOnWriteArrayList and ArrayList?
  15. What is the difference between ConcurrentSkipListMap and TreeMap?
  16. What is the difference between BlockingQueue and ConcurrentLinkedQueue?
  17. Explain how LinkedHashMap maintains insertion order.
  18. What is LRU cache and how can you implement it using LinkedHashMap?
  19. What are NavigableMap and NavigableSet?
  20. Explain differences between TreeSet and TreeMap.
  21. How do you synchronize a HashMap?
  22. What is the difference between Collections.synchronizedList and CopyOnWriteArrayList?
  23. What is Spliterator in Java collections?
  24. How do you iterate a map using Java 8 forEach?
  25. How do you convert between arrays and collections?

Advanced

  1. Explain HashMap resizing and rehashing process.
  2. What is the significance of 0.75 load factor in HashMap?
  3. What happens when two keys have the same hashCode in HashMap?
  4. What is the role of linked lists and balanced trees in HashMap buckets (Java 8+)?
  5. Explain the performance differences between ArrayList, LinkedList, and Vector.
  6. How does TreeMap ensure sorting of keys?
  7. Difference between natural ordering and custom ordering in TreeMap/TreeSet?
  8. How does ConcurrentHashMap split data into segments? (Java 7 vs Java 8)
  9. What is the difference between parallelStream() and stream() on collections?
  10. What is a fail-fast iterator? Which collections are fail-fast?
  11. What is a fail-safe iterator? Which collections are fail-safe?
  12. How does CopyOnWriteArrayList work internally?
  13. What are weak references and how does WeakHashMap use them?
  14. How does IdentityHashMap use reference equality?
  15. Explain the difference between Hashtable and ConcurrentHashMap.
  16. How does EnumMap achieve better performance than HashMap?
  17. What are concurrent collections introduced in Java 5?
  18. What is the difference between ArrayBlockingQueue and LinkedBlockingQueue?
  19. How does PriorityBlockingQueue work?
  20. What is DelayQueue and its use cases?
  21. How does LinkedTransferQueue work?
  22. What is the difference between ConcurrentLinkedDeque and ArrayDeque?
  23. How do you implement producer-consumer using BlockingQueue?
  24. How do you avoid ConcurrentModificationException in collections?
  25. Explain the difference between Collections.emptyList() and new ArrayList<>().

Expert

  1. Explain the red-black tree implementation in TreeMap.
  2. How does HashMap deal with hash collisions after Java 8?
  3. What is tail binning in ConcurrentHashMap?
  4. Explain bin migration in ConcurrentHashMap.
  5. What is structural modification in collections?
  6. How does Java?s ForkJoinPool interact with parallel streams on collections?
  7. How do you implement a custom collection in Java?
  8. What interfaces must a custom collection implement?
  9. How do you implement a custom comparator for complex sorting?
  10. How does Spliterator support parallelism in Java collections?
  11. What is the role of characteristics in Spliterator (e.g., ORDERED, DISTINCT, SIZED)?
  12. How do you use Collectors.toMap() without causing IllegalStateException on duplicate keys?
  13. How do you optimize collection performance for read-heavy workloads?
  14. How do you optimize collection performance for write-heavy workloads?
  15. How does ConcurrentSkipListMap ensure thread safety and ordering?
  16. Explain the difference between segment-locking (Java 7) and bucket-level locking (Java 8) in ConcurrentHashMap.
  17. How do you implement a thread-safe LRU cache?
  18. Explain memory overhead of different collections.
  19. How do you implement multi-level sorting using Comparator chaining?
  20. How do you detect and handle memory leaks in collections?
  21. How do you implement an observer pattern with collections?
  22. How does the Stream API integrate with collections?
  23. How do you design collections for large-scale distributed systems?
  24. How do you tune GC behavior for large collections in JVM?
  25. Future of Java collections: how Project Valhalla and new JVM features might affect them?

Related Topics


   Collections Basic   
   Array   
   ArrayList   
   LinkedList   
   HashSet   
   LinkedHashSet   
   TreeSet   
   HashMap   
   LinkedHashMap   
   TreeMap   
   ConcurrentHashMap   
   WeakHashMap   
   IdentityHashMap   

11 November 2020

#CoreJava_08

#CoreJava_08

Key Concepts


S.No Topic Sub-Topics
1Java 8 OverviewJava 8 introduction, Why Java 8, Major enhancements, Backward compatibility, Java 8 use cases
2Functional Programming Functional programming basics, Pure functions, Immutability, Stateless behavior, Lambda-driven design
3Lambda Expressions - BasicsLambda syntax, Lambda parameters, Lambda body, Lambda vs anonymous class, Lambda advantages
4Lambda Expressions - AdvancedLambda with collections, Lambda with threads, Lambda with methods, Effectively final variables, Lambda limitations
5Functional Interfaces @FunctionalInterface , Single abstract method, Lambda compatibility, Custom functional interfaces
6Built-in Functional InterfacesPredicate, Function, Consumer, Supplier, Bi-functional interfaces
7Predicate Interfacetest() method, Predicate chaining, and(), or(), negate(), Real-time examples
8Function Interfaceapply() method, Function chaining, compose(), andThen(), Real-time use cases
9Consumer Interfaceaccept() method, Consumer chaining, forEach usage, Logging examples, Printing data
10Supplier Interfaceget() method, Lazy value generation, Supplier vs Function, Factory usage, Random value generation
11Method ReferencesStatic method reference, Instance method reference, Constructor reference, Syntax (::), Lambda replacement
12Stream API - IntroductionWhat is stream, Stream vs collection, Stream pipeline, Intermediate operations, Terminal operations
13Stream CreationStream from collection, Stream.of(), Arrays.stream(), Infinite streams, Empty streams
14Stream Intermediate Operationsfilter(), map(), flatMap(), distinct(), sorted()
15Stream Terminal OperationsforEach(), collect(), reduce(), count(), findFirst()
16Stream CollectorsCollectors.toList(), toSet(), toMap(), groupingBy(), partitioningBy()
17Stream Reduction Operationsreduce() method, Identity value, Accumulator, Combiner, Aggregation examples
18Parallel StreamsparallelStream(), ForkJoinPool, Performance benefits, Thread safety issues, When to use parallel streams
19Optional ClassOptional creation, isPresent(), ifPresent(), orElse(), orElseThrow()
20Default Methods in InterfaceDefault method syntax, Multiple inheritance resolution, Diamond problem, Overriding defaults, Use cases
21Static Methods in InterfaceStatic method rules, Invocation syntax, Difference from default methods, Utility methods, Best practices
22ForEach MethodIterable forEach(), Lambda usage, Method reference usage, Internal iteration, Comparison with loops
23Nashorn JavaScript EngineNashorn overview, JavaScript execution, ScriptEngine API, Java-JS interaction, Use cases
24New Date & Time API - BasicsProblems with old Date API, LocalDate, LocalTime, LocalDateTime, Immutability
25New Date & Time API - AdvancedZonedDateTime, Period, Duration, DateTimeFormatter, Time zones
26CompletableFutureFuture limitations, CompletableFuture basics, Async execution, thenApply(), thenAccept()
27Collectors Grouping & PartitioninggroupingBy(), partitioningBy(), downstream collectors, Multi-level grouping, Real examples
28Stream PerformanceLazy evaluation, Short-circuiting, Stream reuse rules, Avoiding side effects, Performance tuning
29Java 8 Coding PatternsFilter-map-reduce pattern, Functional pipelines, Optional usage patterns, Lambda best practices, Stream refactoring
30Java 8 Revision & Interview PrepJava 8 feature recap, Common interview questions, Coding scenarios, Performance discussions, Best practices

Interview question

Basic Level

  1. What are the major features introduced in Java 8?
  2. Why was Java 8 introduced?
  3. What is functional programming in Java 8?
  4. What is a lambda expression?
  5. What problems do lambda expressions solve?
  6. What is the syntax of a lambda expression?
  7. Difference between lambda expression and anonymous class?
  8. What is a functional interface?
  9. What is @FunctionalInterface annotation?
  10. Can a functional interface have default methods?
  11. Can a functional interface have static methods?
  12. What are built-in functional interfaces?
  13. What is Predicate interface?
  14. What is Function interface?
  15. What is Consumer interface?
  16. What is Supplier interface?
  17. What is method reference?
  18. Types of method references?
  19. What is Stream API?
  20. Why streams are introduced?
  21. Difference between stream and collection?
  22. What is stream pipeline?
  23. What are intermediate operations?
  24. What are terminal operations?
  25. What is forEach() method?

Intermediate Level

  1. How to create a stream?
  2. What is filter() in streams?
  3. What is map() in streams?
  4. Difference between map() and flatMap()?
  5. What is distinct()?
  6. What is sorted()?
  7. What is limit() and skip()?
  8. What is collect()?
  9. What is Collectors class?
  10. What is Collectors.toList()?
  11. What is Collectors.toSet()?
  12. What is Collectors.toMap()?
  13. What is groupingBy()?
  14. What is partitioningBy()?
  15. Difference between groupingBy and partitioningBy?
  16. What is reduce() operation?
  17. What is Optional class?
  18. Why Optional was introduced?
  19. How to create Optional?
  20. Difference between orElse() and orElseGet()?
  21. What is ifPresent()?
  22. What are default methods?
  23. Why default methods are introduced?
  24. What is static method in interface?
  25. Can we override default methods?

Advanced Level

  1. How lambda expressions work internally?
  2. What is effectively final variable?
  3. Why local variables must be effectively final in lambda?
  4. How streams process data internally?
  5. What is lazy evaluation in streams?
  6. What is short-circuiting in streams?
  7. What is findFirst()?
  8. What is findAny()?
  9. Difference between findFirst and findAny?
  10. What is anyMatch(), allMatch(), noneMatch()?
  11. What are parallel streams?
  12. Difference between stream() and parallelStream()?
  13. When should we use parallel streams?
  14. Problems with parallel streams?
  15. What is ForkJoinPool?
  16. How parallel stream uses ForkJoinPool?
  17. What is Java 8 Date and Time API?
  18. Problems with old Date API?
  19. What is LocalDate?
  20. What is LocalTime?
  21. What is LocalDateTime?
  22. What is ZonedDateTime?
  23. What is Period?
  24. What is Duration?
  25. What is DateTimeFormatter?

Expert Level

  1. How groupingBy works internally?
  2. What are downstream collectors?
  3. How to perform multi-level grouping?
  4. How reduce() works internally?
  5. Difference between reduce() and collect()?
  6. How Optional avoids NullPointerException?
  7. Anti-patterns of Optional?
  8. Exception handling in lambda expressions?
  9. Exception handling in streams?
  10. How to debug stream pipelines?
  11. Performance comparison: stream vs loop?
  12. When streams should be avoided?
  13. CompletableFuture introduction?
  14. Difference between Future and CompletableFuture?
  15. What is thenApply()?
  16. What is thenAccept()?
  17. What is thenCombine()?
  18. What is async execution in Java 8?
  19. What is Nashorn JavaScript engine?
  20. Use cases of Nashorn?
  21. Best practices for lambda expressions?
  22. Best practices for Stream API?
  23. Java 8 real-time project use cases?
  24. Common Java 8 interview traps?
  25. Java 8 coding round expectations?

Related Topics


   Functional Interfaces   
   Lambda Expressions   
   Stream API   
   Built-in Functional Interfaces   
   Optional Class   
   Default Method