Sample Assignments This is a sample of assignments I have written for various courses. Permission is granted to use the material as long as all copyright notices are maintained. If you use any of the material, I would appreciate hearing from you about your experiences and hear about any enhancements you did or would like to see. Contact me (fsieker AT cs.colostate.edu) for information on solutions. Each assignment consists of provided code files which the students may read, but not modify and code file(s) where they do the implementation. This structure makes it easy for the students to start with a "compilable" assignment with empty implementations generated by the IDE. The structure is designed to allow incremental development and easy testing with different test cases without the need to write explicit test code. The structure fits well with the automated grading tools I wrote, although those tools do not depend on this structure. A substantial portion of the documentation for each assignment comes from javadoc or html pages generated by doxyden. Simple printf() debugging framework This simple framework has implementations in Java, C and C++ and presents an easy interface to introduce debugging output into code and turn it on/off at runtime. It is used in a variety of assignments. Java Assignments This is a sample of Java assignments used in a second semester programming class taught at CSU. The assumption is that the students are familiar with basic Java coding including loops, arrays, static/non-static methods and variables, interfaces, simple objects and some simple data structures such as ArrayLists. Shell.java. This is not an assignment per se, but a base class that other assignments extend. It was designed to make writing and testing of assignments easier, by providing a simple scripting interface to individual methods of an assignment. Here is the javadoc. Warmup Exercises This assignment verifies the students can do basic Java programming. Decomposition, constructors and More ... This assignment has the students implement a class that represents an instance in time. It requires them to parse a human readable date/time and turn it into the internal representation. The toString() method is overloaded to produce multiple output formats. Recursion Exercises This assignment consists of a variety of recursive methods. Solutions to some methods use other recursive methods. A directory listing method demonstrates indirect recursion. Spreadsheet with GUI in Java This is actually a series of assignments which had the students build a spreadsheet with formula evaluation. It has been used several times in the Data Structures class. C/LC3 Assembly Language Assignments These assignments were written for CS270. This course combines C programming, hardware (gates and circuits) and LC3 assembly language. It is taught using the book A Introduction To Computing Systems by Patt and Patel. At CSU, this course is taken at the sophomore level and students have experience with Java programming. Therefore, the C programs are designed to emphasize features they have not likely seen in Java. Students are expected to be able to write programs with declarations, loops, conditionals, methods, etc. that are implemented in multiple files. Each assignment includes a driver test program, header file(s) containing the documentation of the functions they need to write and a skeleton of a .c file that the student must complete. LC3 tools used at CSU This link provides access to the versions of the LC3 tools used at CSU. Students may download this code to execute on personal machines. Code for Linux and OS-X are provided. It contains binary versions of the implementations of the LC3 simulator, assembler and disassembler programming assignments described below. A single compile is required to make the simulator functional. Radix Conversion in C This assignment To convert between the binary representation and external representation of numbers in various bases. It is a simple warm-up C exercise. The conversion of a number to its external representation requires a recursive solution. Number Conversion in C This assignment To convert between the binary representation and external representation of numbers in various bases. It is a simple warm-up C exercise. The conversion of a number to its external representation requires a recursive solution. This is quite similar to the RADIX assignment, but uses Strings as in the input to the conversion routines. It also has a simple use of pointers. Bit Fields in C This assignment teaches the student to use bit masks and binary-and and binary-or. The assignment is reused in the Floating Point Math, LC3 Assembler and LC3Simulator assignments. The intent was to have an assignment that was reused over the semester. This assignment is no longer used. When it was reused in the floating point, assembler and simulator assignments, most all of the parameters to calls were constants known at compile time. It is just as easy to write inline C code for those calculations. Eliminating this as a stand alone assignment, frees up the time for other assignments. Floating Point Math1 This assignment about the bit representation of floating point numbers and how to perform several operations without using C's float or double types. It builds on the Bit Fields assignment. An alternative is to have the students do the basic bit manipulations required for this assignment directly in the code and not use the Bit Field assignment. This assignment then serves double duty teaching both basic bit manipulation and concepts of floating point math. Floating Point Math2 This assignment about the bit representation of floating point numbers and how to perform several operations without using C's float or double types. Unlike the other float assignment, this assignment does NOT build on the Bit Fields assignment. Rather, the students do the basic bit manipulations required for this assignment directly in the code. Thus, it teaches both the representation of a floating point number and some bit manipulation functions. The assignment may do either 16 or 32 bit math depending on how it is compiled. If the 16 bit representation is used, the resulting program becomes an oracle for the LC3 assembly version. Print a number in a specified base using recursion (C) This simple assignment is a very brief introduction to pointers in C. The assignment uses recursion and introduces the C address-of operator (&) and dereference operator (*). It is designed to serve as a reference when writing the same functionality in the LC3 assembly language. Implementing String functions (LC3) This assignment has the students implement a set of string functions ( strlen(), strcpy(), strcat(), ...) in LC3 assembley language. This gives the students additional practice in LC3 loops and conditions and reinforces their understanding how C stores and manipulates strings. The assignment uses nested subroutine calls, so the students must save and restore return addresses correctly. The assignment uses registers to pass and return values, thus illustrating another method of communicating between the caller and callee. Print a number in a specified base using recursion (LC3) This assignment follows the previous one, but the implementation is in LC3 assembly language. In this assignment the students use a stack protocol for communicating parameters and return values between the caller and callee. The students learn how parameters and locals are allocated and assigned values. After completing the assignment, the student should understand how a compiler generates code for function calls. They also learn that a recursive call is really no different than any other function call. LC3 Assembler Utilities This short assignment teaches the students about C structs and initializing them at compile time. The students are also introduced to simple character scanning to determine if a C string is a valid LC3 label. This code is reused in the LC3 assembler project. Symbol Table This assignment teaches the students about dynamic memory management. The assignment is reused in the Assembler and Simulator assignments. The students implement a symbol table with a hash table that uses chaining for collisions. The hash function is provided. Valgrind is used to check for memory leaks. LC3 Assembler This assignment has the students complete an LC3 assembler. It uses the Bit Fields (optional) and Symbol Table assignments. Other portions are provided to the students as an archive library. The students write code to parse the assembly code, build a symbol table and produce an object file and symbol file for use by the simulator. LC3 Simulator This assignment has the students complete an LC3 simulator. It uses the Bit Fields (optional) and Symbol Table assignments. Other portions are provided to the students as an archive library. The students write code to decode and execute LC3 object code. The end result is a simulator that exactly matches the simulator they use for the LC3 assembly assignments. It includes a GUI to execute and debug the LC3 code. It is based on a customized version of the tools provided with the book. The code was refactored into pieces that were suitable as programming assignments at the sophomore level at CSU. Operating System Assignments These Java assignments are designed to illustrate some of the interesting topics in operating system in a language that has concurrency build in. The first two assignments deal with race conditions and synchronizing access to shared data structures. The next assignments build a simple operating system and file system and build on the concurrency concepts from the first two assignments. (c) Fritz Sieker 2015 (fsieker AT cs.colostate.edu)