# Quiz Week 14

## Survey Time

Please fill out the survey to evaluate your professors. These are very important tools to give feedback to your professors and we do take it very seriously. For myself I really appreciate the comments that you provide to help improve my teaching going forward. Even after 22 years of teaching I still have much to learn and especially from you the students.

You can enter the survey by going to https://mitecbeta.itesm.mx and then search for ECOA.

Thanks for doing this, I appreciate it and look forward to 100% of my students doing this.

## Self Evaluation Time

Please check which of the Mastery topics you have covered in your blog posts. I created a Google spreadsheet which you can copy in order to keep track of this. Feel free to use “File->Make a copy.” to do that for yourself.

You can find that spreadsheet here: http://url.kenbauer.me/tc1017mastery

# QuizWeek#11

## Practice Exam

Download and attempt to solve the problems in the attached exam file.

The real exam next week will be shorter but drawn from these questions.

I would expect everyone to be able to do all except #8 and #9 now but I know there are some of you that could do those now.

# Quiz Week 09

## Distance

Write a function that receives four parameters: x1, y1, x2, y2 which are all floating point values.

The function is called distance and returns (float) the distance between x1,y1 and x2,y2 on the cartesian coordinate plane.

## What to Submit

Post on your blog your solution and include your code somehow (image, in the post or via GitHub) and remember to include the hashtag #quiz09

# Quiz Week 8

## Two Activities

• Please fill out our mid-semester survey. This will not take long at all and in the spirit of non grading based on points, there is simply two open questions. How can you improve and how can Ken help you improve your learning.
Fill out that survey here: http://url.kenbauer.me/midtermsurvey
• Write a function that calculates returns the “nth” Fibonacci number where we define a function over the Fibonacci numbers mapping the naturals (starting with zero) to the Fibonacci series. So fibonacci(0) returns 0, fibonacci(1) returns 1, fibonacci(2) returns 1 and so on. Note that we are using the modern definition where the sequence starts with zero. You should try to implement this with two solutions: one with a loop and one with recursion. Which do you think is “better”, which looks more “elegant”, which is more “efficient”?

# Quiz – Week 6

## Resources on the Web

Go check out the C/C++ PROGRAMMING EXERCISES page and do the first five questions.

You should continue to look for more options of exercises to practice your programming. Some of these resources also show solutions but try to do the exercise yourself before looking at the solution. When you do find a solution, compare your solution to those of “the answer” as well as those of your classmates.

## Notes

C++ keeps changing and runs different on different machines. For the first question you may want to use printf instead of cout to format the printing, check out the printf reference here.

Note that you will also need to include <stdio.h>

printf will also complain that you are not passing an int to the %d so perhaps you want to cast the sizeof value to an int like this:

int(sizeof(c)*8)

## What to Do

Publish your answers on your blog post and perhaps in your repository on GitHub for the course.

# Quiz Week 4

## Minimum and Squares

For this quiz I want you to (in class) create a program with two functions:

• int minimumThree(int x, int y, int z){ }  // returns the value that is smallest of x, y and z
• int sumSquares(int x, int y, int z) {}  // returns the value of the sum of squares of x, y, z

## What to Do

You implement these function in your own program in a file quiz4.cpp.

You should make a main routine that asks the user for three numbers and then calls your functions to which should *RETURN* the value and you print in the main program.

Publish your code on your own blog today (during class time is best) and use the tag #Quiz04 so it shows up nicely in our tag cloud.

# Quiz Week 3

## Functions

For this quiz I want you to (in class) create a program with two functions:

• double square_root(double x) {}  // returns the square root of x
• double cube_root(double x) {} // returns the cube root of x

## What to Do

You implement this function in your own program in a file quiz3.cpp.

You should make a main routine that asks the user for a number and then calls your functions to calculate the square and cube roots of that number and prints them out.

What should you do if the user enters a negative number?

Publish your code on your own blog today (during class time is best) and use the tag #Quiz03 so it shows up nicely in our tag cloud.