INFO5101 - Exam Flashcards

(43 cards)

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?

19
Q

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

20
Q

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

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
What namespace holds the Enumerable and Queryable classes?
System.Linq
26
What is it called when a method yields data in a just-in-time fashion?
Deferred Execution
27
What are 2 methods that use deferred execution?
1. Range 2. Reverse
28
What type does the Where() method return?
IEnumerable< T >
29
Three benefits of extension methods are improved readability, calling as if they were instance methods, and what?
Easily chained together
30
What is the main difference between using OrderBy() and .Sort()?
OrderBy returns a new list, Sort changes the original list
31
What is meant by LINQ operators are side-effect-free?
They don't change their input or the environment
32
Where does the side-effect-free approach come from?
Functional Programming
33
LINQ
Language-Integrated Query
34
How does a query expression start?
Stating the source of data
35
What else is the select clause known as?
Projection
36
The first compiler phase of translating query expressions is a ____________ step
Preprocessor
37
Query expressions are first compiled into what?
Dot Notation
38
Why are query expressions backwards compared to SQL queries?
Processed in the order it is written
39
Can all query expressions be written in dot notation?
Yes
40
Can all dot notation queries be written as a query expression?
No
41
What happens when an async method is awaiting a process?
Control returns to caller of method
42
What is a continuation?
Callback to be executed after asynchronous operation has completed
43
What are the 3 possible return types of an async method?
1. Void 2. Task 3. Task< TResult>