SOLVED| GRADED A+
b Which of the following is one of the basic features of Dependency Injection (DI)?
a. Maintenance
b. Registration
c. Implementation
d. Deployment
a Give the block of code
[XmlRoot("Candidate")]
public class Person {
[XmlElement("FirstName")]
public string Name { get; set; }
[XmlElement("RoughAge")]
public int Age { get; set; }
}
class Program{
static void Main(string[] args){
Person p1 = new Person() { Name="David", Age=30 };
var xs = new XmlSerializer(typeof(Person));
using Stream s1 = File.Create("pe.xml");
xs.Serialize(s1, p1);
s1.Close();
using Stream s2 = File.OpenRead("person.xml");
var p2 = (Person)xs.Deserialize(s2);
Console.WriteLine("****Person Info****");
,Console.WriteLine($"Name: {p2.Name}, Age: {p2.Age}");
s2.Close();
Console.ReadLine();
}
}
Choose the result.
a. Throws an exception
b. ****Person Info****
<?xml version="1.0"?>
<Candidate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<FirstName>David</FirstName>
<RoughAge>30</RoughAge>
</Candidate>
c. ****Person Info****
Name: David, Age: 30
d. Syntax Error
b Model Binding in Razor Pages is the process that takes values from HTTP requests and
maps them to handler method parameters or
PageModel properties. Choose the correct way to bind the posted form values to handler
method parameters.
a. [BindProperties]
public class ModelBindingDemo : PageModel
{
[BindProperty]
public string Name { get; set; }
[BindProperty]
,public string Email { get; set; }
public void OnGet()
{
}
public void OnPost()
{
ViewData["confi rmation"] = $"{Name}, information will be sent to {Email}";
}
}
b. public class ModelBindingDemo : PageModel
{
[BindProperty]
public string Name { get; set; }
[BindProperty]
public string Email { get; set; }
public void OnGet()
{
}
public void OnPost()
{
ViewData["confi rmation"] = $"{Name}, information will be sent to {Email}";
}
}
c. public class ModelBindingDemo : PageModel
{
public void OnGet()
{
, }
public void OnPost(string name, string email)
{
ViewData["confi rmation"] = $"{name}, information will be sent to {email}";
}
}
d. [BindProperties]
public class ModelBindingDemo : PageModel
{
public void OnGet()
{
}
public void OnPost(string name, string email)
{
ViewData["confi rmation"] = $"{name}, information will be sent to {email}";
}
}
b The scaff olding tool features a number of generators including ones for producing MVC
areas, controllers and views, and Razor Pages.
Choose the templates exist for Razor Pages.
a. Empty, AddNew, Edit, Delete, Details, ListAll
b. Empty, Create, Edit, Delete, Details, List
c. Empty, New, Edit, Delete, Details, List
d. Empty, Create, Edit, Delete, Details, ListAll
c Which of the following statements related to Interface Segregation Principle is True?