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: 84% (13 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?
-
The following are the sales transactions of EcoMart Merchandising. EcoMart uses a perpetual Inventory system and the gross method. October 1 Sold merchandise for $3,000, with credit terms n/30,...
-
Bearings that are oil lubricated can be stationary sumps or can be fed by oil pumps. Where should the oil level be in a bearing with a slinger ring?
-
1. How, according to Ignatieff, is the conversation about global ethics different todayas opposed to the old days of colonialism and decolonization? 2. Why does Ignatieff think that the idea of a...
-
The Court of Appeal case between Chan Sze Ying and the Management Corporation Strata Title Plan No 2948. Lee Chuen T'ng intervened in the case. The case involves an Originating Summons related to...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
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...
-
The steel axle of a large winch on an ocean liner is subjected to a torque of 1.65 kN . m (see figure). What is the minimum required diameter dmin if the allowable shear stress is 48 MPa and the...
-
In the chapter titled Macroeconomic Equilibrium: Aggregate Demand and Supply, the aggregate supply (AS) curve was upward sloping. Now, in this chapter, we have a flat AS curve. What are the...
-
The cross-price elasticity of the demand for cell phones and DVDs is 1.2. Explain. The cross-price elasticity of the demand for the iPod and DVDs is - 1.4. Explain.
-
Derive the aggregate demand curve from an aggregate expenditures diagram. Explain how aggregate demand relates to aggregate expenditures.
-
Consider flow over a flat plate where the surface of the plate has a temperature distribution. Here we are solving the situation for the unheated starting length but once the plate is heated, the...
-
What is a value-added tax (VAT), and what is an advantage of such a tax relative to an income tax?
-
When introns were first discovered, they were thought to be genetic junkthat is, sequences without any useful function. In fact, they appeared to be worse than junk because they actually interrupted...
-
Anna, a high school counselor, devised a program that integrates classroom learning with vocational training to help adolescents at risk for school dropouts stay in school and transition to work...
-
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)...
-
Assume that a robot systems constant failure and repair rates are 0.0004 failures per hour and 0.002 repairs per hour, respectively. Calculate the robot system steady-state unavailability and...
-
March 6, 2018 David Beckham's Latest Pitch: Men's Cosmetics. By Robert Williams Men of the world, David Beckham has a message for you: Moisturize. "It's the biggest thing," he says in a London...
-
3. On January 1, an investment fund was opened with an initial balance of 5000. Just after the balance grew to 5200 on July 1, an additional 2600 was deposited. The annual effective yield rate for...
Study smarter with the SolutionInn App