Author Archives: austin

Brush up

Central Connecticut State University has great CS lessons online. We’re going to go through a few lessons to make sure we’re ready for projects I’d like to start in the near future.

If you think you know these subjects, finish the quiz or the exercises and then I’ll give you something more challenging to work on.

Array Practice Problems

  1. Declare and define double array that can hold up to 100 elements.
  2. Given an array called myNums get the length of the array and store it in a variable.
  3. Declare and define an integer array and initialize every value in the array to 1.
  4. Write a function that accepts 2 arguments a Boolean array and an integer, I want it to return a Boolean. The function only returns true if the number of true Boolean values in the array counts up to the integer passed into the function.
  5. Write a function that accepts a sorted integer array as an argument and it returns the largest value in the array. Do this without using a loop.
  6. Write a function that accepts an unsorted integer array as an argument and it returns the smallest value in the array.
  7. Represent a two dimensions inside of a single dimension array. For instance, this array could be storing objects that appear in a 100 x 100 grid. Get the object in the 3rd row and 70th column.
  8. Create an array that contains 10 integer arrays. Each integer array must contain 10 numbers 1-10, 11-20, 21 -30, …
  9. Write a function that accepts an integer array as an argument, and it returns an array that doesn’t contain any duplicate numbers. So if 1 appeared twice in the array passed in the argument, the returned array will only have one occurrence of the number 1.
  10. Given an unsorted array of size n containing the integers 1 through n in random order with one element randomly replaced by 0, determine the missing element most efficiently.

 

* Note – some of these questions were pulled from other sources on the Internet.