INFO5101 - Exam Flashcards

1
Q

What are the data structures which represent the logic of the lambda expressions and can be examined by other code called?

A

Expression Trees

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Lambda expressions can be seen as an evolution of what?

A

Anonymous Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the maximum number of parameters a Func<> declaration can include?

A

16

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an example of a Func delegate signature that takes 2 arguments?

A

TResult Func<T1, T2, TResult>(T1 arg1, T2 arg2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the last type parameter in a Func delegate?

A

The return type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the return type of an Action<…> delegate?

A

Void

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the lambda declaration operator?

A

=>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What operator means “goes to”

A

Lambda Declaration Operator (=>)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is on the left hand side of the lambda declaration operator?

A

Parameter List

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is on the right hand side of the lambda declaration operator?

A

Method Body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is an implicitly typed lambda expression?

A

Comma-separated list of names without types for the parameter list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the rule with implicitly typed lambda expressions?

A

All parameters must be implicit or explicit. Cannot mix and match

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

When MUST you use explicit typing with lambda expressions?

A

If any parameters are “out” or “ref”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which expressions are created first in expression trees?

A

Leaf expressions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is meant by “expressions are immutable”?

A

Once created it cannot change

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What do you get when you combine lambda expressions, expression trees, and extension methods?

A

Language side of LINQ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Extension methods can only be declared in what type of class?

A

Static

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Can an extension class be generic?

A

No

19
Q

What is the minimum number of parameters for an extension method?

A

1

20
Q

What must the first parameter of an extension method be prefixed with?

A

this

21
Q

What 3 things can the first parameter of an extension method NOT be?

A
  1. out
  2. ref
  3. pointer type
22
Q

What is it called when the compiler is trying to decide which method to use when an extension method is called?

A

Compiler Resolution

23
Q

What happens if there is an instance method that matches an extension method’s expression type?

A

The instance method is used

24
Q

What are the 2 classes that contain most of the extension methods for LINQ providers?

A
  1. Enumerable
  2. Queryable
25
Q

What namespace holds the Enumerable and Queryable classes?

A

System.Linq

26
Q

What is it called when a method yields data in a just-in-time fashion?

A

Deferred Execution

27
Q

What are 2 methods that use deferred execution?

A
  1. Range
  2. Reverse
28
Q

What type does the Where() method return?

A

IEnumerable< T >

29
Q

Three benefits of extension methods are improved readability, calling as if they were instance methods, and what?

A

Easily chained together

30
Q

What is the main difference between using OrderBy() and .Sort()?

A

OrderBy returns a new list, Sort changes the original list

31
Q

What is meant by LINQ operators are side-effect-free?

A

They don’t change their input or the environment

32
Q

Where does the side-effect-free approach come from?

A

Functional Programming

33
Q

LINQ

A

Language-Integrated Query

34
Q

How does a query expression start?

A

Stating the source of data

35
Q

What else is the select clause known as?

A

Projection

36
Q

The first compiler phase of translating query expressions is a ____________ step

A

Preprocessor

37
Q

Query expressions are first compiled into what?

A

Dot Notation

38
Q

Why are query expressions backwards compared to SQL queries?

A

Processed in the order it is written

39
Q

Can all query expressions be written in dot notation?

A

Yes

40
Q

Can all dot notation queries be written as a query expression?

A

No

41
Q

What happens when an async method is awaiting a process?

A

Control returns to caller of method

42
Q

What is a continuation?

A

Callback to be executed after asynchronous operation has completed

43
Q

What are the 3 possible return types of an async method?

A
  1. Void
  2. Task
  3. Task< TResult>