Test 1 Practice
Format of Tests
Format of tests may contain any of these three main types of problems
- short answer -- anything from multiple choice, true/false,
fill-in-the-blank, short free response questions
- Code-Reading -- problems involving reading a segment of code and
answering some question about it.
- Code-writing -- problems involving writing small segments of code,
like short algorithms or functions
Some Practice Coding Problems
- Write a program that asks the user to enter three integers, then
computes their decimal average and prints the result
- Write a function that takes in three integer parameters and returns
their decimal average. (How does this differ from the previous
problem?)
- Write a function that takes in two integer parameters and returns true
if the first parameter is a multiple of the second, and false otherwise.
(Hint: The % operator can help you determine factors and
multiples)
- Write a function that takes in three integer parameters and decides if
they could be the lengths of the sides of a right triangle. If so, return
true. Otherwise, return false. (Hint: Pythagoras had a little theorem,
it's hypothesis was white as snow...)
- Write a program that has the user enter the radius of a circle, then
compute and print the diameter, the circumference, and the area. Use the
value 3.14159 for pi.
- Write a function that takes in two integer parameters, x and y, and
computes and returns x raised to the y power. Do this without using any
<cmath> library functions
- Write a function that takes in a positive integer parameter N, and
then returns the sum of all the positive numbers that are less than or
equal to N. (i.e. add up all numbers from 1 through N -- you'll
need a loop).
- Write a function that does the same as the previous exercise, but adds
up only the odd numbers from 1 to N
- Write a function that takes in three double parameters and
returns the smallest of the three values
- Write a function that takes in three integer parameters and returns
true if they are all even numbers, and false otherwise