Java

TOPIC 10T – TEST II REVIEW

 

 

DETAILS & REVIEW

 

 

DETAILS

 

The test covers Functions unit, the Arrays unit and the Strings unit of the grade 11 course.  All notes.  All work.  It also includes a few new topics from this year such as multidimensional arrays.

 

Your test will be fully written.  You will not have a computer.

 

Minor programming errors will not count against you.

 

 

REVIEW


QUESTION 0
While you will not have to define these terms, you should know what they mean.

 

          Function

          Method

          Function call

          Parameter / Argument
          Parameter list / Argument list

          Return-type

          Method prototype

          Static method

          Instance method

          Function implementation
          Void

          Void functions

          Modular programming

          Recursion
          Function overloading

          Array

          Index

          Element

          OutOfBounds error

          Array length

          Array size

          Array type

          Passing by value

          Passing by reference

          Sorting algorithm

          Array trace

          Algorithm complexity

          Big O notation

 

QUESTION 1A

Write a function called longestWord that gets an array of String objects as an argument and returns the longest word from the array.

 

QUESTION  1B

Inside the same class, add the main function.  Create an array that contains 10 strings.  Test the function from 1A.

 

QUESTION 2A

Write a function called count(char letter, String s) that returns the amount of times letter is found in s.

 

QUESTION 2B

Test your function from 2A.

 

QUESTION 3A

Write a function called count(char letter, String[] s) that return the amount of times letter is found in all Strings that are in the array.  Note that you might find it useful to use your function from 2A.

 

QUESTION 3B

Test your function.

 

QUESTION 4

Write the code required to invert the order of all elements in an array.

 

QUESTION 5

Create a two-dimensional array with 6 rows and 3 columns.  All elements in row 0 are to be assigned the value 1.  All elements in row 1 are to get 2.  All elements in row 2 should get 3 and so on…  Afterwards, output the content of your array to screen.

 

 

Good luck!