☑Kizspy.me
Intructions:
•
You need to know at least one programming language to perform reasonably well on
certain exam questions.

Students are not allowed to use IDEs such as NetBeans, IntelliJ IDEA, or similar software
to do the test.
• All the answers must be written in the provided template file, in Enghlish and reflect
this exam paper. If your answers to the questions in this exam paper have any keywords
not related to this electronic exam paper, the answers to the questions will get ZERO. If
you do not use the provided template file to answer the exam you take today, your
exam will get ZERO.
Question 1 (3 points): Review the following class and find (at least) 6 issues in the code (i.e,
coding practice, compile errors, potential logical issue, etc.) (Use question 1 template)
To check if a submatrix exists within a larger matrix in Java
• Iterate through each position in the larger matrix.
•
•
If the top-left element matches the first element of the submatrix, compare all elements.
If all elements match, return true. Otherwise, continue searching.
1. class SubMatrixCheck {
public static boolean isSubMatrix(int[] [] matrix, int [ ] [ ] subMatrix) {
int rows matrix. length, cols matrix[0].length;
2.
3.
4.
int subRows
5.
6.
7.
subMatrix. length, subCols subMatrix[0].length;
for (int i = 1; i < rows subRows; i++) {
for (int j 1; j <- cols subCols; j++) {
if (chackSubMatniv/matniv cuhMatnly & \\ /
Zoom
+ 100%
Close