Skip to content
Tech Interview Prep
Technical interview guide

Sequence Alignment (Needleman-Wunsch, Smith-Waterman, BLAST)

The algorithms for comparing DNA, RNA, and protein sequences: global vs. local alignment, and the heuristics that make searching billions of bases practical.

Read
47 min
Practice MCQs
25
Interview Q&A
25
Edition
v7
Editorial status
Reviewed

Scope: Needleman-Wunsch and Smith-Waterman algorithms; NCBI BLAST+ documentation and statistical guidance; BLOSUM and PAM source publications reviewed 2026-09-04.

Curated: · Written: · Reviewed:

25 questions

MCQ-3A team aligns two protein sequences of lengths 4 and 3 with Needleman-Wunsch using match = +2, mismatch = -1, gap = -2, and fills the DP table row by row starting from the top-left cell (0,0). After the fill, they read the value in the bottom-right cell and get a number. Which value do they read?
MCQ-24A Needleman–Wunsch implementation scores matches +2, mismatches −1 and gaps −2. On the pair `ACG` and `ATCG` it returns the alignment `ACG-` / `ATCG` with a reported score of 4, which matches the trusted reference implementation's score for that pair. The team's test suite asserts only that the reported score equals the reference score, and it passes. Which additional assertion would have failed on this output?
MCQ-5A team's recursive pairwise aligner implements the Needleman–Wunsch recurrence with no memoization. Aligning two sequences of length 30 and 40, instrumentation reports that the recursion requests only 1,271 distinct (i, j) prefix pairs but makes on the order of 10^22 calls before returning. Which conclusion does this measurement support?
MCQ-6A pipeline aligns two sequences of lengths 4,000 and 3,000 with Needleman-Wunsch using 4-byte integer scores. It only reports the optimal score; it never reconstructs the alignment. Which time and memory estimate is correct for this score-only run?
MCQ-7A pairwise aligner scores matches +2, mismatches -1, and uses an affine gap penalty with open cost 5 and extension cost 1. For a 100-residue protein pair, the optimal alignment contains a single 10-residue gap in one sequence. A teammate proposes switching to a linear gap penalty of 6 per gap position, arguing it is simpler and 'close enough'. Under the linear scheme, what is the total gap cost for this alignment, and how does it compare to the affine cost?
MCQ-8A 13-nt read, 5'-CGTACGTTTACGA-3', is aligned to a 14-nt reference, 5'-ACGTACGTTTACGT-3', with a semiglobal (glocal) aligner configured so that gaps at the reference's ends are free while the read must be consumed end to end. Scoring is match +1, mismatch −1, linear gap −2. What score does the aligner report?
MCQ-4A 120-residue query is aligned against a 900-residue multidomain protein with Needleman–Wunsch (BLOSUM62, gap open −11, gap extend −1). The global score is −214 and the alignment spans all 900 target residues, with the query's single 80-residue domain split by gaps. That domain's ungapped BLOSUM62 score against its target region is +180, and every residue outside it scores ≤0 against the query. The team reruns the same sequences and parameters with Smith–Waterman. Which outcome should they expect?
MCQ-2A pipeline aligns a 2,000 bp gene against a 200 bp EST using Needleman–Wunsch (match +1, mismatch −1, linear gap −2). The EST matches one 180 bp block in the middle of the gene and nothing else. The run reports a score of −3,500 and flags the pair as 'no significant similarity'. What does that score actually reflect?
MCQ-9You are inspecting a BLOSUM62-scored pairwise protein alignment. In one column, residue W in sequence A aligns to W in sequence B; BLOSUM62 gives that pair 11. In another column, W aligns to R; BLOSUM62 gives that pair -3. Both columns are in the same alignment with the same gap penalties. What do these two column scores say about the evidence for homology?
MCQ-10A team aligns 200 globin sequences spanning 22%–95% pairwise identity. With BLOSUM62, the most divergent pairs (below 30% identity) get low alignment scores and the downstream tree collapses those branches. They want higher scores for those divergent pairs without changing the aligner. Which change fits?
MCQ-11A 400-residue protein query is searched against a 5-million-residue protein database. Full Smith-Waterman takes hours; BLAST returns in seconds. Which mechanism accounts for the difference?
MCQ-12A team has a 320-residue protein from a well-annotated bacterium and wants to find its homologs in a newly assembled genome of a related species that has no gene models or annotation. The protein must be the query, and the genome's nucleotide sequence is the only search space available. Which BLAST program fits?
MCQ-23An engineer runs blastp against a protein database to find remote homologs that the default settings missed, then reruns the same database with the word size set to 2 instead of 3, leaving the score threshold, the extension cut-off and the gap costs unchanged. How does lowering the word size change search sensitivity and runtime, and through which mechanism?
MCQ-13A 300-residue protein query is searched with BLASTP against a 12-million-residue custom database. The top hit has bit score 145 and E-value 3e-12. The team re-runs the identical query, with the same scoring matrix and gap costs, against a 120-million-residue database, and the same alignment is found with the same bit score. Which E-value should the re-run report for that hit, and why?
MCQ-15A team re-runs the same BLASTP query against an updated protein database. The query, BLOSUM62 matrix, gap costs and top HSP are unchanged, the alignment still scores 120 bits, but the new release holds about twice as many residues, and the hit's E-value moves from 2e-30 to 4e-30. Which explanation accounts for the change?
MCQ-14A team runs two BLASTP searches for the same query. Search A uses BLOSUM62 with gap open 11, gap extend 1, and returns an HSP with raw score 120; its scoring system has hypothetical statistical parameters λ = 0.267 and K = 0.041. Search B uses BLOSUM80 with gap open 10, gap extend 1, and returns an HSP with raw score 150; its scoring system has hypothetical statistical parameters λ = 0.310 and K = 0.050. Both searches use the same database size. Which conclusion about the two HSPs is correct?
MCQ-22A clinical lab validates a variant-calling pipeline by re-running BLAST+ 2.13.0 `blastn` of a 250 bp amplicon against `nt`. Six months later a colleague re-runs the identical command with the same query file and the same BLAST+ binary, but the top hit for the amplicon changes from a 100% identity match to a 98% identity match, and the reported E-value rises from 1e-45 to 3e-30. The query file's checksum is unchanged and the BLAST+ version string is identical. What is the most likely explanation?
MCQ-18A BLASTP search of a 600-residue query against a protein database returns a top hit with exactly two HSPs: HSP-1 aligns query 1–300 to subject 1–300 on the plus strand (92% identity, bit score 610, E = 1e-150); HSP-2 aligns query 301–600 to subject 305–604 on the plus strand (90% identity, bit score 585, E = 1e-140). No other HSPs are reported for this subject. What is the correct reading of this output?
MCQ-16A team BLASTs a 1,200-residue human protein (query) against a protein database and gets a hit with 92% identity over an alignment of 40 residues, E-value 3e-9. They plan to annotate the query as a homolog of the hit and transfer the hit's enzymatic function. What does the alignment's coverage tell them about that plan?
MCQ-1A pipeline aligns a 410-residue query protein against a reference database using BLOSUM62 with gap open 11 and gap extend 1, low-complexity masking off, and reports the top hit as a local alignment covering 78% of the query at 31% identity. No E-value or bit-score threshold was applied. A reviewer asks what the alignment by itself licenses the team to state in the report. Which claim is defensible?
MCQ-17A 300-residue protein is searched with BLASTP against a 40-million-residue protein database. With the default SEG low-complexity filter on, 14 hits have E < 0.001. With SEG off, 1,900 hits have E < 0.001, and 1,850 of those align only to query residues 61-115, a stretch that is 71% proline and serine. The 14 filtered hits align across the full query length. What do the 1,850 hits indicate, and what should the team report?
MCQ-19A 430-residue query protein aligns to a characterised bacterial enzyme across 412 residues, with 293 identical positions and an E-value of 3e-58; searching the enzyme back against the query proteome returns the query as its best hit. The draft report line reads 'the query is 71% homologous to the enzyme'. A reviewer must replace that line. Which replacement is correct?
MCQ-20A pipeline calls one-to-one orthologs by reciprocal best BLASTP hit between two proteomes. In one family, species A retains only the member A2 and species B only the member B1: A2's best hit in B is B1 (E = 1e-140, 91% identity over 96% of both proteins) and B1's best hit in A is A2, so the pipeline reports A2-B1 as an ortholog pair. A family phylogeny built with two outgroup species roots the duplication node of this family below the A-B speciation node, and the copy that each lineage lost is absent from both assemblies. On this evidence, which statement about the A2-B1 pair is correct?
MCQ-21A team's read-alignment pipeline loads reads with a hand-written FASTA parser. For each record the parser takes the first whitespace-delimited token after the '>' as the record key and stores the record in a dict, so a key that repeats overwrites the earlier record. The input holds 5,000 reads exported by a tool that writes every header as '>run7 read0001', '>run7 read0002', and so on: the run name, a space, then the read name. The file also contains 40 records that are header-only (no sequence lines) and 12 records whose sequence lines contain lowercase 'n'. The run finishes without error, but variant calling reports a call rate near zero. How many records does the loader pass to the aligner?
MCQ-25A retrieval service logs the query text, the model name, the index name, and the top-1 document id with its cosine score for every query. Last month query Q returned doc 8811 at cosine 0.842. Today the same query returns doc 4402 at cosine 0.839. The document corpus, the index build parameters, the query-time search parameters and the application code are all unchanged, the index has not been rebuilt, and re-embedding Q with the current model and searching the current index reproduces 0.839 exactly. Which single addition to the log would let the team reproduce the 0.842 result?