Question

In: Computer Science

In method overloading, can we have two or more methods with different parameter name and same...

In method overloading, can we have two or more methods with different parameter name and same datatype?

Yes

No

Clear selection

When do we need to do Explicit Casting?

When LHS and RHS data types are different

When size of LHS variable is bigger than LSH

When RHS is an expression and not variable

When all values of RHS variable or expression are not valid for LSH variable

What data type should be used when we want to store any type of data?

int

string

double

object

All classes of a project can be placed in __________.

only one file

must be in different files

either in same file or different files

different project

Strings in .NET are _______

Immutable

Mutable

Modifiable

Which of the following is valid about Optional Parameters?

Every optional parameter must specify a default value

Any parameter of a method can be optional provided it has a default value

Every method must have at least one parameter which is optional.

An optional parameter need not have default value

What is the extension of a Solution file and C# project file created using VS.NET?

.solution & .csproj

.sln & .csproject

.sln & . csproj

.solution & .proj

Solutions

Expert Solution

1. False

In method overloading, if parameter names are different and types are same, then its not a valid method overloading. It should be of different datatypes .

2.

b) when size of LHS is bigger than RHS

we do explicit casting when LHS has bigger size and there is data loss expected when we are trying to assign RHS to LHS.

3.

d) object

As object is parent class of all the classes it can hold any type of data

4.

c) either in same file or different files

When the classes are very small we usually keep all of them in same file . But mostly its recommended that a class is placed in different file. A public

5.

a) Immutable

Strings are immutable in .NET . They cannot be modified.

6.

a) Every optional parameter must have a default value

A default parameter must be at last position not in front and it must have a default value. Without default value, a parameter cannot be optional. And also a method can exist without an optional parameter as well.

7. c) .sln and .csproj


Related Solutions

3) How is it that we all have the same genes, yet we can have different...
3) How is it that we all have the same genes, yet we can have different genotypes for a given gene that results in the expression of a different phenotype? This is not the same answer as the previous question. Again, I am looking for a description of what is happening on a molecular level to result in different phenotypes.
How is it that we all have the same genes, yet we can have different genotypes...
How is it that we all have the same genes, yet we can have different genotypes for a given gene that results in the expression of a different phenotype? Again, I am looking for a description of what is happening on a molecular level to result in different phenotypes.
Name two different chemicals we have discussed or read about that we have added to the...
Name two different chemicals we have discussed or read about that we have added to the carbon cycle at levels that did not exist naturally. a. Which functional group class does each chemical belong to? Explain. b. How do the respective types of bonding and functional group classes of these molecules affect their reactivity? c. What are the health and environmental effects of the two chemicals you choose to report on? Make sure to obtain your information from reliable sources...
Name two different methods for evaluating evidence. Compare and contrast these two methods
Name two different methods for evaluating evidence. Compare and contrast these two methods
We wish to determine if a two sections of the same introductory course have significantly different...
We wish to determine if a two sections of the same introductory course have significantly different “success rates” (defined as the proportion of students who receive a course grade of A, B, or C). The first section meets in the early morning, the second section meets in the late afternoon. Each section has 70 students. Among the early morning section, 59 receive an A, B, or C. Among the late afternoon section, 49 receive an A, B, or C.. Assume...
c++ using class... define operator overloading and give simple example how we can use operator overloading...
c++ using class... define operator overloading and give simple example how we can use operator overloading by writing simple program in which different operators are used to add, subtract, multiply and division.
can two satellites with different masses have the same orbit around the earth?
can two satellites with different masses have the same orbit around the earth?
How can enatiomers have the same chemical and physical properties- even have the same systematic name-...
How can enatiomers have the same chemical and physical properties- even have the same systematic name- but be completely different compunds? I am a little confused on this.
We wish to determine if two instructors teaching the same introductory course have significantly different “DF...
We wish to determine if two instructors teaching the same introductory course have significantly different “DF rates” (defined as the proportion of students who receive a course grade of D or F among all students who complete the course).Each instructor teaches 60 students. Among the first instructor’s students, 21 receive a D or F. Among the second instructor’s students, 16 receive a D or F. Assume these can be treated as independent simple random samples from their respective populations. Use...
Write a method named area with one double parameter name radius. The method needs to return...
Write a method named area with one double parameter name radius. The method needs to return a double value that represents the area of a circle. If the parameter radius is negative , then return -1.0 to present an invalid value Write another overload method with 2 parameters side1 and side2 (both double) where side1 and side2 represent the sides of a rectangle. The method needs to return an area of a rectangle . If either or both parameters is/...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT