What is the value of sum after this code sequence is execute

Assignment Help JAVA Programming
Reference no: EM13940017

1. What is the output of this code sequence? (The user successively enters 3, 5, and -1.)

System.out.print( "Enter an int > " );
int i = scan.nextInt( );
while ( i !=-1 )
{
System.out.println( "Hello" );
System.out.print( " Enter an int > " );
i = scan.nextint ( );
}

2. what are the values of i and product after this code sequence is executed?

int i=6;
int product =1;
do
{
product *=i;
i++;
}while ( i <9 );

3. What is the output of this code sequence?

for ( int i = 0; i <3; i++ )
System.out.println( "Hello" );
System.out.println( " Done" );

4. What are the values of i and sum after this code sequence is executed?

int i = 0;
int sum = 0;
for ( i =0; i < 5; i++ )
{
sum += i;
}

5. What is the value of sum after this code sequence is executed?

int sum = 0;
for ( int i = 1; i < 10; i++ )
{
i++;
sum += i;
}

Reference no: EM13940017

Questions Cloud

Discuss the effects of climate change on the ecology : Discuss the effects of climate change on the ecology, community and economy of Canada.Present a structured report of between 2500 and 3000 words, written in appropriate language and referenced (using APA6), so that the average concerned resident o..
Is it ethical to charge such high rates of interest : How should a manager balance the need of low-income individuals to buy goods on credit with the need of businesses to make a profit? Is it ethical to charge such high rates of interest? Should there be a limit to what a seller can charge for credi..
Are there any legal and ethical ramifications of this case : Are there any legal and ethical ramifications of this case? If so, what? If not, why? Should U.S. companies sell products banned in the United States to other countries? Why or why not? Discuss fully and cite sources that support your response.
Differences of absorption and variable costing : Discuss the advantages and disadvantages of absorption and marginal costing and what factors organisations are required to consider when using each of these methods
What is the value of sum after this code sequence is execute : What are the values of i and sum after this code sequence is executed?
What are the benefits and risks of e-commerce for company : Evaluate how e-commerce affects your company. You can consider the following questions: What are the benefits and risks of e-commerce for your company? How should your company prepare for the risks
Challenges and opportunities in information systems : Identify and explore contemporary challenges and opportunities in information systems and to formulate an opinion or judgement and offer possible solutions.
Discuss the facts of the case from your client perspective : To provide for more uniformity in the case briefs, consider the following format for your case briefs: Parties: Identify your party, plaintiff or defendant. Facts: Discuss the facts of the case from your client's perspective
The average cost to attend the university : After deducting grants based on need, the average cost to attend the University of Southern California is $27,175. Assume the population standard deviation is $7400. Suppose that a random sample of 60 USC students will be taken from this populatio..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd