PRN212-NHS

0.0(0)
studied byStudied by 2 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/128

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

129 Terms

1
New cards

What is Deserialization?


A. The process of converting an object into a stream of bytes for transport or storage.
B. The process of converting a stream of bytes into an object.
C. The process of encrypting data for secure transmission.
D. The process of compressing data for efficient storage.

B*

2
New cards

What is the purpose of a generic interface in C#?
A. To define a template for multiple classes to implement.
B. To restrict the types that can implement the interface.
C. To provide additional functionality to existing classes.
D. Generic interfaces are not supported in C#.

A

3
New cards

Which of the following is true about the return value of the Action delegate type in .NET?
A. It can have a return value of any type.
B. It always returns a specific type.
C. It does not return a value.
D. Action does not have a return value.

C D

4
New cards

How can you subscribe to an event in C#?
A. Using the event keyword
B. Invoking the event delegate
C. Assigning a method to the event delegate
D. Implementing the event handler interface

C

5
New cards

What is a deadlock in concurrency programming?
A. A situation where two or more threads contend for a shared resource indefinitely, resulting in a halt
B. A situation where threads are executed sequentially
C. A situation where there is no coordination between multiple threads
D. A situation where multiple cores are not utilized efficiently

A

6
New cards

Which .NET namespace includes the ParameterizedThreadStart delegate?
A. System.Threading
B. System.Collections
C. System.IO
D. System.Net

A

7
New cards

How do you pass a delegate as a parameter to a method in .NET?
A. Enclose the delegate in quotation marks and pass it as a string
B. Declare the method parameter with the delegate type and pass the delegate instance
C. Use a lambda expression to pass the delegate
D. Delegates cannot be passed as parameters

B

8
New cards

What is the purpose of a lambda expression in LINQ (Language-Integrated Query)?
A. To perform database transactions.
B. To define a custom query operator.
C. To iterate through a collection of objects.
D. To handle exceptions during query execution.

B

9
New cards

How is an event handler implemented for an event?
A. Using a lambda expression
B. Creating a new instance of the delegate
C. Using the event keyword
D. Declaring a separate method with the event signature

D

10
New cards

Which of the following represents the Action delegate type with one parameter and no return value?
A. Action<>
B. Action<T>
C. Action<T, TResult>
D. Action<T, T>

B

11
New cards

What is a static class in C#?
A. A class that cannot be instantiated and can only contain static members.
B. A class that can be accessed from any other assembly.
C. A class that can only be accessed within the same namespace.
D. A class that is automatically generated by the compiler.

A

12
New cards

How do you project specific properties in a LINQ query in Entity Framework Core?
A. By using the "Include" method
B. By using the "Where" method
C. By using the "Select" method
D. By using the "OrderBy" method

C

13
New cards

What is the purpose of the ParameterizedThreadStart delegate in .NET?
A. It represents a method that does not have any parameters and returns a value.
B. It represents a method that takes no arguments and does not return any value.
C. It represents a method that takes parameters and returns a value.
D. It represents a method that can be invoked asynchronously and accepts an object as a parameter.

D

14
New cards

Which keyword is used to pass a variable number of arguments to a method in C#?
A. "val"
B. "ref"
C. "out"
D. "params"

D

15
New cards

What is the purpose of Binding in WPF when displaying data from Entity Framework Core?
A. To establish a connection between the database and the application.
B. To format and customize the appearance of data.
C. To retrieve data from the database.
D. To associate a control with a property in the data source.

D

16
New cards

Which class in WPF is responsible for managing the lifetime and behavior of an application?
A. Window
B. Application
C. UserControl
D. FrameworkElement

B

17
New cards

What is the Core CLR?
A. A common language runtime for .NET Framework
B. A runtime environment for ASP.NET Core applications
C. A replacement for the traditional .NET Framework runtime, optimized for performance and cross-platform support
D. A tool used for compiling C# code into machine code

C

18
New cards

What is the purpose of the System.Collections namespace in .NET?
A. It provides classes for working with collections that are strongly typed.
B. It provides classes for working with collections that are dynamically typed.
C. It is not a valid namespace in .NET.
D. It provides classes for working with both strongly typed and dynamically typed

B

19
New cards

What is the purpose of passing a delegate as a parameter?
A. To encapsulate a method call for deferred execution
B. To enable the method to accept any type of object as an argument
C. To pass the delegate's return value as a parameter to another method
D. Passing a delegate as a parameter is not supported in .NET

A

20
New cards

What is the benefit of building the entity model at runtime in Entity Framework Core?
A. Improved performance during application execution
B. Reduced development time by automatically generating the entity model
C. Increased flexibility to handle changes in the database schema
D. Enhanced security features for protecting the entity model

C

21
New cards

Which method is used to start a new thread using the ThreadStart delegate?
A. Thread.Start()
B. Thread.Run()
C. Thread.Invoke()
D. Thread.Execute()

A

22
New cards

What happens to a thread in the ThreadPool class after completing a task?
A. It remains in the pool and waits for the next task assignment.
B. It is immediately deallocated and removed from the pool.
C. It goes into a dormant state until the next task is available.
D. It transfers its resources and state to another thread in the pool.

A

23
New cards

Which command is used to run a dotnet project?
A. dotnet run
B. dotnet build
C. dotnet restore
D. dotnet clean

A

24
New cards

What does cross-platform development in .NET refer to?
A. Developing applications for a single platform only.
B. Developing applications that can run on multiple platforms.
C. Developing applications exclusively for Windows.
D. Developing applications exclusively for macOS.

B

25
New cards

How does Core CLR differ from the traditional.NET Framework CLR?
A. Core CLR is slower than the traditional CLR
B. Core CLR only supports the C# programming language
C. Core CLR is cross-platform, while the traditional CLR is limited to Windows
D. Core CLR does not support garbage collection

C

26
New cards

Which of the following interfaces is implemented by the LinkedList<T> class?
A. IList<T>
B. ISet<T>
C. IDictionary<TKey, TValue>
D. IEnumerable<T>

D

27
New cards

What is an advantage of using generic classes and methods in C#?
A. Improved performance through type-specific optimizations.
B. Simplified code without the need for type annotations.
C. Compatibility with older versions of the.NET Framework.
D. Ability to use dynamic types as type parameters.

A

28
New cards


Which delegate type is used to represent a method that takes no parameters and returns void?
A. Action
B. Func
C. Predicate
D. EventHandler

A

29
New cards

What is the purpose of the Func delegate type in .NET?
A. To represent a method that takes parameters and returns a value.
B. To represent an event handler delegate.
C. To provide an interface for creating custom delegates.
D. Func is not a delegate type in .NET.

A

30
New cards

Which property of the Delegate class is used to access the method that the delegate points to?
A. Target
B. Method
C. Invoke
D. Delegate

B

31
New cards

Which keyword is used to declare a delegate type in C#?
A. delegate
B. class
C. var
D. method

A

32
New cards

Which class in the System.IO namespace is used to open, read, and write to files?
A. FileStream
B. File
C. FileInfo
D. Directory

A

33
New cards

Which of the following statements about static constructors is true?
A. Static constructors are called explicitly by the developer.
B. Static constructors are automatically called when an instance of a class is created.
C. Static constructors are used to initialize instance variables.
D. A class can have multiple static constructors with different signatures.

B

34
New cards

Which command is used to reverse engineer a database schema into code-first entity classes using dotnet-ef?
A. dotnet ef migrations add
B. dotnet ef scaffold
C. dotnet ef database update
D. dotnet ef model create

B

35
New cards

What is the purpose of the Fluent API in Entity Framework Core?
A. It provides a graphical interface for designing the entity model
B. It is used to configure the entity model using a fluent method chain syntax
C. It is used to generate database scripts from the entity model
D. It is used to handle database migrations in Entity Framework Core

B

36
New cards

How do you include related entities in a LINQ query in Entity Framework Core?
A. By using the "Include" method
B. By using the "Where" method
C. By using the "Find" method
D. By using the "OrderBy" method

A

37
New cards

What is concurrency programming?
A. Writing code that runs on a single processor core
B. Writing code that runs on multiple processor cores simultaneously
C. Writing code that only runs on a specific operating system
D. Writing code that only runs on a single thread

B

38
New cards

Which property of the Process class is used to get the name of the process?
A. Id
B. Handle
C. PriorityClass
D. ProcessName

D

39
New cards

When a value type is passed as an argument to a method in C#, it is:
A. Passed by value
B. Passed by reference
C. Passed by copy
D. Passed by pointer

A

40
New cards

When passing a parameter by reference using the "ref" keyword, what happens inside the method?
A. The parameter is passed by value.
B. The parameter is passed by reference and the method can modify its value.
C. The parameter becomes read-only.
D. The parameter is discarded.

B

41
New cards

What is the role of the Main() method in a C# program?
A. It serves as the entry point of the program.
B. It is responsible for executing any other methods in the program.
C. It is where the program terminates.
D. It is optional and can be omitted in certain scenarios.

A B

42
New cards

How are arguments passed when using the "params" keyword in C#?
A. The arguments are passed by value.
B. The arguments are passed by reference.
C. The arguments are passed by reference and the method can modify their values.
D. The arguments are passed in an array.

D

43
New cards

How does the Factory Method pattern promote flexibility in object creation?
A. By providing static methods for object creation
B. By allowing dynamic determination of the object created at runtime
C. By enforcing a single constructor for all objects
D. By limiting the creation of objects to a specific subclass

B

44
New cards

Which category of design patterns focuses on the creation of objects?
A. Structural patterns
B. Behavioral patterns
C. Creational patterns
D. Architectural patterns

C

45
New cards

Which component of MVVM is responsible for exposing data and commands to the View?
A. Model
B. View
C. ViewModel
D. Controller

C

46
New cards

Which layout panel in WPF enables the precise positioning of child controls using absolute or relative coordinates?
A. StackPanel
B. Grid
C. Canvas
D. DockPanel

C

47
New cards

Which method of the JsonSerializer class is used to serialize an object into a JSON string?
A. Deserialize
B. Parse
C. Serialize
D. ToString

C

48
New cards

Which attribute can be used to customize the serialization process using the XMLSerializer?
A. [Serializable]
B. [Xmlignore]
C. [XmlAttribute]
D. [DataMember]

B C

49
New cards

Which of the following is not a key feature of Core CLR?
A. Cross-platform support
B. Just-in-time (JIT) compilation
C. Garbage collection
D. Support for Windows Presentation Foundation (WPF)

D

50
New cards

What is the output of the.NET compilation process called?
A. Bytecode
B. Source code
C. Assembly
D. Machine code

C

51
New cards

Which command is used to add a NuGet package reference to a dotnet project?
A. dotnet add package
B. dotnet remove package
C. dotnet restore
D. dotnet pack

A

52
New cards

Which command is used to create a new empty console application in dotnet CLI?
A. dotnet run
B. dotnet new console
C. dotnet build
D. dotnet clean

B

53
New cards

Which collection class allows for efficient insertion and removal of elements at both ends?
A. Queue<T>
B. Stack<T>
C. Dictionary<TKey, TValue>
D. LinkedList<T>

D

54
New cards

What is the main purpose of applying constraints on type parameters in C# generics?
A. To limit the types that can be used as arguments in a generic class or method
B. To enhance performance of generics
C. To provide default values for generic type parameters
D. To ensure type safety in generics

A

55
New cards

What is the purpose of using the "default" keyword in generic constraints in C#?
A. To specify a default value for the type argument
B. To restrict the type argument to be a specific class
C. To restrict the type argument to be a value type
D. To restrict the type argument to have a default constructor

D

56
New cards

Which of the following is an example of using multiple constraints on a type parameter in C# generics?
A. where T: struct, class
B. where T: struct && class
C. where T: struct || class
D. where T: struct/non-nullable

A

57
New cards

Which namespace is recommended for new.NET projects to leverage more modern collection classes?
A. System.Collections
B. System.Collections.Generic
C. System.Collections. Specialized
D. System.Collections.Concurrency

B

58
New cards

Can a delegate reference multiple methods in .NET?
A. No, a delegate can only reference a single method
B. Yes, a delegate can reference multiple methods using the '+=' operator
C. Yes, but only if the methods have the same number and order of parameters
D. Delegates cannot reference methods in .NET

B

59
New cards

What is the benefit of using lambdas with standard query operators in LINQ?
A. Improved runtime performance
B. Reduced code complexity
C. Automatic error handling
D. Increased database compatibility

B

60
New cards

What is the first step to define an event in C#?
A. Declare an event keyword in a class
B. Create a delegate for the event
C. Implement the event handler
D. Instantiate the event object

B

61
New cards

What is a read-only auto property in C#?
A. A property that can only be read and not assigned a value after initialization.
B. A property that automatically updates its value based on internal logic.
C. A property that can be both read and written after initialization.
D. A property that is inaccessible outside its containing class.

A

62
New cards

What is a static variable in C#?
A. A variable that can only be accessed within the same class.
B. A variable that is automatically initialized to a default value.
C. A variable that retains its value across multiple instances of a class.
D. A variable that is used for dynamic memory allocation.

C

63
New cards

How can you assign a value to an init-only property?
A. By directly assigning a value to it in the constructor.
B. By using the "set" accessor of the property.
C. By calling a specific method provided by the property.
D. By using the "readonly" keyword before the property declaration.

A

64
New cards

Which of the following is an advantage of default interface methods in C#?
A. They allow for multiple inheritance in C#
B. They eliminate the need for abstract classes
C. They improve code reusability by providing a default implementation
D. They improve performance by eliminating the need for virtual method calls

C

65
New cards

In Entity Framework Core, how can you configure entity-to-table mappings?
A. By using the Fluent API
B. By modifying the EDMX file
C. By using annotations on entity classes
D. By writing raw SQL queries

A

66
New cards

What is the purpose of DbContext in Entity Framework Core?
A. To define the structure of the database schema.
B. To map database tables to entity classes.
C. To load navigation properties lazily.
D. To establish a connection with the database.

B

67
New cards

How do you retrieve first element or default value from a LINQ query in Entity Framework Core?
A. By using the "First" method
B. By using the "Single" method
C. By using the "FirstOrDefault" method
D. By using the "Take" method

C

68
New cards

What is the primary advantage of using the ThreadPool class in .NET?
A. It automatically manages the thread lifecycle and resource allocation.
B. It provides more control over individual thread execution.
C. It allows for better interaction with user interfaces.
D. It improves memory management through automatic garbage collection.

A

69
New cards

What is the purpose of the static Thread.GetDomain() method in .NET?
A. It retrieves the current AppDomain in which the calling thread is executing
B. It creates a new AppDomain for the calling thread
C. It retrieves the current thread in which the calling AppDomain is executing
D. It retrieves the current application in which the calling thread is executing

A

70
New cards

What is thread starvation in concurrency programming?
A. A situation where threads are executed sequentially
B. A situation where there is no coordination between multiple threads
C. A situation where a thread does not get access to the shared resource it needs to progress
D. A situation where multiple cores are not utilized efficiently

C

71
New cards

When a reference type is passed as an argument to a method in C#, it is:
A. Passed by value
B. Passed by reference
C. Passed by copy
D. Passed by pointer

A

72
New cards

Reference types in C# are stored in:
A. Heap
B. Stack
C. CPU registers
D. Garbage collector

A

73
New cards

What is the main difference between "ref" and "out" parameters in C#?
A. "ref" parameters are passed by value, while "out" parameters are passed by reference.
B. "ref" parameters must be assigned before being used, while "out" parameters must be assigned in the method.
C. "ref" parameters are optional, while "out" parameters are required.
D. There is no difference between "ref" and "out" parameters in C#.

B

74
New cards

Which design pattern promotes loose coupling between objects?
A. Singleton
B. Observer
C. Adapter
D. Mediator

D

75
New cards

What is the main advantage of using the Factory Method pattern?
A. Increased encapsulation and abstraction
B. Reduced code complexity
C. Improved performance of object creation
D. Ability to create multiple instances of a class

A

76
New cards

Which layout panel in WPF automatically arranges its child controls in a single line, either horizontally or vertically?
A. StackPanel
B. Grid
C. Canvas
D. DockPanel

A

77
New cards

Which property of the Control class is used to get or set the content of a control?
A. Content
B. Text
C. Value
D. Data

A

78
New cards

Which of the following allows developers to easily customize the visual appearance of controls in WPF?
A. Styles
B. Templates
C. Themes
D. Resource dictionaries

B

79
New cards

Which namespace contains the JsonSerializer class in .NET?
A. System.IO
B. System.Net
C. System.Json
D. System.Text.Json

D

80
New cards

What is the purpose of deserialization in .NET?
A. To convert a serialized object back into an in-memory object.
B. To encrypt a serialized object for secure storage or transmission.
C. To compress a serialized object for efficient storage or transmission.
D. To validate the integrity of a serialized object during transmission.

A

81
New cards

When serializing an object using the XMLSerializer, which type of stream is commonly used?
A. FileStream
B. MemoryStream
C. StreamReader
D. XmlReader

A B

82
New cards

What is JsonSerializer used for in.NET?
A. To serialize and deserialize JSON data
B. To manipulate XML data
C. To compress and decompress data
D. To interact with web APIs

A

83
New cards

What is Serialization in .NET?


A. The process of converting an object into a binary format for storage or transmission.
B. The process of converting an object into XML format for storage or transmission.
C. The process of converting an object into a JSON format for storage or transmission.
D. The process of converting an object into a text format for storage or transmission.

A

84
New cards

Which attribute can be used to control the serialization behavior of a property in .NET JSON serialization?


A. [JsonFormatter]
B. [JsonProperty]
C. [Serializable]
D. [JsonlgnoreSerialization]

B*

85
New cards

Which .NET class is commonly used for binary serialization?


A. XmlSerializer
B. BinaryFormatter
C. DataContractSerializer
D. JsonSerializer

B*

86
New cards

Which namespace contains the XMLSerializer class in .NET?
A. System.ComponentModel
B. System.IO
C. System.Xml
D. System.Xml.Serialization

D

87
New cards

Which component in WPF is commonly used to display a collection of data from Entity Framework Core?
A. TextBlock
B. Button
C. Grid
D. DataGrid

D

88
New cards

What is the purpose of a Style in WPF?
A. To define the data binding and data manipulation of a control.
B. To define the behavior and event handling of a control.
C. To define the layout and visual appearance of a control.
D. To define the animation and visual effects of a control.

C

89
New cards

Which class in WPF represents a top-level window and provides the basic framework for user interface elements?
A. Application
B. Window
C. Form
D. Control

B*

90
New cards

Which property of the Application class allows you to specify a XAML file as the entry point for the application?
A. StartupObject
B. EntryPoint
C. MainFile
D. StartupUri

D

91
New cards

Which layout panel in WPF allows you to create a flexible grid of rows and columns to arrange controls?
A. StackPanel
B. Grid
C. Canvas
D. DockPanel

B*

92
New cards

What is the purpose of the Singleton pattern?
A. To create multiple instances of a class
B. To ensure only one instance of a class is created
C. To provide static methods for object creation
D. To define a blueprint for creating objects

B*

93
New cards

Which design pattern is used to represent a "family" of related algorithms and allows them to be interchangeable?


A. Singleton
B. Strategy
C. Bridge
D. Decorator

B

94
New cards

What is the purpose of marking the Singleton constructor as private?
A. To prevent instantiation of the class
B. To allow multiple instances of the class
C. To provide access to the class through a public constructor
D. To enforce encapsulation principles

A

95
New cards

Value types in C# are stored in:
A. Heap
B. Stack
C. CPU registers
D. Garbage collector

B*

96
New cards

Which of the following is true about reference locals in .NET?
A. They can only be used with value types
B. They can be used with both value types and reference types
C. They can only be used in low-level programming languages
D. They are not supported in .NET programming

B*

97
New cards

What are reference returns in .NET?
A. Methods that return references to objects
B. Methods that return values directly
C. Constants used to reference memory locations
D. Pointers used in low-level programming languages

A

98
New cards

Which operator is used to handle null values in an expression in C#?
A. ??
B. !!
C. ?:
D. ||

A

99
New cards

What is a race condition in concurrency programming?
A. A situation where threads are executed sequentially
B. A situation where there is no coordination between multiple threads
C. A situation where two or more threads contend for a shared resource and the outcome depends on the timing of their execution
D. A situation where multiple cores are not utilized efficiently

C

100
New cards

Which method is used to stop a process using the Process class?
A. Close
B. Kill
C. Terminate
D. Stop

B