Convolutional Neural Networks (CNN) — ML Technical Interview Questions & Answers

Networks specialised for image-like grid data.

Convolutional Neural Networks (CNN)

  • Simple meaning: A CNN is a net for grid data (photos). Convolution = a small filter slides and picks edges, then textures, then parts of objects. Fewer weights than a giant dense net on every pixel.
  • Picture: 28×28 digit. Filters find strokes. Pooling shrinks the map. Dense layers at the end say 0–9.
  • Used for images, sometimes spectrograms. Not the first tool for a 6-column marks CSV.
  • Trap: flattening a photo into 10,000 features and only using logistic without saying CNN exists. Trap: calling every net a CNN.

Technical Interview Tip: Sliding filters on photos. Edges → parts → label.

Code Examples for Convolutional Neural Networks (CNN)

Convolutional Neural Networks (CNN) — working example

# PCA-style intuition: project 2D → 1D by a direction vector
points = [(1.0, 1.0), (2.0, 2.0), (3.0, 2.8)]
# unit direction along y = x
ux, uy = 0.7071, 0.7071
proj = [x * ux + y * uy for x, y in points]
print([round(v, 3) for v in proj])

# Tiny ensemble: average two model votes
votes = [1, 0, 1]
v2 = [1, 1, 1]
ens = [1 if a + b >= 2 else 0 for a, b in zip(v1, v2)]
print(ens)

Convolutional Neural Networks (CNN) — dim reduction compresses features; ensembles combine models; deep nets/RL/NLP are specialized families — practice the core math idea first.

How to Explain Convolutional Neural Networks (CNN) to an Interviewer

Why CNN for images?

Local patterns Shared filters Fewer weights than dense-on-pixels

Pooling does what?

Shrinks the map Keeps strong responses