HW 1: What languages do you know?
Due Friday, Sep 10
Write down all of the programming languages you recall using. Use a broad definition of a programming languages as something that enables you to instruct a computer to complete a task automatically. For each language you recall, give a brief answer to each of the following questions.
- For what purpose did you use the language?
- How would you describe the syntax of the language?
- Was the language well-suited for the purpose? Why, why not?
- Could you write a program in the language right now without recourse to a textbook or manual? Why, why not?
HW 2: What languages do you want to know?
Due Monday, Sep 20
Pick three languages you do not yet know and write the equivalent of a Hello World program in each of them. Have it do something simple like print out the first ten terms of a Fibonacci series.
Do not just copy and paste an example from somewhere else. You won't learn anything. You are free to look at example programs in the language, but make sure you type up your own program from scratch. Try to give it a unique twist.
Make a small wiki page for each language that includes your program and a description of its key components. Note especially the differences in syntax between the languages. Are there any differences in naming, variable scope, or data types?
Make a separate wiki page that links to each of your language pages. Please put the label cs333F10hw02 on the central page with the links to the three other languages.
You will likely choose your two focus languages from these three, so be sure to include languages of interest to you.
HW 3: Parse trees
Due Monday, Oct 4
Demonstrate that addition in C is not associative. The following two statements should print significantly different results. You need to figure out appropriate types and values for a, b, and c. Can you do the same with multiplication?
printf( "%f\n", (a + b) + c ); printf( "%f\n", a + (b + c) );
Using the Clite syntax, generate both the concrete parse trees and abstract parse trees for the following statements. Feel free to do the concrete tree automatically using flex.
- z = a * 3 + b;
if( a < 0 || b < 0 ) b = 0; else b = a;
Exam 1 Prep
The following are some suggested exercises for exam 1 preparation. Email the instructor with any questions you have.
- Chapter 2: 2.5, 2.6, 2.7, 2.9, 2.9, 2.12
- Chapter 3: 3.10, 3.13 (a, b), 3.19
- Chapter 4: 4.1, 4.5, 4.6
- Chapter 5: 5.3, 5.9, 5.14
- Chapter 6: 6.4 (you get the idea)
- Chapter 7: 7.1, 7.4
- Chapter 8: 8.1 (a, b), 8.4 (a, b)
Due Monday, November 1
- Aliasing occurs when you can use one variable to change a value in memory and have that change reflected when using a different variable. For example, two pointers to the same memory location in C enable aliasing. Pick one of your selected languages for the semester and see if you can demonstrate aliasing in that language. If you can't, discuss the language features that prohibit it. Put the example or discussion up as wiki page linked to your language's main page.
- Write a simple example of exception handling in two of the three languages (Python, Java, C++) and in one of your selected languages. Demonstrate handling a built-in exception and a user defined exception. In Python or Java, demonstrate how the finally block works. Put your code, with comments describing how it works, on the Academics server.
Due Monday, 6 November
Figure out how to time a function in one of your languages. Test the relative timing for the following operations. [Hint: you probably want to execute a few hundred thousand of these operations and then calculate an average.]
- square root