nqLi Flashcards

1
Q

What is LINQ?

A

language integrated query

A tool for filtering a set of data
eg, fundamental types (arrays, lists, collections)
as well as SQL DBs, XML, and .NET collections

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

lambda pattern

A

consists of:

  • input parameters
  • lambda operator
  • expression

(input parameters) => expression

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

Predicate?

A
  • test case

- this type of delegate that gets evaluated to true or false

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

How would you select all numbers > 90

int[] scores = new int[] { 97, 92, 81, 60 };

A

IEnumerable scoreQuery = from score in scores where score > 90 select score;

Note this will not actually run until scoreQuery is used elsewhere, such as in a for loop

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

What are LINQ queries converted to at compile time?

A

Standard Query Operator method calls according to the rules set forth in the C# specification

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

Count and Max must be used with what syntax?

A

Method Syntax

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

The query expression contains what three clauses?

A

from
where
select

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

Can a single LINQ query retrieve data from a SQL database, and produce an XML stream as output?

A

Yes

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

What methods can you use to force immediate execution of any query and cache its results?

A

ToList()

ToArray()

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

When you call a delegate in another function, do you use braces on the delegate?

A

No

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

partitioning operator?

A

deal with finding and extracting a subset of objects

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

what is a function’s signature?

A

its type and its parameters

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

What are anonymous types?

A

when the type is configured at compile time

a way to not have to think about what type of data this is (int, array, string, etc)

var

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

What is the join operator?

A

Correlates the elements of two sequences based on matching keys

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

What are aggregates?

A

Analysis operations on a data set

sum, count, average

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

What are set operators?

A

Operators deal with performing comparisons on the contents of a single set or across multiple sets of data

distinct, except, union, intersect, concat

17
Q

What are some Conversion Operators?

A

ToList
ToArray
ToDictionary
ToLookup

18
Q

What is a higher order function?

A

Any function which takes a function as an argument, returns a function, or both

19
Q

How do delegates differ from C++ pointers?

A

Delegates are object-oriented, type safe, and secure

20
Q

What is an asynchronous callback?

A

This allows a method to accept a delegate as a parameter, and call the delegate at some later time

21
Q

What is the using statement in c#?

A

The using statement obtains one or more resources, executes a statement, and then disposes of the resource