Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

EF Core advanced

Total questions: 21

Worksheet time: 20mins

Name
Class
Date
1.

.Where(Func<int, int> predicate) is a signature of

a)

IEnumerable

b)

IQueryable

2.

To provide lazy loading we need to mark navigation property as _____ and the entity should not be _____

(write two words separated by space)

(a)  

3.

TPH розшифровується як (a)  

4.

What can IEnumerable do?

a)

LINQ-to-SQL

b)

LINQ-to-Object

c)

Can pass a compiled function to LINQ extensions

d)

Can pass an expression tree to LINQ extensions

5.

How Include() solves N+1 problem?

a)

By running queries asynchronously

b)

Using JOIN

c)

By grouping big number of queries

6.

What will be returned if LazyLoading is turned On and Off respectively ?

var countries = db.Countries.Take(3);


var capitals = new List<Capital>();


foreach(var country in countries)

{

capitals.Add(country.Capital.Name);

}


return capitals;

a)

On (null reference exception) | Off (null reference exception)

b)

On (null reference exception) | Off (returns list of Capital names)

c)

On (returns list of Capital names) | Off (null reference exception)

d)

On (returns list of Capital names) | Off (returns list of Capital names)

7.

Which additional method(s) we can use in the explicit loading?

a)

Collection()

b)

LoadAll()

c)

Reference()

8.

Сhoose the correct statement(s) about TPH

a)

An entire class hierarchy can be mapped to a single table

b)

Every class and subclass including abstract classes has its own table

c)

The table includes columns for all properties of all classes in the hierarchy

d)

Representing inheritance relationships as relational foreign key associations

9.

Which method should we use after [Include()] to continue including further levels of related data?

a)

Include()

b)

ThenInclude()

c)

Select()

d)

ThenSelect()

10.

n+1 problem is caused by:

a)

Too many joins in one query

b)

Too many separate queries

11.

_________ means that the related data is transparently loaded from the database when the navigation property is accessed.

a)

Eager

b)

Explicit

c)

Lazy

12.

It is a process to delay the loading of related objects until it is required.

a)

Lazy Loading

b)

Eager Loading

c)

Explicit Loading

13.

Використовуючи lazy loading, ви підвантажили всіх користувачів у контекст. У базі змінилися дані деяких користувачів.

Чи буде контекст використовувати оновлені дані?

a)

Так

b)

Ні

14.

How many tables EF will create for all these classes?

class A { }


class B : A { }


class C : B { }


class D { }


class E : D { }

a)

1

b)

2

c)

3

d)

4

e)

5

15.

How many tables`ll be created, if EF core`s configuration is left to default ?

(write a number)

(a)  

16.

Expression<TDelegate> is compiled into a data structure called an expression (a)   (if empty, enter '-').

17.

Чи потрібно завжди використовувати Include() щоб отримати зв'язані дані?

a)

Так

b)

Ні

18.

Fill in the gaps

(a)  

19.

Сhoose the correct statements:

a)

IEnumerable is located in the System.Collections namespace

b)

IQueryable inherits from ICollection

c)

IQueryable doesn’t support lazy loading

d)

IEnumerable represents a set of data in memory and can only move forward through this data.

20.

Choose disadvantages of repository pattern:

a)

It force programmer to work using the same pattern.

b)

Encapsulates large database queries in methods

c)

The number of classes is growing

d)

Limits the use of the features of the ORM framework

21.

Нехай ми маємо такий код.

Якщо list це IEnumerable то сигнатура методу Where буде такою: Where(Func<int, bool> predicate)

Якою буде сигнатура методу Where, якщо list це IQueryable

list.Where(x => x > 0);

(a)