Find the error(s) in each of the following code segments. Explain how to correct the error. a)
Question:
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");
}
}
Correction: Move the declaration of H outside the declaration of G.
b) int Sum(int x, int y)
{
int result;
result = x + y;
}
c) void F(float a);
{
float a;
Console.WriteLine(a);
}
d) void Product()
{
int a = 6, b = 5, c = 4, result;
result = a * b * c;
Console.WriteLine("Result is " + result);
return result;
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 83% (12 reviews)
a Error Method H is declared within method G b Error The method i...View the full answer
Answered By
Lamya S
Highly creative, resourceful and dedicated High School Teacher with a good fluency in English (IELTS- 7.5 band scorer) and an excellent record of successful classroom presentations.
I have more than 2 years experience in tutoring students especially by using my note making strategies.
Especially adept at teaching methods of business functions and management through a positive, and flexible teaching style with the willingness to work beyond the call of duty.
Committed to ongoing professional development and spreading the knowledge within myself to the blooming ones to make them fly with a colorful wing of future.
I do always believe that more than being a teacher who teaches students subjects,...i rather want to be a teacher who wants to teach students how to love learning..
Subjects i handle :
Business studies
Management studies
Operations Management
Organisational Behaviour
Change Management
Research Methodology
Strategy Management
Economics
Human Resource Management
Performance Management
Training
International Business
Business Ethics
Business Communication
Things you can expect from me :
- A clear cut answer
- A detailed conceptual way of explanation
- Simplified answer form of complex topics
- Diagrams and examples filled answers
4.90+
46+ Reviews
54+ 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 and explain how to correct it: a) i = 1; while (i
-
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...
-
Air flows through the fine mesh gauze shown in the figure below with an average velocity of 1.50 m/s in the pipe. Determine the loss coefficient for the gauze. KL= i 8.1mm V = 1.5 m/s Water Gauze...
-
Provide a reason why a real estate salesperson should not have the same amount allocated to his or her home as the average person?
-
What is the probability that the next person asked has two tattoos? Use the frequency distribution.
-
Describe a variety of negligent errors that have application to all healthcare professionals.
-
A monopolists inverse demand function is P = 100 Q. The company produces output at two facilities; the marginal cost of producing at facility 1 is MC1(Q1) = 4Q1, and the marginal cost of producing...
-
Milden Company is a merchandiser that plans to sell 4 1 , 0 0 0 units during the next quarter at a selling price of $ 5 9 per unit. The company also gathered the following cost estimates for the next...
-
Consider the operations of a fast-food restaurant serving pre-made pasta dishes to its guests. The operation consists of four steps. Each customer is first greeted and offered a menu and a tray,...
-
Give the method header for each of the following methods: a) Method Hypotenuse, which takes two double-precision, floating-point arguments side1 and side2 and returns a double-precision,...
-
Write a complete C# app to prompt the user for the double radius of a sphere, and call method SphereVolume to calculate and display the volume of the sphere. Write an expression-bodied method...
-
Find the derivative of the functions in Problems. f(x) = (ln x) 3
-
Using definitions and actual values in your answers, identify the period of time in which Japan experienced: a) inflation b) disinflation c) deflation. Time % change in consumer prices 2 w Jan-08...
-
Lady MacBath is a business selling bottles of dry cleaning solvent (spot remover) for \(\$ 10\) each. The variable cost for each bottle is \(\$ 4\). Lady MacBath's total fixed cost for the year is...
-
The Cobbler Company shows the following revenue, expense and withdrawals account balances on 31 December of the current year, before closing: Required: Prepare closing entries. Account titles A. B....
-
The following are various accounts related to the income statement and owner's equity of Lynn Company (a sole proprietorship) for the current year. Required: From the information given, prepare the...
-
Suppose you work for the Miniola Hills Bus Company. The business' ten buses made a total of 80 trips per day on 310 days last year, for a total of 350000 kilometres. Another year like last year will...
-
A World Health Organization study (the MONICA project) of health in various countries reported that in Canada, systolic blood pressure readings have a mean of 121 and a standard deviation of 16. A...
-
Per Bag Direct materials: 25 pounds of CWhiz-2000 @ $0.08/lb. = $ 2.00 Direct labor: 0.05 hour @ $32.00/hr. = $ 1.60 The company manufactured 100,000 bags of Cheese-Be-Good in December and used...
-
Although keys in a map are distinct, the binary search algorithm can be applied in a more general setting in which an array stores possibly duplicative elements in nondecreasing order. Consider the...
-
Describe how to perform a removal from a hash table that uses linear probing to resolve collisions where we do not use a special marker to represent deleted elements. That is, we must rearrange the...
-
Consider the goal of adding entry (k,v) to a map only if there does not yet exist some other entry with key k. For a map M (without null values), this might be accomplished as follows. if (M.get(k)...
-
Jorgansen Lighting, Incorporated, manufactures heavy-duty street lighting systems for municipalities. The company uses variable costing for internal management reports and absorption costing for...
-
Assume that the stock of South Gate Corporations sells for R108 and is expected to increase by a factor of 1.25 or decline by a factor of 0.83 in 10 months. As a portfolio analyst, you find a call...
-
Use the below information to calculate the profit or loss of a short call butterfly spread if the spot price of the underlying asset at maturity is R89.45. June 70 Call costs R1.18 June 70 Put costs...
Study smarter with the SolutionInn App