Answered Essay: 6. What is the result? public static void main(Strigargs) for () t to Java Program prints "Welcome to Java" an infinite number of times. O Com

6. What is the result? public static void main(Strigargs) for () t to Java Program prints Welcome to Java an infinite number of times. O Compilation error as expressions are missing in the for loop. O Program prints Welcome to Java once. No error and no output. 7. You want to compute the sum of all the marks of a given subject. Which approach will you choose? if statement O switch statement O if/else statement ○ Looping 8. The for loop provides a complicated way to iterate over a range of values True False 9. When is an update expression in a for loop executed? Before each iteration through the loop. OAfter bwo iterations through the loop. 0 Before the first iteration through the loop. O After each iteration through the loop. er all questions in this section) 10. Access and visibility of a class should be limited as much as possible. ○ False

6. What is the result? public static void main(Strigargs) for () t to Java Program prints “Welcome to Java” an infinite number of times. O Compilation error as expressions are missing in the for loop. O Program prints “Welcome to Java” once. No error and no output. 7. You want to compute the sum of all the marks of a given subject. Which approach will you choose? if statement O switch statement O if/else statement ○ Looping 8. The for loop provides a complicated way to iterate over a range of values True False 9. When is an update expression in a for loop executed? Before each iteration through the loop. OAfter bwo iterations through the loop. 0 Before the first iteration through the loop. O After each iteration through the loop. er all questions in this section) 10. Access and visibility of a class should be limited as much as possible. ○ False

Expert Answer

 

Answers are as follows with required explanation for every possible question::

Question 6:

  • Program prints “Welcome to Java” an infinite number of times.
  • for loop has four components with it and they are for(Initialization ;condition ;update) and body of loop.
  • Initilization executes only once at first loop of the for loop. Condition is boolean parameter and checks if given parameter holds certain condition or no for example i<10.
  • After condition check , loop executes its body and go for update.
  • Now for(;;) has no initialization which is allowed in java and in condition too there is nothing and by default this condition is taken as true always. There no update either.
  • So loop runs forever i.e for infinite time.

Question 7:

  • Answer is (d) Looping.
  • To compute sum of all the marks of a given student we need to have datastructure like Array.
  • So we need to traverse through array to calculate easc subject marks.
  • if statement is used just to check a particular condition holds TRUE or FALSE.
  • if/else statement is also similar to if statement. But it is used to execute one of the option like if a<10 then do a++ else do a–.
  • Switch statement is used for execution of cases. It can have many cases from which only one gets executed.
  • Looping for loop is generally used to traverse through array.

Question 8:

  • Answer is FALSE.
  • for loop is very simple for iterating/traversing over a range of values.
  • For example consider there is an array of size 100 and it has integer values stored in it and our job is to get sum of values in range of index starting at 5 to 60(both index inclusive).
  • Then for loop looks like this for(int i=5 ; i<=60;i++) .

Question 9:

  • Answer is (d) After each iteration through the loop.
  • for loop has format as follows for( initialization ; condition ; update){ …body to be excuted every iteration….}.
  • Here initialization is done only once for first iteration of the loop and then condtion is checked for beingTRUE or FALSE. If condtion is false then loop breaks.
  • But if condition is TRUE then the body of loop is executed first and then update is performed.

Question 10:

  • Answer is TRUE.
  • For security reasons access class should have limited access and visibility.
  • If class have public access then anyone can change the code and can cause serious damage to system.

Question 27:

  • Answer is (d) circle.
  • There is a class named circle which has properties like radius and color. These properties are nothing but variables storing radius and color of each circle.
  • Class circle also have methods two for calculating circumference and area.
  • Now we create objects of class circle with properties like radius color circumference and area.

Question 28:

  • Answer is (a) The main method is commonly used to instantiate objects and (d) The main method should be as simple as possible.
  • For option (a):: Generally program starts its execution with main method and to use properties of classes in project we need to create objects of those class so that we can call methods from class.
  • For option (d):: If all the calculations are done in main method then it gets complicated to debug the code if errors are present. Also the code is not easy to understand, So it is important that reapeatind code must implemented in form of small methods and then called in main.

Question 29::

  • Answer is (b) ArrayList<Boolean> arrList = new ArrayList<>();
  • Boolean here is wrapper class which is used to convert primitive boolean into object and object into primitive.
  • Primitive means variable of type boolean.
  • Rest statements give error.

Question 30::

  • Answer is (c) String.
  • String is used to declare variables of type string.
  • Boolean, Integer, Byte these are wrapper class used to declare objects of type they represent.

Question 5::

  • Answer is (d) The counter which gets incremented determines the number of loop iterations is within the parentheses of a while loop.
  • The while() loop is used when we don’t know how many times we need to run the code.
  • In this situation while loop is used. At every start of the loop the condition is checked to run the loop or to break.
  • Condition is checked in parentheses of the while loop. It is boolean exprsession which return true or false.
  • Suppose the condition is whether i==0 or no, if i is equal to zero then loop is executed and also i is updated.
  • Loop exits when condition returns false.
Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?