Logo

I did not understand this question. I tried simplifying and got x || y && x. I got confused and just chose random answer. Now I know for the expression to evaluate to true, the expressions on either side of the && operator must be true. If x is true then x || y is true regardless of the value of y, meaning (x || y) && x evaluates to true. If x is false, the expression evaluates to false regardless of the value of (x || y).

j = 0 result[0] = row 1, column 0 * row 0, column 2 = 1 * 1 = 1 result[1] = row 1, column 1 * row 1, column 2 = 2 * 3 = 6 … continue for result[3] and result[4]

For this question I was confused about the indexes.

A variable of type TennisPlayer can reference an object of type TennisPlayer

Interface: a collection of abstract methods that can be implemented by classes, providing a way to achieve abstraction and multiple inheritance

The Athlete class does not implement the Student interface.

De Morgan’s Law

!(x || y) = !x && !y x && y is only true is when both x and y are true When x and y are both true, !x && !y is false

It will always be false

Note: Study De Morgan’s Law

This does not use float division. Therefore 404/10 = 40. 404 / 10 = 40 40 * 10 = 400 400 + 1 = 401

When doing operations, I need to be careful of floats vs. integers.

Nested for loop iterate over numbers in column major order and 142536 will be printed

A iterates through the rows and then iterates through n.

Choice I will cause a compiler error if added to the SomeMethods class because it has the same method signature as public void one (int first), since it has the same name (one) and each parameter list consists of a single int parameter.

Choice II can be added to the SomeMethods class because, although it has the same name (one), the parameter list has the types String, int which has a different order than the method public void one (int first, String second).

Choice III can be added to the SomeMethods class because there are three int parameters and no other method named one has three int parameters.

Compiler error: occurs when the code written by a programmer does not meet the syntax or semantic rules of the programming language

I didn’t know what a compiler error was.

The expression is evaluated for every iteration of the outer loop

It should iterate through 5 times, not 6.

I can’t count.

I am not good at arrays and indexing. The option I chose would require the second set of nested loops to initialize row to val – 1, increment both row and col in each iteration inner loop (instead of row being decremented) and changing the condition on the inner loop to col < 5 && row < 5.

Binary cuts the number of elements in half every time.

Start: 2000

1st iteration: 1000

2nd iteration: 500

3rd iteration: 250

4th iteration: 125

5th iteration: 62

6th iteration: 31

7th iteration 15

8th iteration: 7

9th iteration: 3

10th iteration 1

Around 11 iterations.

I overlooked the 3rd option. Choice III starts by adding the elements of words to temp in reverse order. The second loop starts at the beginning of temp (which was the end of words) and adds each subsequent element to result until it reaches the element that was at startIndex and is now at temp.length – startIndex resulting in result containing the required elements in reverse order.

Reflection

The topics I missed the most were

Unit 3: Boolean Expressions and if Statements

Unit 6: Array

Unit 8: 2D Array

Unit 9: Inheritance

From this MCQ, I realized that I might not know enough about how Java works especially with arrays since it is a rather new topic. This is especially true for iterating through arrays because the numbers for iteration get confusing for me, even though I tried writing them down to make more sense. One strategy I thought was helpful was using paper and pen to write down each step of the iterations for for loops. I reviewed my questions and went back and check the parts I usually miss and think about what I find hard. During the break, I’ll study do better.