Here are sample problems to test your knowledge of some of the course prerequisites. If you have trouble with them, you may want to do some review of these topics early in the course.
Design a circuit with three inputs:
and two outputs:
The circuit should be a priority encoder that outputs a 2-bit binary number corresponding to the lowest-numbered input that is active (logic "1"). In other words, the truth table is:
| INPUT1 | INPUT2 | INPUT3 | A1 | A0 |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 1 |
Sketch a Karnaugh map and logic diagram.
In "big O" notation, give the time complexity of the following operations, for each of the specified data structures:
| STL vector | STL list | STL map | Hash table | |
| Insert element (logically "at end") | ||||
| Insert element (logically "in middle") | ||||
| Find element matching a "key" value | ||||
| Delete element (logically "in middle") | ||||
| Access element by position or index (1, 2, ...) |
Write a C++ function with a prototype of:
unsigned int PrintStringList (const list<string>& strings);
The function should print to a file ("strings.txt") all the strings in the list, in the order they appear, one per line. The return value of the function should be the length (in characters) of the longest string in the list.
Write a subroutine in 68HC11 assembly language. On entry, the X register will hold the address of a NUL-terminated character string. Your subroutine should reverse the order of the characters in the string, leaving them in the same block of memory. All register values should be preserved across the call to your routine.
Write a make file to compile and link (using g++) a program consisting of three source files:
The executable file should be named main.
Assume the current directory contains the following files:
You then type the UNIX commands (assume no alias is declared for ls or grep.):
ls *.h* >junk.txt ls *.c* >>junk.txt grep 2 junk.txt | sort
What would you expect to find in the file junk.txt?
This page was last updated on November 29, 1998; send comments to Mark Sebern.