Skip to content

12/21/2023 CS MC Reflection  #61

@emmaxshen

Description

@emmaxshen

Score:
image

#8
image

I picked A when the answer was B. In order to figure out this problem correctly I wrote out the 'mat' variable in a 4x4 grid on a piece of paper. The grid is passed into the "operation" method and if look at the two numbers passed in it is (1,2). These fill the variables r and c in the method signature. Walk through the loop multiplying the two numbers identified in the matrix [r][j] * matrix [j] [c] to get the result. Each pass creates one of the numbers in the four number sequence result:
1 * 1 = 1
2 * 3 = 6
3 * 1 = 3
4 * 1 = 4
This gives the answer "b" {1,6,3,4}

#9
image

I picked A when the answer was E. So the Math.random() returns a value between 0.0 and 1.0. Need to multiply by 6 to give value of 1-6. Multiply that *2 and that gives you a max of 12.

#13
image

I picked C when answer was A. My oopisies is that I misread the line numbers[k] = numbers [k-1] + x to "k + 1"

#22
image

I picked E when answer is A. In this case, the nested for loop iterate over numbers in column major order and 142536 would be printed

#24
image

So I got this one completed wrong ˡᵒˡ. The reason that II and III can be added to the class without creating a compile time error is because they are new methods with new signatures. In the case of I that method it's really a change to an existing method so programs that use this class need to be recompiled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions