Reference no: EM132674164
COIT20245 Introduction to Programming - Central Queensland University
Assessment - Take Home Test
Question 1
a. In your own words, explain what is meant by variables and fields in Java. Give two examples to illustrate the main difference between variables and fields.
b. In your own words, explain what is meant by a syntax error and a logical error in Java. Give two examples to illustrate your answer and show two syntax errors and two logical errors.
Question 2
a. In your own words, explain what is meant by good programming practice. Give two examples, one with good programming practice and one without good programming practice.
b. In your own words, explain what is meant by an Array and ArrayList. Give two examples that illustrate the main difference.
Question 3
a. Write a program which shows how two-dimensional arrays which contain multiple copies of your id number and age are passed to methods. Explain in your own words each method and class used in the program.
b. Write a program to show the difference between linear search and binary search. Show the input test data for your program and the output produced by your program which clearly show that binary search is faster than linear search.
Question 4
A text file called coit20245.txt consists of N lines each containing a name and a family name as follows. N is largest digit of your student id number.
Example of coit20245.txt file:
Daniel Atkinson Rob Jackson Brian Lara
Write a main() method that reads the rows of coit20245.txt and counts the lines which starts with a first letter of your name. You are to provide class comments that describe what the application does. You are also to provide comments that describe what each significant block of code does.
Question 5
Provide a comprehensive set of test cases for the two programs below. Do not provide actual test data, but rather describe each test. For example, if one of the programs was to search an array, you might include test cases such as search an array that is in ascending order, search an empty array, search for an element not in the array, etc.
a. The program described in Question 4.
b. A bubble sort method that is to sort an array of N student id numbers. N is the largest digit of your student id number.