subject

Consider the following code segment. int[][] multi = new int[4][4];

for (int rows = 0; rows < 4; rows++)

{

for (int cols = 0; cols < 4; cols++)

{

if (cols == 0)

{

multi[rows][cols] = 0;

}

else if (cols == 1)

{

multi[rows][cols] = 1;

}

else if (cols == 2)

{

multi[rows][cols] = 2;

}

if ((rows % 2 == 0) && (cols % 2 == 0))

{

if ((rows >= 2) && (cols <= 2))

{

multi[rows][cols] = 9;

}

}

}

}

As a result of executing the code segment, how many elements in the two-dimensional (2D) array multi will store the value 9 ?

A) 0
B)1
C)2
D)4
E)6

ansver
Answers: 1

Other questions on the subject: Advanced Placement (AP)

image
Advanced Placement (AP), 24.06.2019 03:30, natalie2sheffield
Luke finds a great deal for pudding cups on amazon. he can get a 36 pack for $9.74. what a deal! each cup holds 3.25oz of yummy pudding, btw. luke also knows that the hot tub is about 5 feet width, 5 feet long, and 2.5 feet deep. how many packs will luke need to buy in order to fill the hot tub? how much will this prank cost him? need
Answers: 1
image
Advanced Placement (AP), 24.06.2019 06:20, Tyrant4life
Which of the following is not one of the seven points from the pre-start checklist recommended by the nsc
Answers: 1
image
Advanced Placement (AP), 24.06.2019 19:10, biba54
Can someone ! who is the intended audience for cortés—general description of tenochtitlán i need to fill out a hap-p chart pleaaasse
Answers: 3
image
Advanced Placement (AP), 25.06.2019 19:10, lerasteidl
Jake and kate made a down payment of 16% on a house that cost $267,450. they are charged an origination fee of 0.5%, an intangible tax of 0.2%, and bought two discount points. what did jake and kate pay in total for the down payment, fees, taxes, and points? $43,947.38 $47,285.16 $48,857.77 $50,013.15
Answers: 1
You know the right answer?
Consider the following code segment. int[][] multi = new int[4][4];

for (int rows = 0;...

Questions in other subjects: