Question: q1. What is printed out? int i = 0; while ( i

q1.

What is printed out?

int i = 0; while ( i <= 2 ) { System.out.print( ++i + " "); }

Group of answer choices

1 2

0 1 2

0 1 2 3

1 2 3

q2.

What will print out when the following code is run?

 int a = 0; int temp = 4; for(int i = 0; i < 5; i++) { a = temp - i; } System.out.print(a);

Group of answer choices

0

1

5

10

q3.

Which values will be output?

int i = 1; do { System.out.print(i + " "); i++; } while (i < 4);

Group of answer choices

3

4

2

1

0

5

q4.

What is the difference between the contents of array1 and array2 after initialization:

Integer[] array1 = new Integer[5]; int[] array2 = new int[5];

Group of answer choices

no difference, they are both arrays full of null values.

no difference, they are both arrays full of zeros.

array1 has zeros while array2 has null values.

array1 has null values while array2 has zeros.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!