All fields

“Records & Pattern Matching” in Information Technology

21 questions across 2 technologies.

Information Technology

21 questions in 2 technologies

#QuestionTechnologyTopicLevel
1How does switch pattern matching improve code? C# › Records & Pattern MatchingC#Records & Pattern MatchingIntermediate
2What are records in C#, and how do they differ from classes and structs? C# › Records & Pattern MatchingC#Records & Pattern MatchingBeginner
3What are property and positional patterns useful for? C# › Records & Pattern MatchingC#Records & Pattern MatchingAdvanced
4When should you NOT use records? C# › Records & Pattern MatchingC#Records & Pattern MatchingAdvanced
5What is a record and how does it differ from a class? C# › Records & Pattern MatchingC#Records & Pattern MatchingBeginner
6What does the with expression do? C# › Records & Pattern MatchingC#Records & Pattern MatchingBeginner
7What is a record struct and when would you use it? C# › Records & Pattern MatchingC#Records & Pattern MatchingIntermediate
8How would you implement the Visitor pattern in Java to add new operations to an existing class hierarchy without modifying those classes, and how do Java's sealed classes and pattern matching (switch expressions) provide a modern alternative? Java › Design Patterns in JavaJavaDesign Patterns in JavaAdvanced
9How would you implement the CQRS (Command Query Responsibility Segregation) pattern's basic structure in a C# application using MediatR-style handlers? C# › Design Patterns in C#C#Design Patterns in C#Advanced
10How would you implement the Builder pattern using method chaining (a fluent API) to construct a complex object step by step? C# › Design Patterns in C#C#Design Patterns in C#Advanced
11How would you use pattern matching (switch expressions) with an enum, including exhaustiveness warnings from the compiler? C# › Enums & FlagsC#Enums & FlagsAdvanced
12How would you design an enum-based state machine using pattern matching to enforce valid state transitions at compile time or runtime? C# › Enums & FlagsC#Enums & FlagsAdvanced
13How does pattern matching in an 'is' expression differ from a traditional type check with 'as' and a null check, and what does it enable? C# › FundamentalsC#FundamentalsAdvanced
14How do C# 12's primary constructors on regular classes (not just records) change how you write simple constructor-and-field boilerplate? C# › FundamentalsC#FundamentalsAdvanced
15What is an abstract class, and how does it differ from a fully concrete base class? C# › Interfaces & Abstract ClassesC#Interfaces & Abstract ClassesBeginner
16How do default interface methods (C# 8+) let an interface provide implementation, and what backward-compatibility problem do they solve? C# › Interfaces & Abstract ClassesC#Interfaces & Abstract ClassesIntermediate
17How do required members (C# 11's 'required' keyword) enforce that certain properties MUST be set during object initialization? C# › Modern C# Features (Global Usings, File-Scoped Namespaces, Top-Level Statements)C#Modern C# Features (Global Usings, File-Scoped Namespaces, Top-Level Statements)Intermediate
18Why is it critical that GetHashCode() only depend on IMMUTABLE fields, and what bug occurs if you violate this rule? C# › Equality: Equals, GetHashCode & IEquatableC#Equality: Equals, GetHashCode & IEquatableAdvanced
19How does record type equality work by default, and how does it differ fundamentally from a regular class's default equality? C# › Equality: Equals, GetHashCode & IEquatableC#Equality: Equals, GetHashCode & IEquatableAdvanced
20How would you design a class hierarchy combining an abstract base class WITH multiple interfaces to model both shared implementation AND multiple independent capabilities? C# › Interfaces & Abstract ClassesC#Interfaces & Abstract ClassesAdvanced
21How would you design a sealed interface (Java 17+) to restrict which classes are permitted to implement it, and what benefit does this provide over a traditional open (unrestricted) interface for exhaustiveness checking? Java › Interfaces & Abstract ClassesJavaInterfaces & Abstract ClassesAdvanced