Topic 8 - Sample Questions - Functions (6 days)

1. Write a function that will receive 3 numbers and return the smallest one. public static int getSmall(int a,int b,int c) 2. Write a function that will raise a base to an exponent public static int raise(int b,int e) 3. Write a function that will return the sum between 2 numbers. public static int getSum(int a,int b) 4. Write a function that will return whether a number is prime or not public static boolean isprime(int n) 5. Write a function that will return the appropriate letter grade that corresponds to the average of numbers sent to the function. public static String getLetter(int a,int b, int c) 6. public static int getGcf(int a,int b) // returns greatest common factor 7. public static int getLcm(int a,int b) // returns least common multiple 8. public static boolean IsOdd(int n) // returns true if number sent to it is odd - otherwise false 9. public static int getSumofodd(int n) // returns sum of odd numbers between 1 and n 10. public static boolean positive(int n) // returns true if number is positive 11. public static void printname(String na, int n) // prints name n times 12. public static void printfirst(String n) // prints first name of string 13. public static String getfirst(String n) // returns first name 14. public static void printfactors(int n) // print factors for an integer 15. public static int countvowels(apstring n) // returns how many vowels are in a string 16. public static void printreverse(String n) // prints name in reverse order 17. public static String everyotherletter(String n) // returns every other letter of string 18. public static String reversestring(String n) // returns reversed string 19. public static double getAvg(int a,int b,int c) // returns the average 20. public static int getAbosulteValue(int a) // returns absolute value of parameter 21. public static int getSqrt(int n) // returns integer square root of number sent to it 22. public static int GetCube(int n) // returns cubed result of parameter