General facts about C, C++, Java, Python
Core language
- What are the types in C, Java, C++, and Perl? How many bits does it take
to represent the basic types? - What do floating point numbers look like in
memory? Specifically, how many bits are there in a double and
what sequence to the bits appear in? - What is twos-complement notation?
- How would you implement a bit array class?
- Does the check x == x + 1 always return false for integer x?
- What does a C struct look like in memory? What does a C++
object look like in memory? What does a Java object look like in
memory? - What is the difference between an interpreted and a compiled language?
- What is garbage collection?
- How would you determine if call stack grows up or down relative
to memory addresses? - Give an example of a memory leak in Java.
- What is tail recursion? How can it be removed automatically?
- Is the natural recursive program for computing n! tail recursive?
- Your manager reads an online article that says it is 10X faster to code in Python than in C++. He wants you to code exclusively in Python from now on. What would you say to him?
- What does an executable look like as a sequence of bytes?
Libraries
A programmer who regularly implements complex algorithms such as KMP
string matching or the Dijkstra shortest path computation quickly
will not advance very far. Solutions to such problems are well-known and have
high quality, thoroughly tested, and debugged implementations, often
available as open source. Programmers should know and use these libraries.
- Give an example of a function which is in the C standard library.
- Give an example of a commonly used function which is not in the C standard library.
- What library would you use to determine the current date in Java?
- What library would you use in Java if you had to implement a tinyurl service?
- How does STL implement sets?
- How does the library code compute trigonometric functions?
- The strtok(char s1, char s2) function in the C standard library successively returns occurrences of the characters in s2 in string s1; it returns null if there are no more occurrences.
- What makes this a dangerous function to use in a multithreaded program?
Programming language implementation
- Give an example of a language which cannot be parsed by any computer.
- What problems does dynamic linkage solve? What problems does it introduce?
- What is a functional language?
- What is a virtual function?
- How is method dispatch implemented in Java?
- What is automatic garbage collection and how is it implemented?
- What is a type-safe language?
- What is the difference between a lexer and a parser?
- Give an example of a language which cannot be recognized by a lexer.
- Give an example of a language which cannot be parsed by a parser.