wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Consider a 2 - D array A[ ][ ] which represents a matrix having same no. of rows and columns. Let the no. of rows be n then the size of the matrix that the array A[ ][ ] represents is n×n. The array elements are such that the value at each location is equivalent to the difference between the column number and the row number. It is represented as follows : A[p][q] = p - q, where 1pn and 1qn. What would be the sum of the elements of the matrix representation of array A[ ][ ]?

A
0
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
B
n - 1
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
n(n+1)2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
n23n+2
No worries! We‘ve got your back. Try BYJU‘S free classes today!
Open in App
Solution

The correct option is A 0
Given a 2 - D array A[ ][ ] is a representation of n×n matrix, where : Prep [p][q] = p - q
A[i][j]=⎢ ⎢ ⎢ ⎢01....1n10....21....(1n)(2n)....O⎥ ⎥ ⎥ ⎥

Sum of A[p][q] = 0 + 1 + 1 ....+ (-1) + (-2) ...
Sum if A[p][q] = 0

flag
Suggest Corrections
thumbs-up
0
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
2D Arrays
OTHER
Watch in App
Join BYJU'S Learning Program
CrossIcon