C# QUESTION 36 Why do we want to use polymorphism when developing good Object Or
ID: 3717142 • Letter: C
Question
C#
QUESTION 36 Why do we want to use polymorphism when developing good Object Oriented solutions? One function call can have many different results, depending on the data type being sent in Prevents a developer from having to write many if statements to catch the different data types O Allows for cleaner and simpler code because we only use one function name with different signatures All of the above None of the above QUESTION 37 If my class PassTest implemented the lEnumerator class, what methods must I implement in the class? Current, Reset, MoveNext Reset, GetEnumerator Current, MoveNextExplanation / Answer
Answer 36: All of above
Polymorphism is occurrence an entity that has single name and many forms which acts differently in different situations or circumstances. (the later part is very imp in the definition). It reduces our complexities.
Answer 37: GetEnumerator
What is IEnumerable interface ?
IEnumerable is an interface that defines one method GetEnumerator which returns an IEnumerator interface, this allows readonly access to a collection then collection that implements IEnumerable can be used with a for-each statement.
Answer 33: var student = new { Name = "Johnny", Age = 19, Major = "Anthropoloy" };
Anonymous types allow us to create new type without defining them. This is way to defining read only properties into a single object without having to define type explicitly. Here Type is generating by the compiler and it is accessible only for the current block of code. The type of properties is also inferred by the compiler.
We can create anonymous types by using “new” keyword together with the object initializer.
Answer 34: When a class is declared
Instantiate - Instantiating a class means to create a new instance of the class.
Answer 31: All of the above described the static keyword usage properly
The 'static' keyword in C# is refering to something in the class, or the class itself, that is shared amongst all instances of the class. For example, a field that is marked as static can be accessed from all instances of that class through the class name.
A static class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. In other words, you cannot use the new keyword to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself.
Answer 32: Private
Private:
The scope of the accessibility is limited only inside the classes or struct in which they are declared. The private members cannot be accessed outside the class and it is the least permissive access level.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.