• edited by
19,282 views
75 75 votes

An $n \times n$ array $v$ is defined as follows:

$v\left[i,j\right] = i - j$ for all $i, j, i \leq n, 1 \leq j \leq n$

The sum of the elements of the array $v$ is

  1. $0$
  2. $n-1$
  3. $n^2 - 3n +2$
  4. $n^2 \frac{\left(n+1\right)}{2}$

15 Answers

Best answer
75 75 votes
The sum of the $i^{th}$ row and $i^{th}$ column is $0$ as shown below. Since, the numbers of rows equals the number of columns, the total sum will be $0$.$$\begin{array}{|l|l|l|l|l|} \hline \text{0} & \text{-1} & \text{-2} & \text{-3} & \text{-4}\\\hline \text{1} & \text{0} & \text{-1} & \text{-2} & \text{-3}  \\\hline \text{2} & \text{1} & \text{0} & \text{-1} & \text{-2} \\\hline \text{3} & \text{2} & \text{1} & \text{0} & \text{-1}\\\hline \text{4} & \text{3} & \text{2} & \text{1} & \text{0}\\\hline \end{array}$$Correct Answer: $A$
• edited by
32 32 votes
If you look at code carefully it is very clear matrix getting defined is skew symmetric matrix.

Sum of all elements in skew symmetric matrix is 0.

Answer :-A 0
20 20 votes
Let there are total N rows . You will find ∑ of elements of row i + ∑ of elements row (N-i+1) = 0.

So if N is even then

row 1 + row N =0

row 2 + row (N-1) =0

row 3 + row (N-2)=0

similarly row (N/2) + row (N/2+1) =0.   (So total sum is 0)

But if N is odd then row ((N+1)/2) will have no corresponding rows BUT Ithe summation of elements of this row is 0 .

So for N = even or Odd , the sum of element is 0 .
9 9 votes

i think we can easily get it without drawing matrix
   as expression given v[i, j] = i - j
suppose i1-j1=k1   {for a particular index } so its opposit index shows j1-i1=-k1, for example if v[1,2]=x then v[2,1]=-x}
  so we have  cases here
1. for all  i>j v[i, j] = i - j and jut for opposit indexof v[i, j] = i - j , v[j, i] = j - i =-(i-j) :: note this is for non diagonal elements 
2. for all i=j v[i, j] = i - j=0  :: note this is for diagonal elaments
so total sum will be zero ucan easily get it by seeing above cases

   

7 7 votes
ans is option (a) i.e 0

solution: suppose if n=3

then i<=3 and 1<=j<=3

i.e i=1,2,3, and j=1,2,3

=> v={i-j}=(0,-1,-2,1,0,-1,2,1,0}

sum of elements in v=0
• edited by
Answer:
Position:
Show:

Related questions

51 51 votes
8 answers 8 answers
18.2k
18.2k views
Kathleen asked Sep 14, 2014
18,195 views
A multiset is an unordered collection of elements where elements may repeat any number of times. The size of a multiset is the number of elements in it, counting repetiti...
30 30 votes
3 answers 3 answers
9.5k
9.5k views
Kathleen asked Sep 14, 2014
9,507 views
Suppose you are given arrays $p [1......N]$ and $q [1......N]$ both uninitialized, that is, each location may contain an arbitrary value), and a variable count, initiali...
47 47 votes
11 answers 11 answers
18.5k
18.5k views
Kathleen asked Sep 14, 2014
18,510 views
Consider the following nested representation of binary trees: $(X \ Y \ Z)$ indicates $Y$ and $Z$ are the left and right subtrees, respectively, of node $X$. Note that $Y...
62 62 votes
4 answers 4 answers
23.0k
23.0k views
Kathleen asked Sep 14, 2014
23,031 views
Given the relationsemployee (name, salary, dept-no), anddepartment (dept-no, dept-name,address),Which of the following queries cannot be expressed using the basic relatio...