In: Computer Science
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
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