Boundary-Fill and Flood-Fill in Computer Graphics MCQ Questions and Answers
1. The primary goal of Flood-Fill and Boundary-Fill algorithms is to
A) Trace polygon outlines
B) Compress images
C) Fill a connected region with a specified color
D) Compute polygon normals
Answer: C
2. Boundary-Fill stops filling when it reaches a pixel with the
A) Target color
B) Boundary color
C) Replacement color
D) Background color
Answer: B
3. Flood-Fill (seed fill) typically replaces all pixels of a given
A) Boundary color
B) Target color (original region color)
C) Any color different from replacement
D) Transparent color only
Answer: B
4. In a 4-connected flood-fill, the neighbors checked are
A) All 8 neighbors (including diagonals)
B) North, South, East, West
C) Only diagonal neighbors
D) None of the above
Answer: B
5. In an 8-connected flood-fill, the neighbors include
A) Only N, S, E, W
B) Only diagonals
C) N, S, E, W plus the 4 diagonal neighbors
D) Only farther-than-one neighbors
Answer: C
6. The boundary-fill algorithm is best used when the region is defined by a clearly visible
A) Target color
B) Boundary color
C) Replacement color
D) Edge detection filter
Answer: B
7. The flood-fill algorithm requires which initial input from the user?
A) Boundary color only
B) Seed point and replacement color (and implicitly target color)
C) Entire polygon vertices
D) A scan-line list
Answer: B
8. Which fill method can incorrectly leak outside intended area if boundary is broken (has gaps)?
A) Scan-line fill only
B) Boundary-fill
C) Parametric fill
D) Edge fill
Answer: B
9. Flood-fill differs from boundary-fill because flood-fill checks for
A) Boundary color only
B) Target color to be replaced
C) Vertex positions
D) Edge crossings
Answer: B
10. The recursive flood-fill algorithm is implemented commonly using which traversal approach?
A) Breadth-first search (BFS) by default
B) Depth-first search (DFS) via recursion stack
C) Dijkstra’s algorithm
D) Kruskal’s algorithm
Answer: B
11. Which iterative structure implements flood-fill in a BFS manner?
A) Stack (LIFO)
B) Queue (FIFO)
C) Priority queue
D) Set
Answer: B
12. Which iterative structure implements flood-fill in a DFS manner?
A) Queue (FIFO)
B) Stack (LIFO)
C) Heap
D) Graph
Answer: B
13. Worst-case time complexity of flood-fill for a region with N pixels is typically
A) O(log N)
B) O(1)
C) O(N)
D) O(N²)
Answer: C
14. Worst-case space (stack) complexity of a naive recursive flood-fill may be
A) O(log N)
B) O(N) (leading to stack overflow for large N)
C) O(1)
D) O(N²)
Answer: B
15. Which strategy avoids recursion depth problems when implementing flood-fill?
A) Always using recursion anyway
B) Use an explicit stack or queue (iterative implementation)
C) Use floating arithmetic
D) Use scan-conversion only
Answer: B
16. The scanline seed-fill algorithm fills by processing
A) Columns of pixels
B) Horizontal spans (scanlines) to reduce redundant checks
C) Diagonal lines only
D) Individual pixels randomly
Answer: B
17. The scanline approach generally improves performance by
A) Increasing recursion
B) Filling entire horizontal spans and avoiding repeated neighbor pushes
C) Using more memory for each pixel
D) Using trigonometry
Answer: B
18. A boundary color equal to the replacement color will cause boundary-fill to
A) Work normally
B) Fail to fill anything (immediate stop)
C) Fill infinitely
D) Flip colors alternately
Answer: B
19. For flood-fill, if the seed pixel’s color already equals the replacement color, a correct implementation should
A) Continue filling regardless
B) Do nothing (early exit)
C) Change boundary color instead
D) Throw an error
Answer: B
20. Which of these is a classic application of fill algorithms?
A) Vertex shading
B) Ray tracing only
C) Filling regions in paint programs (bucket tool)
D) 3D model triangulation
Answer: C
21. Boundary-fill and flood-fill are examples of which class of algorithms?
A) Sorting algorithms
B) Region filling / graph traversal algorithms
C) Compression algorithms
D) Interpolation algorithms
Answer: B
22. In a typical pixel grid, flood-fill treats the image as what kind of structure for traversal?
A) Tree
B) Graph of connected pixels
C) Binary heap
D) Continuous function
Answer: B
23. A disadvantage of naive flood-fill in large images is
A) It’s always faster than scanline
B) High memory usage and stack overflow risk
C) It always produces aliasing
D) It cannot fill concave regions
Answer: B
24. Boundary-fill is particularly appropriate when the region boundary color is known and
A) Boundary has gaps
B) Boundary forms a closed loop with no gaps
C) Region is unbounded
D) Target color is unknown
Answer: B
25. The four-connected flood-fill might leave diagonal holes in a region that should be connected; to avoid this one should use
A) 2-connected filling
B) 8-connected flood-fill
C) 3-connected filling
D) No change — holes are correct
Answer: B
26. In image processing, flood-fill can be used for segmentation by replacing pixels of a target color with a label; this operation is commonly called
A) Edge detection
B) Region labeling
C) Histogram equalization
D) Morphological erosion
Answer: B
27. When using boundary-fill, it is essential to compare pixel color for equality; in practice for anti-aliased images you may prefer to compare using
A) Exact equality always
B) A tolerance (color distance threshold)
C) Only alpha channel
D) Pixel index only
Answer: B
28. Which variant will reduce the number of push/pop operations in seed-fill?
A) Pure recursive pixel-based fill
B) Scanline seed-fill (span fill)
C) Randomized fill
D) Vertex-based fill
Answer: B
29. A typical problem when implementing recursive boundary-fill on a limited stack environment is
A) It is too memory efficient
B) Stack overflow for large connected regions
C) Inability to find boundaries
D) Infinite loops that never terminate in correct code
Answer: B
30. The difference between 4- and 8-connected fills affects the topology; using 4-connected for fill and 8-connected for boundary tests (or vice versa) can cause
A) Faster execution always
B) Ambiguities and potential holes or overfills
C) No change at all
D) Immediate termination
Answer: B
31. The replacement color in flood-fill is the color that will
A) Serve as the stopping boundary
B) Replace the region’s original (target) color
C) Be ignored
D) Be used as seed only
Answer: B
32. In boundary-fill, the test before filling a pixel is typically whether the pixel color is not equal to the boundary color and not already the replacement color. True or false?
A) False — only boundary color tested
B) True
C) False — only replacement color tested
D) It depends on scanline only
Answer: B
33. Flood-fill implemented with a stack (DFS) will explore region in which order relative to BFS?
A) Same order as BFS
B) Different order — DFS explores depth-first while BFS explores breadth-first
C) Random order
D) Sorted by pixel coordinates
Answer: B
34. The fill algorithms operate on which pixel-level concept?
A) Vector primitives
B) Raster pixels (discrete grid)
C) Triangles only
D) Control points
Answer: B
35. The scanline seed-fill approach handles horizontal spans by storing left and right boundaries and filling between them; this reduces which cost compared to pixel-by-pixel recursion?
A) Color depth
B) Number of function calls and repeated neighbor checks
C) Number of vertices
D) Memory for ET only
Answer: B
36. Which technique is commonly used to avoid infinite recursion in boundary-fill when boundary color equals replacement color?
A) No check needed
B) Early test: if replacement color == boundary color, return/do nothing
C) Use bigger stacks
D) Fill outside region first
Answer: B
37. In most implementations, the pixel color comparisons in flood-fill should include tests for
A) Only red channel
B) All relevant channels (e.g., RGB, plus alpha if present)
C) Only blue channel
D) Only brightness
Answer: B
38. For images with multiple nested regions (holes), flood-fill from a seed point in inner hole will fill which region?
A) Entire image
B) The connected component containing the seed (the hole if seed is inside it)
C) Outer region always
D) Only boundary pixels
Answer: B
39. Stack-based iterative flood-fill is generally preferred over recursion in production code because it
A) Is always slower
B) Avoids recursion limits and is more controllable
C) Uses more stack frames implicitly
D) Requires trigonometry
Answer: B
40. The typical stopping condition in recursive flood-fill pseudo-code is: if current pixel color ≠ target color then return. True or false?
A) False — return when equal
B) True
C) False — always fill regardless
D) It depends on connectivity only
Answer: B
41. Boundary-fill algorithms may require special handling at vertices to avoid which artifact?
A) Color inversion
B) Double-filling or omission of pixels at vertices
C) Increased brightness
D) Color compression
Answer: B
42. Flood-fill is used in vector graphics?
A) No — only in raster pipelines
B) Yes — when vector graphics are rasterized for filling regions
C) Only to draw outlines
D) For triangulation only
Answer: B
43. A common optimization for iterative flood-fill is to process contiguous horizontal runs using run-length logic; this method is called
A) Boundary-run fill
B) Span (or scanline) flood-fill
C) Vertex run-length
D) Pixel-run fill
Answer: B
44. In 8-connected flood-fill, diagonal connectivity can cause two separate regions under 4-connectivity to be considered connected — this is called
A) Diagonal suppression
B) Connectivity difference (topological change)
C) Pixel leakage only
D) Flood inversion
Answer: B
45. For large-scale images, a good practice before running flood-fill is to first check the area estimate (e.g., bounding box) because flood-fill could otherwise
A) Fail instantly
B) Consume a lot of time/memory filling unexpectedly large regions
C) Only fill edges
D) Ignore corners
Answer: B
46. Flood-fill and boundary-fill are both capable of handling multiple colors by running multiple fills with different seeds — true or false?
A) False — only one color supported at a time
B) True
C) False — boundary-fill cannot be repeated
D) Only when colors are gradients
Answer: B
47. The algorithm that fills until it hits a boundary color is called
A) Flood-fill
B) Boundary-fill
C) Scanline fill only
D) Vertex fill
Answer: B
48. The iterative stack-based flood-fill pushes neighbor pixels to stack only if they
A) Have replacement color already
B) Match target color and are not yet processed
C) Are boundary pixels only
D) Are outside image bounds
Answer: B
49. Which of these is NOT a recommended improvement to naive recursive fill?
A) Use iterative stack/queue
B) Use span filling
C) Remove boundary checks entirely
D) Use color tolerance for anti-aliased edges
Answer: C
50. In some implementations, flood-fill tracks visited pixels with a separate boolean array to avoid revisiting; this costs extra memory but reduces
A) False positives only
B) Repeated processing of the same pixel
C) Color depth
D) Number of edges
Answer: B
51. The seed used in seed-fill must be chosen inside the region; if chosen on boundary, behavior depends on algorithm but typically
A) Always fills correctly
B) May not fill or may immediately stop
C) Fills outside region only
D) Throws runtime error
Answer: B
52. Flood-fill on images with alpha channel must consider alpha in comparisons if goal is to preserve
A) Memory usage
B) Transparent vs opaque separation (treating alpha in target comparisons)
C) Only RGB channels always
D) Only hue channel
Answer: B
53. Which property is shared between scanline fill and span-based flood-fill?
A) They both use recursion only
B) Both operate on horizontal spans to reduce redundant pixel checks
C) Both require boundary color only
D) Both are vertex-based methods
Answer: B
54. In boundary-fill, filling in a pixel occurs only if pixel color is neither boundary color nor replacement color; this prevents which problem?
A) Faster filling
B) Infinite looping / re-filling
C) Incorrect gradient
D) Missing pixels in center
Answer: B
55. The flood-fill algorithm is often used in games for which purpose?
A) Polygon triangulation
B) Area marking (e.g., reveal map regions, paint-fill tools)
C) Vertex lighting
D) Audio sampling
Answer: B
56. Flood-fill may be adapted to work on continuous-tone images using what modification?
A) Exact equality only
B) Color tolerance matching (fuzzy flood-fill)
C) No changes possible
D) Using only alpha channel
Answer: B
57. When implementing iterative flood-fill, it is important to check image bounds before pushing neighbor coordinates to stack/queue — omission leads to
A) Faster code
B) Out-of-bounds memory access (segmentation fault)
C) Automatic clipping
D) No effect
Answer: B
58. In boundary-fill, if multiple nested boundaries exist, running boundary-fill from outside will fill which region?
A) Inner holes only
B) Region bounded by the first encountered boundary from the seed
C) Entire image only
D) All boundaries simultaneously
Answer: B
59. The seed point used for flood-fill algorithm is often referred to as the
A) Target pixel
B) Seed pixel
C) Boundary pixel
D) Replacement pixel
Answer: B
60. If a region is very large and memory is limited, a recommended approach is to use which fill method?
A) Naive recursion
B) Scanline/span-based iterative fill
C) Repeated random seeds
D) Floating-point DDA fill
Answer: B
61. The difference between boundary-fill and edge-fill is that boundary-fill fills until it finds boundary color while edge-fill typically refers to
A) Filling entire image only
B) Drawing only the boundary/outline of a shape
C) Flooding neighbor edges only
D) Filling with gradient along an edge
Answer: B
62. Flood-fill is often implemented in graphics libraries behind tools called
A) Line tool
B) Paint bucket tool
C) Pen tool only
D) Zoom tool
Answer: B
63. While performing flood-fill with a stack, the pattern of pixel visitation will depend on the order you push neighbors; to implement BFS-like behavior with a stack, you should instead use
A) Another stack with reverse order
B) A queue (FIFO) for true BFS
C) A hash map only
D) A priority queue only
Answer: B
64. For correct handling of polygon boundaries when using flood-fill, the polygon must be rasterized with which convention to avoid gaps?
A) Random pixel rules
B) Standard top-left or top-inclusive rasterization convention
C) Bottom-right only
D) No convention needed
Answer: B
65. When filling complex shapes, dividing the region into smaller blocks and filling them separately may reduce memory usage at the cost of
A) Accuracy only
B) Increased implementation complexity and possible performance cost
C) Always faster performance
D) Removing need for seed points
Answer: B
66. If you encounter performance issues with repeated fill operations, what strategy may help?
A) Always use recursion regardless
B) Cache filled regions or use spatial indexes to avoid full re-fills
C) Increase color depth
D) Disable GPU acceleration
Answer: B
67. In boundary-fill, when implementing on antialiased images, which approach reduces wrong stops at soft edges?
A) Exact equality only
B) Use a color tolerance or alpha threshold
C) Convert to indexed color only
D) Ignore boundary color entirely
Answer: B
68. If replacement color has same RGB as boundary color due to a bug, the boundary-fill will
A) Fill correctly anyway
B) Not progress because it sees boundary immediately and stops
C) Convert boundary to black
D) Crash program
Answer: B
69. Flood-fill can be used for morphological operations (like region filling) as part of preprocessing in which higher-level tasks?
A) Sorting arrays
B) Object recognition and segmentation
C) Audio filtering
D) Shader compilation
Answer: B
70. Which of the following is a correct pseudo-code check used at start of flood-fill for early exit?
A) if seed is null then continue
B) if target_color == replacement_color return
C) if image empty then push seed
D) if seed color != boundary color then return
Answer: B
71. In some GUI toolkits, flood-fill is accelerated on GPU by using which primitive?
A) Triangle stripping only
B) Using stencil buffer or fragment shaders to perform region fills
C) Using CPU only always
D) Vertex arrays only
Answer: B
72. A fill algorithm that expands outward from seed in concentric layers is most similar to which graph traversal?
A) Depth-first search (DFS)
B) Breadth-first search (BFS)
C) Best-first search
D) Random walk
Answer: B
73. When using iterative stack flood-fill, it is often beneficial to push only one neighbor direction first to minimize stack growth; this is a heuristic to approximate which traversal?
A) Randomized search
B) Depth-first search (reduces simultaneous active entries)
C) Breadth-first search
D) Best-first search
Answer: B
74. Flood-fill in a binary image (two colors) used for connected component labeling can be implemented by repeatedly using seed-fill until all components are labeled. True or false?
A) False — impossible
B) True
C) Only if image is small
D) Only on GPU
Answer: B
75. When filling in 8-connected mode, you must be careful about which of these to maintain connectivity semantics?
A) Pixel brightness only
B) The order of neighbor checks and whether you mark visited before pushing neighbors
C) Color palette order only
D) Window coordinates only
Answer: B
76. The flood-fill algorithm can be implemented using recursion or an explicit stack; which choice has more predictable memory usage?
A) Recursion always
B) Explicit stack (iterative)
C) Neither — both unpredictable
D) Both use constant memory
Answer: B
77. Which condition would you check to avoid reprocessing a pixel in an iterative fill?
A) Is pixel black?
B) Has pixel been visited/marked or does it already have replacement color?
C) Is pixel in top-left?
D) Is pixel a seed?
Answer: B
78. In boundary-fill, filling stops when a pixel equals boundary color. To prevent painting over boundary due to floating rounding, you might want to perform comparisons in
A) Only integer X coordinates
B) Color space with tolerance or fixed-point comparisons
C) Vertex coordinate system only
D) Shader registers only
Answer: B
79. Which method can be used to fill non-simple or self-intersecting polygons safely?
A) Naive boundary-fill only
B) Preprocess polygon to remove self-intersections or use even-odd / nonzero winding rules + scanline
C) Flood-fill with no checks
D) Ignore polygon and fill background
Answer: B
80. The scanline span flood-fill reduces stack operations by grouping consecutive pixels horizontally; how does it detect span ends?
A) By fixed length only
B) By scanning left/right until pixel color differs from target or boundary encountered
C) By using vertex angles only
D) By color inversion
Answer: B
81. If you want to preserve sub-pixel antialiasing while filling, best practice is to operate on which representation?
A) Indexed color only
B) Linear (floating point) color buffers and apply tolerance/coverage-aware sampling
C) Compressed JPEG only
D) Greyscale only
Answer: B
82. Which of the following is true about recursive boundary-fill on fractal-like regions?
A) Always constant memory
B) May lead to extremely deep recursion and stack overflow
C) Runs in constant time
D) No special handling needed
Answer: B
83. A fill algorithm that labels regions for later lookup should typically store which metadata per region?
A) Only color
B) Region id, bounding box, pixel count
C) Vertex normals only
D) Edge slopes only
Answer: B
84. In some cases, flood-fill can be accelerated by multi-threading across disjoint regions; the main challenge is to ensure threads do not
A) Run too fast
B) Overlap writes to same pixels without synchronization
C) Use too many colors
D) Only read pixels
Answer: B
85. A hybrid filling approach uses scanline for coarse spans and then per-pixel checks near complex boundaries; this trades off between
A) Color palette changes only
B) Speed and boundary accuracy (performance vs precision)
C) Memory size only
D) Pixel format only
Answer: B
86. Which of the following is FALSE about boundary-fill?
A) It requires a known boundary color
B) It always uses less memory than scanline fill
C) It can leak if boundary has gaps
D) It’s conceptually simple and easy to implement recursively
Answer: B
87. In practice, which is more commonly used in modern paint programs for the “bucket fill” due to performance and robustness?
A) Pure recursive boundary-fill
B) Iterative span-based flood-fill
C) Random-fill algorithm
D) Vertex-based color fill
Answer: B
88. Flood-fill applied to greyscale images with small noise may cause overfills; to avoid this you should use
A) Exact color match only
B) Color tolerance or pre-smoothing (denoising)
C) Increased recursion depth
D) Ignore grayscale values
Answer: B
89. If the image uses indexed colors and the palette is small, flood-fill may be very fast because comparisons are done by
A) Floating comparisons
B) Integer palette indices (cheap equality checks)
C) Hashing strings
D) Trigonometric tests
Answer: B
90. When designing flood-fill for very large images, which file/system technique may be used to avoid loading entire image into RAM?
A) Always load full image
B) Tiled or chunked processing with on-disk caching
C) Use recursion only
D) Convert to vector graphics first
Answer: B
91. Flood-fill that checks and updates neighbor pixels in-place must ensure to mark pixels as visited before pushing neighbors; otherwise it may
A) Run faster always
B) Push the same pixel multiple times causing redundant processing
C) Avoid filling interior
D) Fill only boundary
Answer: B
92. In graphics exam questions, flood-fill and boundary-fill differences are often tested using examples where boundary color equals target color; the correct handling is to
A) Ignore the case
B) Detect and early-exit (no-op) to avoid incorrect results
C) Throw exception always
D) Invert colors instead
Answer: B
93. Which data structure is ideal to retrieve next pixel to process in BFS flood-fill?
A) Stack
B) Queue
C) Priority queue
D) Balanced tree
Answer: B
94. The classic recursive four-way boundary-fill pseudo-code calls the function for each neighbor after setting pixel color; the order of neighbor calls affects only the traversal order, not final filled set. True or false?
A) False — final set differs for DFS vs BFS only
B) True — final filled set is the same (for deterministic comparisons), only visiting order differs
C) False — result always random
D) True only for convex polygons
Answer: B
95. A flood-fill that uses a stack but pushes neighbors in random order will produce correct fill but may have different memory patterns; correctness is unaffected as long as which is true?
A) Stack capacity infinite
B) Neighbors are pushed only when they match target and are unvisited
C) Neighbors are always pushed even if visited
D) Boundary color is unknown
Answer: B
96. The replacement color in flood-fill should typically be applied when marking visited to prevent which issue?
A) Increased speed only
B) Re-pushing the same pixel multiple times (duplicate work)
C) Color blending problems only
D) Memory leaks only
Answer: B
97. To reduce cache misses during large fills, an implementation may prefer which scan order?
A) Random pixel order
B) Locality-friendly order such as scanline spans (left-to-right, top-to-bottom)
C) Jumping across image
D) Diagonal zig-zag always
Answer: B
98. If you want to fill only pixels within a tolerance of color C (e.g., within Euclidean distance in RGB space), you must compute which per pixel?
A) Vertex coordinates
B) Color distance between pixel color and C
C) Number of neighbors only
D) Pixel index only
Answer: B
99. Flood-fill algorithms are sometimes used in CAD/GIS applications for region filling — a critical requirement in those domains is to ensure fills are reproducible and deterministic; this is achieved by using
A) Random seeds every run
B) Deterministic traversal order and consistent color/comparison rules
C) Different algorithms per run
D) Floating-point randomness
Answer: B
100. The final step after a flood-fill completes in many interactive applications is to
A) Immediately quit program
B) Update the display / refresh the area, and possibly merge undo history entry
C) Rebuild the entire image from scratch
D) Delete boundary data
Answer: B
