CS 112 Structure of Programming Languages
CS 280 Programming Languages and Paradigms
1st Semester, 2008-2009
John Paul Vergara, PhD
- Sample CPP quiz
- Midterm exam on August 6.
Coverage: Imperative programming, C, Object-Oriented programming,
- C++ source code
for quiz given July 30.
- Sample Java and C++ class definitions
- July 16:
There will be a handson exam today until 7:15pm.
This will be followed by Quiz #2 (on C pointers, again!).
We will also begin lectures on the Object-Oriented Programming paradigm.
- July 9: There will be a quiz today.
Instead of a handson exam,
we will have a lab, ( lab 3 files )
where you can work in groups of 2-3.
The hands on exam will be held next week (July 15);
here is a sample hands-on exam
that you can practice with.
Here is the solution
- Here are the
sample C programs
on pointers that we used in class on July 2.
- Welcome to this webpage!
Consult this page regularly for updates and material
- Lab 1 (Carried out June 18): Writing a simple module in C.
Write a C program that computes the mean (average) of a bunch of scores.
Arrange it so that a separate module facilitates the computation;
the module should have an addscore function and
a computemean function.
Test your module by creating a separate source file
with a function that uses the functions of the module.
- Lab 2 (June 25): Modular programming continued.
Improve the module you created last week: add a function called
computestdev that computes the standard deviation
of the scores added so far.
Standard deviation is defined as the squareroot
of the average of the squares of differences of
each score from the mean.
- July 2 (No submission necessary):
Download the following C programs, compile, execute,
and understand what they are demonstrating:
- Lab 3 (July 8): C arrays and pointers.
You may work in groups.
(Place your answers for 1 and 2 in a file called "explanation.txt")
and compile under Dev C++.
Update the program so that MAX is 20 instead of 10
and observe what is printed out.
Change SIZE to 10 instead of 12 and
observe what is printed out.
Provide a brief explanation
on why those numbers were printed out in both cases
Download and compile mem.c
and explain its resulting output.
(describe which pointers point where).
The program std.c computes
the standard deviation of 10 numbers.
Update the program so that it first asks for
the size of the sample before it takes in the numbers.
Instead of a fixed array,
use malloc to allocate space for the numbers.
- Create a zip file containing explanation.txt
and the revised std.c and submit via
Only 1 submission per group is needed.
- July 16: Handson Exam this evening.
Follow the instructions provided to you by the technician.
- July 23: no lab today.
- Lab 4 (July 30): Create a dataset class in C++
with addscore, computemean, and computestdev methods.
Objects of the dataset type should contain a (dynamic) array of doubles.
Initially create an array with 10 elements,
but resize the array by 10 element increments as necessary.
Make sure that you define an appropriate destructor, copy constructor,
and assignment operator for the class.
Write a test program that reads dataset numbers from a text file.
You may start with this tester program .
Submit all source and test files in a zip file via moodle.
- Project specs will be posted here