‹ Back to the paper
Question 19
2 marks
Computer ScienceISC 2022 Computer Science - Specimen paper (Semester 1), Paper 1MCQArrays, Strings
Choose the correct option.
What is the conditional statement to check for the Non-boundary elements in a double dimensional…
What is the conditional statement to check for the Non-boundary elements in a double dimensional array of ‘M’ number of rows and ‘N’ number of columns? The row index is represented by ‘r’ and the column index is represented by ‘c’.
- (a)(r>0 || r<M-1 && c>0 || c<N-1)
- (b)(r>0 && r<M-1 || c>0 && c<N-1)
- (c)(r>0 && r<M-1 && c>0 && c<N-1)
- (d)(r>0 || r<M-1 || c>0 || c<N-1)
Answer
Answer
Correct option: (c)
Answer: (c) (r>0 && r<M-1 && c>0 && c<N-1)
Non-boundary elements are not in the first or last row nor the first or last column, so all four conditions must hold together.