Screenshot of Collegeboard MCQ

Screenshot

Basis Overview

I did very good with the topics of Using Objects, Boolean Expressions and If Statements, Iteration, Writing classes, Array, ArrayLists, 2D Array, Inheritance, and Recursion. I feel like my use of projects has helped me get used to interacting with Using Objects, and Inheritance. The different lessons that were presented in class helped me get used to Iteration, Recursion, Array, and ArrayLists.

The topic which I didn’t meet was Primitive Types.

boolean data1 = true;
System.out.println(data1);
int data2 = 10;
System.out.println(data2);
true


10

Question 18

Screenshot

This is the only question that I got wrong in the collegeboard MCQ quiz, and this was a mistake in order of operations and mathematics. I understood all the math symbols and tried to attmept the problem but I got it wrong. Now lookiong back at it, I think that this mistake could have been avoided with multiple rechecks and reviewing the problem multiple times.

System.out.println(404/ 10 * 10 + 1);
401

Question 11

Screenshot

This question took exceptiopnally long for me because at the time I didn’t work with boolean methods and this question really stumped me. To get better understanding of the question I went online and researched different boolean methods and various methods which take in String paramters. Eventually I was able to solve the problem and get the correct answer.

Reflection

Learning boolea

Question 12

Screenshot

This question is extremely complicated for me since I was not very well versed with booleans and especially compound booleans with two different variables, x and y. I spent a lot of time researching how compound booleans work and spent a lot of time on the internet learning how to solve compound boolean problems. In the end, not only did I get the answer correct but got a better overall understanding of using compound booleans which can be used in later projects.

Practice

To Practice I did an AP Practice Problem online. The problem was about compound booleans and predict the output of the code. I predicted “First” and “Second”, which helped me practice for the actual problem on the Collegeboard Quiz.

int x = 10;
int y = 5;

if (x % 2 == 0 && y % 2 == 0 || x > y)
{
    System.out.print("First ");

    if (y * 2 == x || y > 5 && x <= 10)
    {
       System.out.print("Second ");
    }
    else
    {
       System.out.print("Third ");
    }
}
First Second 

Question 35

Screenshot

This was the haredest question for me in the entire collegeboard mcq quiz, because I was not well versed in binary search. Also iteration on binary search was something that I only did once in a lesson and I still wasn’t very comfortable with doing it as I haven’t implemented it within other projects.

// Java implementation of iterative Binary Search
 
import java.io.*;
 
class BinarySearch {
   
    // Returns index of x if it is present in arr[].
    int binarySearch(int arr[], int x)
    {
        int l = 0, r = arr.length - 1;
        while (l <= r) {
            int m = l + (r - l) / 2;
 
            // Check if x is present at mid
            if (arr[m] == x)
                return m;
 
            // If x greater, ignore left half
            if (arr[m] < x)
                l = m + 1;
 
            // If x is smaller, ignore right half
            else
                r = m - 1;
        }
 
        // If we reach here, then element was
        // not present
        return -1;
    }
 
    // Driver code
    public static void main(String args[])
    {
        BinarySearch ob = new BinarySearch();
        int arr[] = { 2, 3, 4, 10, 40 };
        int n = arr.length;
        int x = 10;
        int result = ob.binarySearch(arr, x);
        if (result == -1)
            System.out.println(
                "Element is not present in array");
        else
            System.out.println("Element is present at "
                               + "index " + result);
    }
}
BinarySearch.main(null);
Element is present at index 3