Question: QUESTION 1 What is the error in the following code fragment? double data[] = new double[20]; data[20] = 15.25; A. A cast is required B.

QUESTION 1

What is the error in the following code fragment?

double data[] = new double[20];

data[20] = 15.25;

A.

A cast is required

B.

Out-of-bounds error

C.

A two-dimensional array is required

D.

Data not initialized

QUESTION 2

What is the value of sum after the following code fragment?

int sum = 0;

for (int i = 1; i <= 5; i++)

sum = sum + i;

A.

21

B.

6

C.

5

D.

15

QUESTION 3

What is the value of x after the following nested loop?

int x = 0;

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

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

x = x + j;

A.

0

B.

3

C.

4

D.

12

QUESTION 4

Which of the following is equivalent to balance = balance + amount; ?

A.

balance == amount;

B.

balance ++ amount;

C.

balance += amount;

D.

balance =+ amount;

QUESTION 5

Which of the following indicates that a method does not return a value?

A.

void

B.

float

C.

double

D.

public

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!