Here is a list of common errors that students have committed in previous exams. You will receive no credit for an answer that commits any of these errors!

  1. You are not allowed to colloborate with another person before, during or after the exam. The work you submit must be your own. If we detect an answer that was clearly shared amongst two or more applicants, we will stop grading the test and all applicants involved will fail the test!!. Don't colloborate!!

  2. Do not hard-code the length of an array. Just because the examples require an array of length 3, say, does not mean that your program should be able to only handle arrays of length 3. Your program should be able to handle an array of any size! So if we see something like
    int[ ] a = new int[3];
    we will stop grading and give you zero points for the answer.

  3. Do not use any I/O in your functions! You should not read in anything from the keyboard or write out anything to the console. A function should get its input from its parameters and return its answer using a return statement. Specifically, your function must be able to be used as is in a GUI-based windows application or in a browser-based web application. So if we see any of the following statements in your function, we will stop grading and you will receive no credit for your answer.

    1. cout
    2. cin
    3. printf
    4. scanf
    5. Console.WriteLine();
    6. Console.ReadLine();
    7. System.out.println();
    8. System.in.read();
    9. Any other I/O statement

    It is okay to use output statements in your main program to display the results of calls to your function. But it is a waste of time to use input statements in your main program since it is okay to hard-code the values of any arrays that you use to test your function.

  4. The signature of the function you write must match the signature given in the question. So if the question specifies the signature
    int foo(int[ ] a);
    then your answer should look something like this:
    
    main(...)
    {
      int n = foo(new int[ ] {1, 2, 3});
    }
    
    int foo(int[ ] a)
    {
      // do something with a
      // return an int
    }
    
    

    You will receive no credit for your answer if you only have a main program, e.g.,

    
    main(...)
    {
      int[ ] a = new int[ ] {1, 2, 3};
      // do something with a
      // print out result.
    }
    
    
  5. Your function should not alter the input parameter(s) in any way. For example, if your function needs to sort an array input parameter, you must sort a copy of the parameter, since otherwise, the caller of the function will see the sorted version of the input parameter.

    For example,

    
    ... main(...)
    {
      int [ ] a = new int [ ] {4, 2, 5};
      foo(a);
      // when program reaches here value of a will be {2, 4, 5} because an array is passed by reference!
    }
    void foo(int [ ] a)
    {
      // sort the array a into ascending order
    }
    
    

    None of the questions require you sort any input parameter. If you choose to do so please sort a copy or you will receive no credit for the question.