In order to do well in the Cosc 200 level practical tests it's helpful to know the thinking behind them. At the most basic level a practical test is designed to assess whether you are able to perform a particular task or not. Here is a simple example:
Write a Java program called Counter which prints the numbers 1 to 10 on a single line separated by commas. Use a loop to print the numbers.
One way to be able to pass this test is to memorise every single character of the following program:
public class Counter { public static void main(String[] args) { for (int i = 1; i < 10; i++) { System.out.print(i + ","); } System.out.println(10); } }
However, a much better way would be to learn how to write a Java class, a main method, a for loop, a print statement and how to concatenate strings. If you spend your time learning those skills then they can be easily applied to writing different programs.
If you decide to just memorise the code and regurgitate it without any understanding, then you won't have learned anything that can be transferred to another task. You will also find it much harder to identify and fix mistakes in your program if you don't really understand what each part is doing.
It's a good idea to write the solution to a problem incrementally, ensuring that your program is working at each stage before adding more of the desired functionality. After each step you should compile your program and run it to check that it does what you expect. The provided testing scripts are there for you to run as a final step in the process. We definitely don't recommend that you try to memorise a program and type the whole thing out before compiling it for the first time.
The simplest sort of practical test is one where you know the exact problem in advance, can write a complete solution in your own time, and then attempt to reproduce it during the test. A more difficult test requires you to be familiar with a number of different programs that you could be asked to write. If you understand the code you are writing rather than just memorising, you will find it much easier. This is also the case with tests where you are provided with a lot of the code, but you have to complete a number of missing parts yourself.
We could easily ignore minor differences, like white space or punctuation, when checking the output of your program. However, we have chosen not to do this in order to promote the idea of attention to detail, which is an important skill that we want you to acquire. If the required output of your program is
Hello, world!
then none of the following are acceptable
Hi, world! HELLO, WORLD! Hello world! World, Hello! Hello, world. Hello, world!
Page maintained by Iain Hewson. Last modified: Tue May 28 09:29:58 2019