Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions