C++ Problem Solving
by Curtis Krauskopf
Computer programs are designed to solve problems. These programs test your
ability to solve problems. The programs are small enough that they can be
done on paper with the interviewer.
- Find the number of bits in an unsigned integer data
type without using the sizeof() function.
- Multiply an integer by 8 without using multiplication or addition.
- Write a function that adds two signed integers and checks for overflow.
When an overflow is detected, cause an appropriate exception to be thrown.
- Write a program that counts the number of 'x' characters in an input stream. Assume the stream is binary.
- Write a program that detects if a text file is in
Windows format (CR followed by LF) or in Unix/Linux
format (CR) or in Mac format (LF). For this problem,
it's okay to assume that all lines in the text file
terminate the same way.