Question: for java 1. Declare a reference variable for an integer data type, use the identifier age . 2. Declare an array of integers - with

for java

1. Declare a reference variable for an integer data type, use the identifier age .

2. Declare an array of integers - with the capacity of 37 integers. Also, declare the reference variable - grades.

3. Declare a String variable - singer - and assign it the value "Taylor Slow". DO so in one instruction, then do so using 2 different instruction steps.

4. Using the variable singer from the question above (3) - print the phrase "Taylor Slow sings country." .

5. Evaluate each of the following numeric expressions:

a. 34 + 1.7

b. 23 % 3 + 4 * 2.8

c. 10 - 4 - 1 + 7

d. 2 - 3 * 4 + 5

6. Print the square root of 83.6

7. Print the cube root of 83.6

8. What planet(s) would print?

int r = 3.4 ;

if ( r > 3 )

System.out.println( "Neptune" );

else System.out.println( "Venus" ) ;

9. Given the array declaration as follows:

int[] ar = { 32, 88, 64, 19, 7, 28, 53 } ;

- evaluate each of the following expressions:

ar[2]

ar[3] + 3

ar.length

ar[1] += 11 -

- what would print:

for ( int i = 3 ; i < ar.length; i++ )

System.out.print( ar[i] ) ;

- what would print:

for ( int i = ar.length ; i > 3 ; i-- )

System.out.print( ar[i] + " " ) ;

10. An array is declared as follows:

** use this array as the start for each code segment in this question**

int[] nn = { 35, 15, 82, 55, 26, 7, 43, 72 } ; -

what would print: int sum = 0 ;

for ( int i = 0 ; i <= 3 ; i++ )

sum += nn[i] ;

System.out.println( sum ) ;

- what would print:

for ( int i = 2 ; i < nn.length ; i++ ) nn[i] = nn[ 8 - i ] ;

for ( int i : nn )

System.out.print( i + " " ) ;

- what would print:

for ( int i = 0 ; i < nn.length; i++ )

if ( nn[i] < 50 ) nn[i] += 10 ;

for ( int i = 0 ; i < nn.length; i++ )

System.out.print( nn[i] + " " ) ;

- what would print:

for ( int i : nn )

if ( i < 50 ) i += 10 ;

for ( int i : nn )

System.out.print( i + " " ) ;

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!