- Học kỳ
- SP2026
- Thời Gian
- 29/4/26
- Loại tài liệu
- FE
PRN212 SP26 B5 FE
- Câu 1
What will be the output of the following C# program?
C#
<span>enum</span> Role { Admin = <span>1</span>, Guest = <span>2</span> }<br><span><span>static</span> <span>void</span> <span>Main</span>(<span></span>)</span><br>{<br> <span>var</span> json = JsonSerializer.Serialize(Role.Admin, <span>new</span> JsonSerializerOptions<br> {<br> Converters = {<span>new</span> JsonStringEnumConverter()}<br> });<br> Console.WriteLine(json);<br>}<br>
A. 1
B. "Admin"
C. "1"
D. "ADMIN"
Đáp án: B- Câu 2 (Choose 1 answer)
In JSON syntax, arrays are enclosed in:
A. Square brackets
B. Curly braces
C. Parentheses
D. Angle brackets
Đáp án: A- Câu 3 (Choose 1 answer)
Which of the following is a valid JSON structure?
A. {"name": "John", "age": 30}
B. { "name": "John", age: 30}
C. ("name": "John", age: 30)
D. ("name": "John", "age": 30)
Đáp án: A- Câu 4 (Choose 1 answer)
Which attribute can be used to control the serialization behavior of a property in .NET JSON serialization?
A. [JsonFormatter]
B. [JsonProperty]
C. [Serializable]
D. [JsonIgnoreSerialization]
Đáp án: B (Lưu ý: Trong System.Text.Json thường dùng JsonPropertyName hoặc JsonIgnore, nhưng dựa theo file là B).- Câu 5 (Choose 1 answer)
Which control is used to arrange child elements sequentially in either a horizontal or vertical direction?
A. DockPanel
B. StackPanel
C. Grid
D. ViewBox
Đáp án: B- Câu 6 (Choose 1 answer)
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
Đáp án: D- Câu 7 (Choose 1 answer)
What does WPF stand for?
A. Windows Programming Framework
B. Windows Presentation Foundation
C. Windows Processing Foundation
D. Windows Platform Foundation
Đáp án: B- Câu 8 (Choose 1 answer)
Which control is used to display data in a table format in WPF?
A. ListBox
B. DataGrid
C. TextBox
D. ComboBox
Đáp án: B- Câu 9 (Choose 1 answer)
A DataGrid automatically generates columns when:
A. AutoGenerateColumns="True" and ItemsSource is set
B. Binding mode is OneWayToSource
C. RowTemplate is supplied
D. It is placed inside a Canvas
Đáp án: A- Câu 10 (Choose 3 correct answers)
The Builder pattern involves which THREE participants?
A. Director
B. Product
C. ConcreteBuilder
D. Façade
Đáp án: A, B, C- Câu 11 (Choose 1 answer)
In which design pattern does an object notify other objects about state changes, allowing them to react accordingly?
A. Observer
B. Chain of Responsibility
C. State
D. Strategy
Đáp án: A- Câu 12 (Choose 1 answer)
In the Factory Method pattern, object creation is:
A. Hard-coded in the client
B. Deferred to subclasses at runtime
C. Achieved through reflection only
D. Performed by the CLR JIT compiler
Đáp án: B- Câu 13 (Choose 1 answer)
Why should you use Design Patterns?
A. To write complex and inefficient code.
B. To improve code reusability, maintainability, and scalability.
C. To avoid using frameworks or libraries.
D. To remove the need for object-oriented programming principles.
Đáp án: B- Câu 14 (Choose 1 answer)
What is a static local function in C#?
A. A function that cannot access instance variables of the enclosing method.
B. A function that is only accessible to other classes.
C. A method that can access non-static fields.
D. A function that can only be defined globally.
Đáp án: A- Câu 15 (Choose 1 answer)
Which of the following is a value type in C#?
A. Class
B. Interface
C. Enum
D. Delegate
Đáp án: C- Câu 16 (Choose 1 answer)
Which class is primarily used for input and output operations in C#?
A. FileIO
B. Console
C. System.IO
D. InputOutput
Đáp án: B (Theo nội dung file trích xuất).- Câu 17 (Choose 1 answer)
What is the purpose of string interpolation in C#?
A. To format strings using the '+' operator
B. To embed expressions inside string literals
C. To concatenate multiple strings
D. To split strings into substrings
Đáp án: B- Câu 18 (Choose 1 answer)
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
Đáp án: A- Câu 19 (Choose 1 answer)
Which of the following is TRUE about JSON serialization in .NET?
A. It can serialize both public and private fields
B. It is commonly used for web APIs
C. It requires the use of the XmlSerializer class
D. It only works with string data
Đáp án: B (Dựa trên đáp án A/B trong ngữ cảnh file).- Câu 20 (Choose 1 answer)
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
Đáp án: C- Câu 21 (Choose 1 answer)
Which panel in WPF stacks content in a vertical or horizontal manner as dictated by the Orientation property?
A. Canvas
B. DockPanel
C. Grid
D. StackPanel
Đáp án: D- Câu 22 (Choose 1 answer)
What happens when two threads access shared data simultaneously?
A. No effect
B. Compilation error
C. Race condition
D. Memory leak
Đáp án: C- Câu 23 (Choose 1 answer)
Which of the following correctly describes the Database First Model?
A. Design the database from C# source code
B. Generate code from an existing database
C. Create the database directly from the Visual Studio interface
D. Not related to databases
Đáp án: B- Câu 24 (Choose 1 answer)
How can you add a new record using Entity Framework Core?
A. By adding the entity to the DbSet and calling SaveChanges.
B. By directly executing a raw SQL query.
C. By inserting the record into the database via stored procedures.
D. By using the SQL Server Management Studio interface.
Đáp án: A- Câu 25 (Choose 1 answer)
Which class in Entity Framework Core represents a table in the database?
A. DbTable
B. DbModel
C. DbContext
D. DbSet
Đáp án: D- Câu 26 (Choose 1 answer)
What is meant by "materialization" in EF Core?
A. The process of caching query results.
B. The process of serializing objects to XML.
C. The process of converting database rows into entity objects.
D. The process of encrypting data before storage.
Đáp án: C- Câu 27 (Choose 1 answer)
Which method of the DbSet class is used to retrieve a single entity from the database that matches a specified condition, or a default value if no such entity is found?
A. Find
B. FirstOrDefault
C. SingleOrDefault
D. Where
Đáp án: C (File ghi đáp án C).- Câu 28 (Choose 1 answer)
Which code snippet demonstrates abstraction using an abstract class?
A. (Đoạn mã sử dụng abstract class Shape và override void Draw())
B. (Đoạn mã sử dụng phương thức không abstract)
C. (Đoạn mã sử dụng virtual)
D. (Đoạn mã lớp thông thường)
Đáp án: A- Câu 29 (Choose 1 answer)
What are auto-implemented properties in C#?
A. Properties where the compiler automatically creates a private, anonymous field.
B. Methods that automatically return property values.
C. Fields that require explicit getter and setter definitions.
D. Variables that are only accessible within the same class.
Đáp án: A- Câu 30 (Choose 1 answer)
What is the purpose of the 'is' operator in C#?
A. To check if an object is compatible with a given type
B. To convert an object to a given type
C. To declare a static member
D. To create a new instance of a class
Đáp án: A- Câu 31 (Choose 1 answer)
What happens if a class inherits from multiple classes in C#?
A. The class will have access to members of all base classes.
B. The class will cause a compile-time error because C# does not support direct multiple inheritance.
C. The class will override all methods of the base classes.
D. The class will not be able to create an instance of itself.
Đáp án: B- Câu 32 (Choose 1 answer)
Which of the following is the correct way to create a new file using the File class?
A. File.WriteAllText("example.txt", "Hello, World!");
B. File.Create("example.txt", "Hello, World!");
C. File.CreateNew("example.txt", "Hello, World!");
D. File.Open("example.txt", FileMode.Open);
Đáp án: A- Câu 33 (Choose 1 answer)
Which of the following classes is NOT part of the System.IO namespace?
A. File
B. Directory
C. HttpClient
D. StreamReader
Đáp án: C- Câu 34 (Choose 1 answer)
What is the value of fs.Position immediately after opening an existing file with FileMode.Open?
C#
<span>using</span> <span>var</span> fs = <span>new</span> FileStream(<span>"a.txt"</span>, FileMode.Open);<br>Console.WriteLine(fs.Position);<br>
A. 0
B. -1
C. file length
D. Undefined
Đáp án: A- Câu 35 (Choose 1 answer)
Which class allows access to directory creation time?
A. Directory
B. DirectoryHelper
C. DirectoryInfo
D. DirectoryManager
Đáp án: C- Câu 36 (Choose 1 answer)
What is the 'select' clause used for in a query expression?
A. To project the result into a new form
B. To filter the elements based on a condition
C. To sort the elements in ascending order
D. To group the elements based on a condition
Đáp án: A- Câu 37 (Choose 1 answer)
What does the Combine(Delegate, Delegate) method do?
A. Removes one delegate from another
B. Creates a static method delegate
C. Concatenates the invocation lists of two delegates
D. Returns the target class of a delegate
Đáp án: C- Câu 38 (Choose 1 answer)
Which of the following is a valid lambda expression?
A. (x, y) => x + y
B. x plus y
C. add(x, y)
D. x => >> y
Đáp án: A- Câu 39 (Choose 1 answer)
Which delegate type is used to represent a method that takes no parameters and returns void?
A. Action
B. Func
C. Predicate
D. EventHandler
Đáp án: A- Câu 40 (Choose 1 answer)
Which of the following represents the Action delegate type with one parameter and no return value?
A. Action<>
B. Action
C. Action<T1, TResult>
D. Action<T, T>
Đáp án: B- Câu 41 (Choose 1 answer)
Which of the following is not a valid example of using a generic class in C#?
A. List myList = new List();
B. Dictionary<TKey, TValue> myDict = new Dictionary<TKey, TValue>();
C. Stack myStack = new Stack();
D. ArrayList myArray = new ArrayList();
Đáp án: D- Câu 42 (Choose 1 answer)
What is the benefit of using List over ArrayList?
A. Compile-time type checking
B. Boxing and unboxing
C. Lack of type safety
D. Dynamic typing
Đáp án: A- Câu 43 (Choose 1 answer)
What is the purpose of using generic methods in C#?
A. To restrict the types that can be used with the method.
B. To allow the method to accept different types dynamically.
C. To improve performance by eliminating boxing and unboxing operations.
D. To make the method more readable and maintainable.
Đáp án: C (Dựa trên đáp án trong file).- Câu 44 (Choose 1 answer)
What is the constraint 'where T: new()' used for?
A. To specify that T must have a public parameterless constructor
B. To specify that T must be a reference type
C. To specify that T must be a value type
D. To specify that T must implement an interface
Đáp án: A- Câu 45 (Choose 1 answer)
What is the purpose of the struct constraint in the following generic class?
public class NumericContainer<T> where T : struct
A. It ensures that T can only be a reference type.
B. It ensures that T can only be a value type.
C. It allows T to be any type, including struct.
D. It restricts T to classes that implement INumeric.
Đáp án: B- Câu 46 (Choose 1 answer)
Which release first dropped the "Core" branding and adopted the single name ".NET"?
A. .NET 2.2
B. .NET 3.1
C. .NET 4
D. .NET 5
Đáp án: D- Câu 47 (Choose 1 answer)
What is the main purpose of the NuGet package in .NET?
A. To store user credentials for .NET applications
B. To package and distribute libraries and dependencies for .NET applications
C. To debug and deploy .NET applications
D. To convert C# code into machine language
Đáp án: B- Câu 48 (Choose 1 answer)
What is the CoreCLR?
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
Đáp án: C- Câu 49 (Choose 1 answer)
What is a primary feature of the .NET Framework architecture?
A. It is only designed for mobile platforms.
B. It includes the Common Language Runtime (CLR) for code execution.
C. It lacks a Base Class Library (BCL).
D. It supports only one programming language.
Đáp án: B- Câu 50 (Choose 1 answer)
What is the output of the .NET compilation process called?
A. Bytecode
B. Source code
C. Assembly
D. Machine code
Đáp án: C
Đính kèm
-
PRN212 SP26 B5 FE_001.webp65.8 KB · Lượt xem: 1 -
PRN212 SP26 B5 FE_002.webp32.8 KB · Lượt xem: 1 -
PRN212 SP26 B5 FE_003.webp41.6 KB · Lượt xem: 1 -
PRN212 SP26 B5 FE_004.webp34.2 KB · Lượt xem: 1 -
PRN212 SP26 B5 FE_005.webp31.4 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_006.webp31.3 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_007.webp43.9 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_008.webp32.9 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_009.webp50.1 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_010.webp34.3 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_011.webp34.2 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_012.webp45.7 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_013.webp57 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_014.webp55.4 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_015.webp28.3 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_016.webp33.7 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_017.webp49.1 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_018.webp52.6 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_019.webp53.3 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_020.webp57.6 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_021.webp30.1 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_022.webp38 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_023.webp59.3 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_024.webp65.6 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_025.webp35 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_026.webp57.2 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_027.webp37.2 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_028.webp113.8 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_029.webp60.1 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_030.webp50 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_031.webp54 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_032.webp55.6 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_033.webp35.6 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_034.webp54.4 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_035.webp35.5 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_036.webp54.3 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_037.webp55.3 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_038.webp31 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_039.webp32 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_040.webp33.2 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_041.webp62.1 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_042.webp39.5 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_043.webp66.8 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_044.webp56.1 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_045.webp86.2 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_046.webp31.4 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_047.webp56.2 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_048.webp46.8 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_049.webp59.2 KB · Lượt xem: 0 -
PRN212 SP26 B5 FE_050.webp34.5 KB · Lượt xem: 1