Identify and correct the errors in each of the following pieces of code. [There may be more
Question:
Identify and correct the errors in each of the following pieces of code. [There may be more than one error in each piece of code.]
a) if (age >= 65);
{
Console.WriteLine("Age greater than or equal to 65");
}
else
{
Console.WriteLine("Age is less than 65)";
}
b) int x = 1, total;
while (x <= 10)
{
total += x;
++x;
}
c) while (x <= 100)
total += x;
++x;
d) while (y > 0)
{
Console.WriteLine(y);
++y;
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 60% (5 reviews)
a The semicolon at the end of the if condition should be removed The closing double quote of ...View the full answer
Answered By
Gaurav Soni
Teaching was always an area where I can pursue my passion. I used to teach my friends and junior during my school and college life. After completing my professional qualification (chartered accountancy) and before joining my job, I also joined an organization for teaching and guidance to my juniors. I had also written some articles during my internship which later got published. apart from that, I have also given some presentations on certain amendments/complex issues in various forms.
Linkedin profile link:
https://www.linkedin.com/in/gaurav-soni-38067110a
5.00+
7+ Reviews
13+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
Identify and correct the errors in each of the following statements: a) if (c < 7); { Console.WriteLine("c is less than 7"); } b) if (c => 7) { Console.WriteLine("c is equal to or greater than 7"); }
-
Identify and correct the errors in each of the following sets of code: a) while (c
-
The purpose of this exercise is to demonstrate the importance of testing an application thoroughly. Open the FixIt Solution.sln file contained in the VB2017\Chap04\FixIt Solution folder. The...
-
A sample of adults and teenagers were asked about the type of movies they like best. The collected data is grouped in the below table: Comedy Action Science Fiction Total Teenagers 40 60 50 150...
-
Explain the difference between sensitivity and scenario analyses?
-
Colbyco Industries has a target capital structure of 60 percent common equity, 30 percent debt, and 10 percent preferred stock. The cost of retained earnings is 15 percent, and the cost of new equity...
-
The balance sheet data for Quick Care, Inc. September 30, 2010, follow: Requirement 1. The following are three independent assumptions about the business during September. For each assumption,...
-
Kendall Jackson, CPA, is examining the operating effectiveness of the internal control of Town Mo, a large conglomerate in the music industry. As part of the evaluation, Jackson determined a...
-
1.The common stock of B&S currently sells for $23 per share. It is expected that a constant growth rate of 10.5% and end-of-year dividend of $2.5. a.What if your required rate of return? b.If you...
-
The following relate to auditors independence: a. Why is independence so essential for auditors? b. Compare the importance of independence of CPAs with that of other professionals, such as attorneys....
-
What is the difference between the prefix increment operator and the postfix increment operator?
-
What does the following app display? // Ex. 5.16: Mystery.cs 2 using System; 3 4 class Mystery { static void Main() { int x = 1; int total 0; 10 while (x
-
You have finally saved $10,000 and are ready to make your first investment. You have the three following alternatives for investing that money: Capital Cities ABC, Inc. bonds with a par value of...
-
List some entrepreneurial innovation ideas that can address societal challenges ?
-
Voice Com, Inc., produces and sells cellular phones. The costs of producing and selling 5,000 units of cellular phones are as follows: Variable costs: Fixed costs: Direct materials $ 94 per unit...
-
1. As seen by an observer on Earth, two stars are separated by an angle of 0.0005. What is the minimum diameter of a telescope required for an Earth astronomer to see two separate stars? (Assume a...
-
Program a multithreaded sum application in Java. The program will sum up all the numbers from 1 to 500,000,000. The result should be 125,000,000,250,000,000. Define a function for each of the...
-
Cost of Sales Forecasting Once the expected sales have been determined, the next step is to look for trends and relationships among the various components of costs. For instance, one trend that often...
-
Suppose that f(x) = 3x + 5 and g(x) = -2x + 15. (a) Solve f(x) = 0. (b) Solve f(x) < 0. (c) Solve f(x) = g(x). (d) Solve f(x) g(x). (e) Graph y = f(x) and y = g(x) and label the point that...
-
Represent each of the following combination of units in the correct SI form using an appropriate prefix: (a) m/ms, (b) k m, (c) k s /mg, and (d) k m N.
-
For each function f (n) and time t in the following table, determine the largest size n of a problem P that can be solved in time t if the algorithm for solving P takes f (n) microseconds (one entry...
-
Given an n-element array X, Algorithm D calls Algorithm E on each element X[i]. Algorithm E runs in O(i) time when it is called on element X[i]. What is the worst-case running time of Algorithm D?
-
Al and Bob are arguing about their algorithms. Al claims his O(nlogn)-time method is always faster than Bobs O(n 2 )-time method. To settle the issue, they perform a set of experiments. To Als...
-
Oxford Company has limited funds available for investment and must ration the funds among four competing projects. Selected information on the four projects follows: Project Investment Required...
-
Fix Manufacturing specifies the quality characteristic of one of its popular products to be 0.500" 0.020. An analysis of company records for the last two years suggests that the average cost for...
-
Houghton Chemicals, which started operations one year ago, has two divisions: Alloys and Petro. Both divisions invest heavily in R&D, which is assumed to generate benefits for five years. R&D...
Study smarter with the SolutionInn App