CSC 101 Lab Week 9
Final Exam Review
DUE: Thursday, 2 June 2011, at the end of lab
- Complete post-course survey in lab today
- Work in small groups to answer the following questions:
- Write a program that calculates your grade in this class, and tells you what you need to get on
the final to earn an A, B, C, ...
- Create a struct to store information on chairs (height, width, legs, color).
- Create an array of 20 chairs
- Write a function that accepts an array of chairs and a size, then returns
the average height.
- Write the boolean expression that determines if either the height and width of one chair
are both larger than the height and width of another chair, or if the height and legs of
the first chair are both larger than that of the second chair.
- Write a function that accepts two strings and returns 1 if the first string is a subset
of the second string, and returns 0 otherwise.
- What does the following code print?
double a[3] = { 1.2, 2.3, 3.4 };
double *p1;
int b, c;
p1 = &a[2];
b = (int)*p1;
printf("%d", b);
Write a function that accepts a number x and computes x2 + 3
Write a function that accepts a number x and computes 4x3 + 3x2 + 9
Write a function that accepts A, B, and C, and x, and computes Ax2 + Bx + C
Write a function that returns the length of the longer of two input strings.
Write a function that returns the smallest of three given numbers.
Write a function that returns the largest of three given numbers.
Write a function that returns the "middle" of three given numbers.
A phone has a maker, a year of construction, and a quality. Design a struct for phones, and give three examples.
Write a function named 'oldPhone', that accepts a phone and a year of construction and returns true when the phone was built in or before the given year.
A singer has a height, a weight, a name, and a famousness ranking. Design a class for singers, and give three examples.
Write a function named 'shortNameSinger', that accepts a singer and returns 1 if the singer's name is shorter than 10 characters.
Write a function that returns 1 exactly when an array of ints contains a 6.
Write a function that returns 1 exactly when an array of strings contains "boo".
Write a function that returns 1 exactly when an array of ints contains an int greater than 12.
Write a function that returns 1 exactly when an array of strings contains a string longer than 4 characters.
Write a function that returns 1 exactly when it is given a number for which x9 + 3x + 2 = 0
Write a function that accepts an array of ints and an int 'n' and returns 1 exactly when 'n' occurs in the array.
Write a function that accepts an array of ints and an int 'x' and returns the index of the first occurrence of the int 'x' in the array.
Write a function that accepts an array of strings and a string 's' and returns the index of the first occurrence of the string 's' in the array.
Write a function that accepts an array of numbers and returns their sum.
Write a function that accepts an array of numbers and returns their product.
Write a function that accepts an array of non-negative numbers and a size of the array, and returns the largest number in the array. If called with an empty array, the result should be zero.
Write a function named 'putAtEnd' that accepts an array of ints and a single int, and adds the single int at the end of the array.
Write a function named 'append' that accepts two arrays of ints and appends them together.
Write a function named 'reverse' that accepts an array of ints and returns the reversed list.
Write a function named 'countPizza' that accepts an array of strings and returns the number of times that 'pizza' occurs in it.
Write a function named 'countBiggerThan9' that accepts an array of ints and returns the number of elements that are strictly larger than 9.
Write a function named 'countFalses' that accepts an array of ints and returns the number of ints that are 0.
Write a function that accepts an array of numbers and computes their mean.