Computer Science - Object Oriented Programming Using C++ - Discussion

Discussion Forum : Object Oriented Programming Using C++ - Section 4 (Q.No. 18)
18.
The statement int num[2][3]={ {3,8,6}, {9,4,7}};
assigns a value 4 to num[1][2]
assigns a value 7 to num[1][2]
assigns a value 8 to num[1][2]
assigns a value 9 to num[1][2]
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
6 comments Page 1 of 1.

Rahul sahu said:   1 decade ago
  0  1  2
0 3 8 6
1 9 4 7


So [1][2] is 7.
(1)

Anji said:   9 years ago
@Rahul Sahu.

I did not get you. Can you elaborate it? Please.

Rob said:   9 years ago
int num [2][3] means 2d arrary with 2 rows and 3 columns (starting index 0,0)
So, int num [0][0], [0][1], [0][2] will get 3,8,6 respectively.
And int num [1][0], [1][1], [1][2] will get 9,4,7 respectively.

So the answer is 7, as int num [1][2] gets 7.

(0,0) (0,1) (0,2) (0,2----> row 0 , col 2) int num [0][2]
3 8 6

(1,0) (1,1) (1,2) (row 1 , col 2) int num [1][2]
9 4 7 (ans)

Malini m said:   8 years ago
Yes. Good. @Rob.

Soniya said:   5 years ago
Thank you @Rahul.
(1)

Pankaj said:   4 years ago
Thanks for explaining @Rahul.
(1)

Post your comments here:

Your comments will be displayed after verification.