Q: you have identical rows in a table. How do you clean it up?
%A: select into a new table, then overwrite the old, but this involves a lot of disk space and IO
%A: perhaps delete where (select count(*)…) > 1 and rowid > 1 — using oracle rowid
Q: given a long string of letters A-Z, print a histogram like A:865 times, B:9932 times….
Q: copy a vector to another vector. What if the source is very large? Correct — you get reallocation, so how do you avoid that?
%A: either reserve or initialize the target vector with sufficient capacity. However, the 2nd option default-constructs a large number of payload objects!
Q: when would you use private inheritance?
A: This is rarely needed or quizzed. Not on my Tier 1/2. [[effC++]] P204 has an example of MI and also an example of private inheritance — a public inheritance of a pure interface and also a private inheritance of a concrete class. However,
Google style guide strictly states that private inheritance should be replaced with composition.