# 1) int[][] array = {{1, 2}, {3, 4}, {5, 6}}; int sum = 0; for (int i = 0; i sum += array[i]; Syst

1) int[][] array = {{1, 2}, {3, 4}, {5, 6}};

int sum = 0;

for (int i = 0; i

sum += array[i];

System.out.println(sum);

What is the value of sum? And how did you get it?

2) int[][] array = {{1, 2, 3}, {4, 5}, {6}};

int sum = 0;

for (int r = 0; r

for (int c=0; c

sum += array[r][c];

}

}

System.out.println(sum);

Notice how we added another for loop to loop through the columns as well. notice that we used array[r].length to make our loop dynamic and loops well through the ragged array. What is the value of sum? And how did you get that?

3) int[][] array = {{1, 2, 3}, {4, 5}, {6}};
int sum = 0;

for (int r = 0; r

for (int c=0; c

sum += array[r][c];

}

}

System.out.println(sum); Match the questions on the left side with the correct answers on the right side.

What is the value of array.length?

[ Choose ]            True            False            2            3

What is the value of array.length

[ Choose ]            True            False            2            3

What is the value of array.length

[ Choose ]            True            False            2            3

T/F: The value in array exists

[ Choose ]            True            False            2            3

T/F: This snippet does not cause a run time error

4)

public class Test { public static void main(String[] args) { int[][] array = {{1, 2, 3}, {4, 5}, {6}}; array=destroyArray(array); int sum = 0; for (int r = 0; r

0 or 21?

5)

public class Test { public static void main(String[] args) { int[][] array = {{1, 2, 3}, {4, 5}, {6}}; destroyArray(array); int sum = 0; for (int r = 0; r

0 or 21?
{"ft_lang_label":"__label__en","ft_lang_prob":0.76476187,"math_prob":0.9981739,"size":1195,"snap":"2021-04-2021-17","text_gpt3_token_len":367,"char_repetition_ratio":0.12930311,"word_repetition_ratio":0.12053572,"special_character_ratio":0.3372385,"punctuation_ratio":0.17586207,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9993923,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-01-19T06:12:22Z\",\"WARC-Record-ID\":\"<urn:uuid:b07f3059-bc11-40b9-aa85-ac586547e57b>\",\"Content-Length\":\"56360\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:db374a79-3190-44db-afc1-d1feb134a274>\",\"WARC-Concurrent-To\":\"<urn:uuid:a1c98d9f-b70f-44b3-9a86-269ec99f1f89>\",\"WARC-IP-Address\":\"34.224.249.39\",\"WARC-Target-URI\":\"https://www.transtutors.com/questions/1-int-array-1-2-3-4-5-6-int-sum-0-for-int-i-0-i-sum-array-i-0-syst-5148642.htm\",\"WARC-Payload-Digest\":\"sha1:YYW3UNIBNDOB67672XHGJGNSLB7AKILH\",\"WARC-Block-Digest\":\"sha1:HDDJ7SPMEWK2LXG3KNGGOOAQ6B4DQUEA\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-04/CC-MAIN-2021-04_segments_1610703517966.39_warc_CC-MAIN-20210119042046-20210119072046-00739.warc.gz\"}"}