Hack4Hack

Daily Coding Quiz: Saturday, 14 November 2026

All 10 coding questions with answers and explanations. 0 players took part.

  1. A queue built on a circular array of size k: what is the time to enqueue when it is not full?

    DSA · easy

    1. O(1)
    2. O(log k)
    3. O(k)
    4. Depends on the element

    Answer: A. O(1)

    Explanation: Write at the tail index and move it forward modulo k. Nothing shifts.

  2. In a min-heap, where is the smallest element?

    DSA · easy

    1. At a leaf
    2. At the root
    3. At the last index
    4. Anywhere

    Answer: B. At the root

    Explanation: Every parent is ≤ its children, so the minimum is always at the root (index 0 in the array form), readable in O(1).

  3. Which data structure follows Last In, First Out (LIFO)?

    DSA · easy

    1. Queue
    2. Stack
    3. Heap
    4. Linked list

    Answer: B. Stack

    Explanation: A stack pushes and pops from the same end, so the last item added is the first removed. A queue is FIFO.

  4. Why is data augmentation (flips, crops, colour jitter) used when training vision models?

    Computer Vision · easy

    1. To shrink the dataset
    2. To create realistic variations so the model generalises better
    3. To speed up inference
    4. To label images automatically

    Answer: B. To create realistic variations so the model generalises better

    Explanation: It teaches invariance (a cat flipped left-to-right is still a cat) and reduces overfitting. Choose augmentations that keep the label valid.

  5. How many values describe one pixel of a standard RGB image?

    Computer Vision · easy

    1. 1
    2. 3
    3. 4
    4. 8

    Answer: B. 3

    Explanation: Red, green and blue, usually each 0–255 (8 bits). RGBA adds a fourth alpha channel for transparency.

  6. Why does transfer learning from an ImageNet-pretrained CNN work well on a small custom dataset?

    Computer Vision · medium

    1. ImageNet contains every class
    2. Early and middle layers learn general features (edges, textures, shapes) that carry over, so only the top layers need much new data
    3. It removes the need for labels
    4. It makes the model smaller

    Answer: B. Early and middle layers learn general features (edges, textures, shapes) that carry over, so only the top layers need much new data

    Explanation: Freeze or slowly fine-tune the backbone and train a new head. You need far fewer labelled images than training from scratch.

  7. What is the difference between semantic and instance segmentation?

    Computer Vision · medium

    1. There is none
    2. Semantic labels each pixel’s class; instance also separates individual objects of the same class
    3. Instance only works on video
    4. Semantic segmentation draws boxes

    Answer: B. Semantic labels each pixel’s class; instance also separates individual objects of the same class

    Explanation: Semantic: all people pixels are “person”. Instance (e.g. Mask R-CNN): person 1, person 2 and person 3 get separate masks.

  8. A 32 × 32 input passes through a 5 × 5 convolution with stride 1 and no padding. What is the output size?

    Computer Vision · medium

    1. 32 × 32
    2. 28 × 28
    3. 27 × 27
    4. 30 × 30

    Answer: B. 28 × 28

    Explanation: Output = (N − K + 2P) / S + 1 = (32 − 5 + 0) / 1 + 1 = 28.

  9. How does CLIP learn to connect images and text?

    Computer Vision · hard

    1. By generating captions word by word
    2. With a contrastive objective: matching image–caption pairs get similar embeddings and mismatched pairs in the batch get dissimilar ones
    3. By training on ImageNet labels only
    4. With a diffusion loss

    Answer: B. With a contrastive objective: matching image–caption pairs get similar embeddings and mismatched pairs in the batch get dissimilar ones

    Explanation: Separate image and text encoders are trained on hundreds of millions of pairs. The shared embedding space enables zero-shot classification: compare an image with prompts like “a photo of a dog”.

  10. How does a Vision Transformer (ViT) feed an image to a Transformer?

    Computer Vision · hard

    1. Pixel by pixel as tokens
    2. It splits the image into fixed-size patches (e.g. 16 × 16), linearly embeds each one and adds position embeddings
    3. It runs a CNN and discards the result
    4. It converts the image into a caption first

    Answer: B. It splits the image into fixed-size patches (e.g. 16 × 16), linearly embeds each one and adds position embeddings

    Explanation: A 224 × 224 image gives (224/16)² = 196 patch tokens plus a [CLS] token. Without convolution’s built-in locality, ViTs need lots of data or pretraining.

Play the next Daily Quiz at 4 PM IST