Untitled Deck Flashcards

1
Q

What is the most popular language for the .NET platform?

A

“C# is the most popular language for the .NET platform

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

On what devices can C# programs run?

A

“C# programs can run on many devices

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

What kind of language is C#?

A

“C# is a cross-platform

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

What are C#’s ecosystem and workload benefits?

A

“C# has broad support in the ecosystem and is compatible with all .NET workloads.”

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

What programming principles and paradigms does C# support?

A

“C# is based on object-oriented principles and incorporates features from other paradigms

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

What low-level features does C# include?

A

“C# includes low-level features that support high-efficiency scenarios without requiring unsafe code.”

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

What are most .NET runtime and libraries written in?

A

“Most .NET runtime and libraries are written in C#

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

What is the purpose of the ‘Hello, World’ program in C#?

A

“The ‘Hello

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

Write a single-line ‘Hello, World’ program in C# using top-level statements.

A

”// This line prints ‘Hello

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

What does a single-line comment in C# look like?

A

“Single-line comments in C# start with // and continue to the end of the current line.”

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

What does a multi-line comment in C# look like?

A

“Multi-line comments in C# start with /* and end with */.”

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

What does the WriteLine method do?

A

“The WriteLine method of the Console class produces the output of a program. It is part of the System namespace.”

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

Write a ‘Hello, World’ program with a Main method in C#.

A

“using System;\n\nclass Hello\n{\n static void Main()\n {\n // This line prints ‘Hello

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

What does a ‘using’ directive in C# do?

A

“A ‘using’ directive references a namespace

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

What is the purpose of namespaces in C#?

A

“Namespaces provide a hierarchical means of organizing C# programs and libraries.”

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

What is the role of the static modifier in C# methods?

A

“The static modifier indicates that a method operates without reference to a particular object

17
Q

What is the entry point for a C# program without top-level statements?

A

“The entry point is a static method named Main when there are no top-level statements.”

18
Q

How does the compiler handle top-level statements in C#?

A

“When using top-level statements

19
Q

Where can you start learning C# as a beginner?

A

“Beginner tutorials and links in C# documentation are good starting points. Experienced developers can also read tips for transitioning from Java

20
Q

What makes C# approachable for developers?

A

“C# is approachable for beginners and offers advanced features for experienced developers writing specialized applications. Developers can quickly become productive and learn more specialized techniques as needed.”

21
Q

What memory management benefit does C# provide?

A

“C# apps benefit from the .NET Runtime’s automatic memory management and extensive runtime libraries provided by the .NET SDK.”

22
Q

What are platform-independent libraries in .NET?

A

“Platform-independent libraries in .NET include file system libraries

23
Q

What are some workload-specific libraries in .NET?

A

“Workload-specific libraries include ASP.NET Core web libraries and the .NET MAUI UI library.”

24
Q

What is NuGet, and how does it relate to C#?

A

“NuGet is a rich open-source ecosystem that augments the libraries provided by the .NET runtime with additional components.”

25
Q

How is C# syntax familiar to developers?

A

“C# syntax is familiar to those who have used C

26
Q

What type of language is C#?

A

“C# is a strongly typed language where every variable’s type is known at compile time

27
Q

What are C#’s fundamental data types?

A

“C# includes value types like int

28
Q

What is the purpose of the record modifier in C#?

A

“The record modifier in C# allows the compiler to synthesize code for equality comparisons for struct or class types.”

29
Q

What features define C#’s object-oriented behavior?

A

“C# supports object-oriented techniques like inheritance

30
Q

What are exceptions in C#, and how are they handled?

A

“C# uses exceptions to report and handle errors. Exceptions can be thrown to indicate failure and handled using try-catch blocks to recover.”

31
Q

What is LINQ in C#, and what does it do?

A

“LINQ (Language Integrated Query) provides a unified syntax to query or transform collections of data regardless of storage type

32
Q

Write a LINQ query to find students with a GPA greater than 3.5.

A

“var honorRoll = from student in Students\n where student.GPA > 3.5\n select student;”

33
Q

What is asynchronous programming in C#, and what keywords does it use?

A

“Asynchronous programming in C# uses the async and await keywords to write code that reads as though it runs synchronously but executes asynchronously.”

34
Q

Write a C# method using async to get the length of a web page.

A

“public static async Task<int> GetPageLengthAsync(string endpoint)\n{\n var client = new HttpClient();\n var uri = new Uri(endpoint);\n byte[] content = await client.GetByteArrayAsync(uri);\n return content.Length;\n}"</int>

35
Q

What is an await foreach statement in C#?

A

“The await foreach statement in C# iterates over a collection backed by asynchronous operations

36
Q

Write an example of an async iterator in C#.

A

“public static async IAsyncEnumerable<int> ReadSequence()\n{\n int index = 0;\n while (index < 100)\n {\n int[] nextChunk = await GetNextChunk(index);\n if (nextChunk.Length == 0) yield break;\n foreach (var item in nextChunk) yield return item;\n index++;\n }\n}"</int>

37
Q

How can an async iterator be used in C#?

A

“await foreach (var number in ReadSequence())\n{\n Console.WriteLine(number);\n}”

38
Q

What is pattern matching in C#?

A

“Pattern matching in C# enables you to inspect data and make decisions based on its characteristics using a concise and expressive syntax.”

39
Q

Write a C# method using pattern matching for a boolean OR operation.

A

“public static bool Or(bool left