Say What?
Does Not Compute
Let's Get Organized!
"I Object!"
(Legally Blonde Reference)
Wild Cards
100

Given the following code, what will be printed?

int[]nums = {1, 2, 3, 4};

    for(int i=0; i<nums.length; i++)

        {

            if(nums[i]%2==0)

            {

                System.out.println(nums[i]);

            }

What is 2, 4 

(or the even numbers in the array)

100

Find the error in this code

String str = "Parrot";

int len = str.substring(3, 6);

What is "this is the wrong variable type"?

100

What will be the result of the following code?

int [ ] [ ] nums = new int [3][4]?

What is a 3 X 4 2D Array?

100

indexOf() and .contains() are examples of methods that you can use to find this object.

What is a String (or a substring)?

100

The act of "adding" substrings to the end of an established string.

What is concatenation?

200

Given the following code, what will be printed?


int []nums = {2, -3, -4, 5, 6, -7};

for(int X:nums)

System.out.print(X * -2 + " ");

What is -4, 6, 8, -10, -12, 14?

200

Find the error:

You answer 36 of the 40 questions on the MC test because you are "unsure" about an answer.

What is "you NEVER" leave an answer blank on a Multiple Choice Test that does not penalize you for wrong answers! 

200

What will be the result of the following code?

double[ ] nums = {3.3, 0.2, 1.1, 5.5};

What is an array filled with doubles?

200

You use this to instantiate a new object, giving it qualities from instance variables.

What is a Constructor?

200

A method that "calls itself" until a condition is met.

What is Recurssion?

300

Given the following code, what will be printed?

public void findSum(int [ ] nums){

int sum = 0;

for(int i = 0; i<nums.length; i++)

sum += nums[i];

return sum;}

n = [1, 2, 3];

System.out.println(findSum(n));

What is you will get an error, trying to return a void method?

300

You have an ArrayList called names that is filled with Strings.

for(String x:names){

        if(x.contains("i")) {          

             remove(x);        

}

    


What is you can not remove from a for-each loop or you will get an error!

300

This strategy is used to organize all of the numbers in an array into ascending order. "Merge" and "Selection" are examples of this.

What is a sorting algorithm?

300

This phrase is used when you apply a method directly to an object.

What is "calling" a method?

300

The words "extends", "abstract" and "implements" are examples of this.

What is Polymorphism?

400

Given the following code, what will be printed?

int x = 10;

while(x /0 > 1)

     System.out.println(x);

     x--;

What is an error message (reached end of file while parsing)?

400

Find the error in the logic:

ArrayList<String> s = new ArrayList<String>();

s.add("bird");

s.add("bird");

s.add("cat");

s.add("bird");

for(int i=0; i<s.size(); i++)

if(s.get(i).equals("bird"));

 {

s.remove(i);

}

What is you need to add i -- to make sure you check the ArrayList for sequential "birds"?

400

You have an array of pet objects and a getName() method. This is the first thing you should do before traversing the array and getting the names of the pets. 

What is check for nulls?

400

This method, when called, will change values in an object that were previously instantiated when the object was created. 

What is a "setter" (or "muttator")?

400

How you are able to "visit" each cell in a 2D array (every row and column)

What is traversing the array?

500

Given the following code, what will be printed?String []s = {"I", "won't", "am","not", "going", "can't","to", "don't", "ace", "fail", "tomorrow's", "disappoint", "test!"};

for(int i=0; i<s.length; i++)

if(i %2 == 0)

System.out.println(s[i]);

What is "I am I going to ace tomorrow's test?"

500

Find the Error in the logic (not a syntax issue!):

String [ ] S = {"cat", "frog", "dog", "fish");

for(String animal: S)

if(animal.substring(0,1).equals("f") 

{animial = "shark"}; 

What is you can't change an array when you use a for:each loop?

500

Given a 2D array, what is them missing line of code needed to travers the array?

for(int r=0; r<nums.length; r++)

   **/ missing code /**

What is (int c=0; c<nums[0].length; c++)


or (int c=0; c<nums[r].length; c++) ?

500

This is a computer programming model that organizes software design around data, or objects, rather than functions and logic, and is the basis for this course.

What is Object Oriented Programming (OOP)?

500

Words such as "Super", "subclass" and "@override" are used in this type of class design.

What is inheritance?

M
e
n
u