Find the error(s) in each of the following code segments and explain how to correct it: a)
Question:
Find the error(s) in each of the following code segments and explain how to correct it:
a) i = 1;
while (i <= 10);
++i;
}
b) for (k = 0.1; k != 1.0; k += 0.1)
{
Console.WriteLine(k);
}
c) switch (n)
{
case 1:
Console.WriteLine("The number is 1");
case 2:
Console.WriteLine("The number is 2");
break;
default:
Console.WriteLine("The number is not 1 or 2");
break;
}
d) The following code should display the values 1 to 10:
n = 1;
while (n < 10)
{
Console.WriteLine(n++);
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 80% (10 reviews)
a Error The semicolon after the while header causes an infinite loop and ther...View the full answer
Answered By
Somshukla Chakraborty
I have a teaching experience of more than 4 years by now in diverse subjects like History,Geography,Political Science,Sociology,Business Enterprise,Economics,Environmental Management etc.I teach students from classes 9-12 and undergraduate students.I boards I handle are IB,IGCSE, state boards,ICSE, CBSE.I am passionate about teaching.Full satisfaction of the students is my main goal.
I have completed my graduation and master's in history from Jadavpur University Kolkata,India in 2012 and I have completed my B.Ed from the same University in 2013. I have taught in a reputed school of Kolkata (subjects-History,Geography,Civics,Political Science) from 2014-2016.I worked as a guest lecturer of history in a college of Kolkata for 2 years teaching students of 1st ,2nd and 3rd year. I taught Ancient and Modern Indian history there.I have taught in another school in Mohali,Punjab teaching students from classes 9-12.Presently I am working as an online tutor with concept tutors,Bangalore,India(Carve Niche Pvt.Ltd.) for the last 1year and also have been appointed as an online history tutor by Course Hero(California,U.S) and Vidyalai.com(Chennai,India).
4.00+
2+ Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
Find and correct the error in each of the following code segments: a) const int ArraySize = 5; ArraySize = 10; b) Assume var b = new int[10]; for (var i = 0; i
-
Find the error(s) in each of the following code segments. Explain how to correct the error. a) void G() { Console.WriteLine("Inside method G"); void H() { Console.WriteLine("Inside method H"); } }...
-
Find and correct the error(s) in each of the following segments of code: a) For (i = 100, i >= 1, ++i) { Console.WriteLine(i); } b) The following code should display whether integer value is odd or...
-
find the steady state expression for vo in the circuit fig 9.32 if ig = 500cos2000tmA 3) 9.32 Find the steady-state expression for u,, in the circuit of Fig. P9.32 if i = 500 cos 2000 mA. Figure...
-
Indicate what a heuristic is and give four examples of it?
-
On March 2, 2020, Zoe Moreau, Karen Krneta, and Veronica Visentin start a partnership to operate a personal coaching and lifestyle consulting practice for professional women. Zoe will focus on...
-
Which of the following statistics is really the same thing as the effective periodic interest rate that we've discussed in earlier chapters? a. Arithmetic average b. Geometric average c. Population...
-
The Hannam Company decided to change from the declining- balance method of depreciation to the straight- line method effective 1 January 20X7. The following information was provided: The company has...
-
During 20--, Matti Perez, president of Maggert Company, was paid a semimonthly salary of $6,500. Compute the amount of FICA taxes that should be withheld from her: OASDI HI a. 9th paycheck $_____...
-
A contestant on the hit reality television show Top Bartender was asked to mix a variety of drinks, each consisting of 4 fluid ounces. No other ingredients were permitted. She was given the following...
-
Write a C# statement or a set of C# statements to accomplish each of the following tasks: a) Sum the odd integers between 1 and 99, using a for statement. Assume that the integer variables sum and...
-
Describe the four basic elements of counter-controlled iteration.
-
Three blocks rest on a friction less, horizontal table (Fig. P3.36), with m 1 = 10 kg and m 3 = 15 kg. A horizontal force F - 110 N is applied to block 1, and the acceleration of all three blocks is...
-
The following financial information is for Alpha Corporation for the fiscal years ending 2017 & 2016 (all balances are normal): Item/Account 2017 2016 Accounts Receivable $9,800 $9,400 Inventory...
-
During the current year, merchandise is sold for $8,560,000. The cost of the goods sold is $6,077,600. This information has been collected in the Microsoft Excel Online file. Open the spreadsheet,...
-
Under HIPAA, which is a reason for releasing or disclosing patient information? For how long a heart lung machine can be used?
-
The main reason to participate in the underground economy is to avoid Blank______. Multiple choice question. reporting actual savings and paying interest engaging in illegal activities and paying...
-
On December 31, 2018, the following pension-related data were available for CPS Industries' noncontributory, defined benefit pension plan: Projected Benefit Obligation ($ in millions) Balance,...
-
Simplify the expression. Write answers without negative exponents. Assume all variables represent nonzero real numbers. 5 9 /5 7
-
The manager for retail customers, Katie White, wants to hear your opinion regarding one business offer she has received from an entrepreneur who is starting a mobile phone app called Easy Money. The...
-
Redo the justification of Proposition 7.2 assuming that the the cost of growing the array from size k to size 2k is 3k cyber-dollars. How much should each push operation be charged to make the...
-
The java.util.ArrayList includes a method, trimToSize( ), that replaces the underlying array with one whose capacity precisely equals the number of elements currently in the list. Implement such a...
-
Give a justification of the running times shown in Table 7.1 for the methods of an array list implemented with a (nonexpanding) array.
-
Congress is currently debating another round of COVID19, or "Cares Act" Funding. At this point it is uncertain what will be in the funding package. What should AND should NOT be included in the next...
-
On 1 Jan 2017 Wilderness acquired 100% of the share capital of Mossel, whose only activity is the extraction and sale of spa water. Mossel had been profitable since its acquisition, but bad publicity...
-
Hamilton Co. opened its doors for business on January 1st. Below is a chart outlining the purchases and sales of inventory for Hamiltons first month of business: Date Event Units Price 1/3 Purchase...
Study smarter with the SolutionInn App