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

Feature Photo Credit

<a title="Powerpoint Slide:   "Teachers should be activators"" href="https://flickr.com/photos/kenwhytock/8471566783">Powerpoint Slide:   "Teachers should be activators"</a> flickr photo by <a href="https://flickr.com/people/kenwhytock">Ken Whytock</a> shared under a <a href="https://creativecommons.org/licenses/by-nc/2.0/">Creative Commons (BY-NC) license</a> </small>
Powerpoint Slide: “Teachers should be activators” flickr photo by Ken Whytock shared under a Creative Commons (BY-NC) license

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

Featured Image Credit

<a title="distance..." href="https://flickr.com/photos/iloveakira/5090708070">distance...</a> flickr photo by <a href="https://flickr.com/people/iloveakira">Pia Kristine</a> shared under a <a href="https://creativecommons.org/licenses/by-sa/2.0/">Creative Commons (BY-SA) license</a> </small>
distance… flickr photo by Pia Kristine shared under a Creative Commons (BY-SA) license

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”?

Featured Image Credit

<a title="Fibonachess" href="https://flickr.com/photos/fdecomite/3200758169">Fibonachess</a> flickr photo by <a href="https://flickr.com/people/fdecomite">fdecomite</a> shared under a <a href="https://creativecommons.org/licenses/by/2.0/">Creative Commons (BY) license</a> </small>
Fibonachess flickr photo by fdecomite shared under a Creative Commons (BY) license

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.

Feature Image Credit

<a title="Exercise" href="https://flickr.com/photos/sanchom/2963072255">Exercise</a> flickr photo by <a href="https://flickr.com/people/sanchom">sanchom</a> shared under a <a href="https://creativecommons.org/licenses/by/2.0/">Creative Commons (BY) license</a> </small>
Exercise flickr photo by sanchom shared under a Creative Commons (BY) license

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.

Feature Image Credit

<a title="squares" href="https://flickr.com/photos/inthe-arena/7216039450">squares</a> flickr photo by <a href="https://flickr.com/people/inthe-arena">amseaman</a> shared under a <a href="https://creativecommons.org/licenses/by-nc-nd/2.0/">Creative Commons (BY-NC-ND) license</a> </small>
squares flickr photo by amseaman shared under a Creative Commons (BY-NC-ND) license

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.

Feature Image Credit

<a title="Square roots" href="https://flickr.com/photos/ronaldc5/14927947186">Square roots</a> flickr photo by <a href="https://flickr.com/people/ronaldc5">Ronaldc5</a> shared under a <a href="https://creativecommons.org/licenses/by/2.0/">Creative Commons (BY) license</a> </small>
Square roots flickr photo by Ronaldc5 shared under a Creative Commons (BY) license