#### Details of this Paper

##### C Programming Exam

Description

solution

Question

The Questions;1) Write a macro, MIN5 (A, B, C, D, E), which takes five arguments and returns the smallest value.;2) Write a function which will determine how many words are in a given string. You can assume that one;or more consecutive white spaces is a delimiter between words.;3) Write a function that is passed a month, day, and year and will determine if;that date is valid. You can assume each parameter is passed in as an integer.;Remember to check for leap year!;validDate (5, 31, 1961).... would be valid;validDate (13, 4, 1967)... would be invalid, the month is invalid;4) Write a function that takes the values of a two-card blackjack hands as input, and returns the point total of the hand. The value;of the cards '2' through '9' is equal to their face value, the cards 'T', 'K', 'Q', 'J' are worth 10 points and the ace ('A') is worth 11 points;unless it comes with another ace, then that second ace is worth 1 point. The program should be able to catch incorrect input.;Enter cards: A Q;The score is 21;Enter cards: A A;The score is 12;Enter cards: T 7;The score is 17;Enter cards: A 5;The score is 16;Enter cards: 7 #;*** Would be invalid, # is not a valid card;Enter cards: Z 4;*** Would be invalid, Z is not a valid card;Hint: I've used a value of 'T' for the 10 card so you can simply pass in two characters;instead of strings, as parameters to this function.;5) Write a function to determine is a given word is legal. A word is illegal if it contains no vowels. For this problem;the letter Y is considered to be a legal vowel. Pass in a word to this function and it will determine if the word is;legal or not. You can make the following assumptions about the word you a passing to this function.;1) The string being passed is a combination of letters only (no non-letter check needed);2) The string being passed is null terminated;3) Letters may be capital or lower case and it has no effect on whether its a word;Examples;sch - is illegal, no vowels;apple - legal, contains a vowel;APPle - legal, uppercase letter combinations do not matter;try - legal, no vowel, but contains the letter 'y;6) Write a function that will determine if a given string is a palindrome. DO NOT use the C library function: strrev;A palindrome is a word or sentence that reads the same forward as it does backward.;Examples of words would be civic or rotor... a word or phase would be;Never odd or even;A good web site of examples is: http://www.rinkworks.com/words/palindromes.shtml;7) Write a function that will return in a structure the following characteristics of a given string;1) string length (use strlen);2) number of upper case characters;3) number of lower case characters;4) number of digits;5) number of non-alphanumeric characters.;8) Write a function, myBaseBallStats, that is passed the following integer stats on a baseball player;Number of Singles, Doubles, Triples, and Home Runs as well as Number of At Bats.;Based on this information, return a structure that contains the following;Total Bases, Batting Average, Home Run Ratio, and Slugging Average.;You do not need to be a baseball fan to do this... All the information you need in;terms of the formulas and explanations can be found at;http://www.baseball-almanac.com/stats.shtml;Note: Number of hits is: singles + double;9) Most people enjoy watching movies these days, whether its the classics or modern ones.;Develop a set of structures that could be used to model the information about a movie collection.;What type of information would you want to collect and store about a movie? What would be the right;types in C for that information? Define supporting structures as needed and have one final structure type that;is made up of various members (some members may be on some structure type, others may be simple integers;floats, chars, arrays, etc). No program is needed although you might want to create a simple main function;and include your structure types just to test that everything compiles.

Paper#69128 | Written in 18-Jul-2015

Price : \$32