Nota:
- La solución de las siguientes preguntas pueden ayudarte a aprobar el módulo, siempre y cuando sean las mismas que me mostraron.
- Dos asteriscos (**) significa Alternativa Correcta.
- Las preguntas y respuestas están en ingles y en español.
- Alternativas sin marcar significa que me equivoque en la respuesta, por consiguiente depende únicamente de tu conocimiento. Si logras identificar la alternativa correcta compártela en este Sitio Web y si te tocan nuevas preguntas también. Gracias!
Filtrado y administración de colecciones de datos mediante LINQ
1. Given this code:
var books = new List<Book>() {
new Book { ISBN = "978-1455509126", Title = "So Good They Can't Ignore You", Author = "Cal Newport", Category="Self Help", Year=2013},
new Book { ISBN = "978-0465050659", Title = "The Design of Everyday Things", Author = "Don Norman", Category="Design", Year=2013},
new Book { ISBN = "978-0321965516", Title = "Don't Make Me Think", Author = "Steve Krug", Category="Design", Year=2014},
new Book { ISBN = "978-1594484803", Title = "Drive", Author = "Daniel Pink", Category="Self Help", Year=2011}
};
var myBooks = books.Where(p => p.Year == 2013).OrderBy(p => p.Title);
foreach (var book in myBooks)
{
Console.WriteLine(book.Title);
}
Console.ReadLine();
... what would you expect to be displayed in the Command Window?
Dado este código:
var books = new List<Book>() {
new Book { ISBN = "978-1455509126", Title = "So Good They Can't Ignore You", Author = "Cal Newport", Category="Self Help", Year=2013},
new Book { ISBN = "978-0465050659", Title = "The Design of Everyday Things", Author = "Don Norman", Category="Design", Year=2013},
new Book { ISBN = "978-0321965516", Title = "Don't Make Me Think", Author = "Steve Krug", Category="Design", Year=2014},
new Book { ISBN = "978-1594484803", Title = "Drive", Author = "Daniel Pink", Category="Self Help", Year=2011}
};
var myBooks = books.Where(p => p.Year == 2013).OrderBy(p => p.Title);
foreach (var book in myBooks)
{
Console.WriteLine(book.Title);
}
Console.ReadLine();
... ¿qué esperaría que se muestre en la ventana de comandos?
Don't Make Me Think
So Good They Can't Ignore You
Don't Make Me Think
So Good They Can't Ignore You
**So Good They Can't Ignore You
The Design of Everyday Things
So Good They Can't Ignore You
The Design of Everyday Things
The Design of Everyday Things
So Good They Can't Ignore You
The Design of Everyday Things
So Good They Can't Ignore You
So Good They Can't Ignore You
Don't Make Me Think
So Good They Can't Ignore You
Don't Make Me Think
2. Given this code:
var books = new List<Book>() {
new Book { ISBN = "978-1455509126", Title = "So Good They Can't Ignore You", Author = "Cal Newport", Category="Self Help", Year=2013},
new Book { ISBN = "978-0465050659", Title = "The Design of Everyday Things", Author = "Don Norman", Category="Design", Year=2013},
new Book { ISBN = "978-0321965516", Title = "Don't Make Me Think", Author = "Steve Krug", Category="Design", Year=2014},
new Book { ISBN = "978-1594484803", Title = "Drive", Author = "Daniel Pink", Category="Self Help", Year=2011}
};
var myBooks = from b in books
where b.Category == "Self Help"
&& b.Year == 2013
select b;
... which book would be added into the books collection?
Dado este código:
var books = new List<Book>() {
new Book { ISBN = "978-1455509126", Title = "So Good They Can't Ignore You", Author = "Cal Newport", Category="Self Help", Year=2013},
new Book { ISBN = "978-0465050659", Title = "The Design of Everyday Things", Author = "Don Norman", Category="Design", Year=2013},
new Book { ISBN = "978-0321965516", Title = "Don't Make Me Think", Author = "Steve Krug", Category="Design", Year=2014},
new Book { ISBN = "978-1594484803", Title = "Drive", Author = "Daniel Pink", Category="Self Help", Year=2011}
};
var myBooks = from b in books
where b.Category == "Self Help"
&& b.Year == 2013
select b;
... ¿qué libro se agregaría a la colección de libros?
**So Good They Can't Ignore You
So Good They Can't Ignore You
The Design of Everyday Things
The Design of Everyday Things
Don't Make Me Think
Don't Make Me Think
Drive
Drive
Espero haber ayudado en algo. Hasta la próxima oportunidad!
Twittear
Hola, Se ve genial el curso lo busco en MVA pero solo lo encuentro en ingles.
ResponderEliminarHola Anónimo, gracias por la visita y el aporte de tu comentario!!
EliminarEsta versión del curso viene mezclado en ingles y español.
Éxitos!! Hasta cualquier momento!!