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: 85% (14 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 relationship between conversion value, bond value, and market value for a convertible security?
-
Tip Top Advertising, Inc., engaged in the following business transactions during July of 2010: Tip Top Advertising, Inc., uses the following accounts: Cash, Accounts Receivable, Supplies, Building,...
-
Summary income statement information for Pas Corporation and its 70 percent-owned subsidiary, Sit, for the year 2012 is as follows (in thousands): REQUIRED: 1. Assume that Pas acquired its 70 percent...
-
Use one real world example to show me that we can create scarcity. ( 25-50 words). Sample answer Time-Limited scarcity: in time-limited offers, we need to decide before a set deadline - this adds a...
-
For R, partition the data sets into 60% training and 40% validation and implement the 10-fold cross-validation. Use the statement set. seed(1) to specify the random seed for data partitioning and...
-
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...
-
A recent issue of the AARP Bulletin reported that the average weekly pay for a woman with a high school degree is $520 (AARP Bulletin, JanuaryFebruary, 2010). Suppose you would like to determine if...
-
What ethical considerations arise in the implementation of stress management programs within organizational contexts, particularly concerning issues of confidentiality, privacy, and the stigma...
-
4. (14 points) Two source charges are located as shown in the figure. Point P is located 2 cm directly in the +y direction from q as shown. Point P2 is above q, closer than 2 cm, but the exact...
-
How to fix the application error ? describe the steps and procedure you would follow to fix the errors
-
How do change management methodologies such as Kotter's eight-step model, Lewin's three-step model, and Prosci's ADKAR framework provide structured approaches for planning, executing, and evaluating...
-
3. A group of hikers sets out from point A, proceeds to B, then to C, and finally to D. The entire trip takes 6.0 h. N B 8.0 km C W E 2.0 km A 8.0 km (a) Determine the hikers' average speed for the...
-
In problem, determine the quadratic function whose graph is given. 2 -1 -3 1 x (0, 1) -2- Vertex: (-1, 2) 2.
-
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)...
-
Windhoek Mines, Limited, of Namibia, is contemplating the purchase of equipment to exploit a mineral deposit on land to which the company has mineral rights. The company estimated the following cash...
-
Andretti Company has a single product called a Dak. The company normally produces and sells 88,000 Daks each year at a selling price of $58 per unit. The company's unit costs at this level of...
-
Scenario 1 A long-established caf located in inner west Brisbane residential suburb is facing it's time to figure out their budget for the coming quarter. During the last quarter, the caf had spent...
Study smarter with the SolutionInn App