Unit 1: Introduction To .Net And C# - Practice Quiz

INT402 — Modern Web Programming Tools And Techniques 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is ASP.NET Core primarily used to build?

Introduction to ASP.NET Core and its features Easy
A. Web applications and APIs
B. Spreadsheet calculation models
C. Operating system drivers
D. Desktop publishing documents

2 Which feature allows ASP.NET Core applications to run on Windows, Linux, and macOS?

Introduction to ASP.NET Core and its features Easy
A. Windows-only hosting
B. Browser-specific compilation
C. Cross-platform support
D. Registry-based configuration

3 Which version was the first official release of ASP.NET Core?

ASP.NET Core Version History Easy
A. ASP.NET Core 5.0
B. ASP.NET Core 1.0
C. ASP.NET Core 3.0
D. ASP.NET Core 2.0

4 Starting with which version did Microsoft drop the word "Core" from the main .NET platform name?

ASP.NET Core Version History Easy
A. .NET Core 1.0
B. .NET Core 3.1
C. .NET Core 2.0
D. .NET 5

5 Which platform is designed to run on Windows, Linux, and macOS?

Difference Between .NET Framework and .NET Core Easy
A. .NET Framework
B. Windows Forms
C. Internet Information Services
D. .NET Core

6 Which platform is primarily associated with older Windows-only applications?

Difference Between .NET Framework and .NET Core Easy
A. .NET Core
B. ASP.NET Core
C. .NET Framework
D. .NET CLI

7 What must be installed to create and run .NET applications from VS Code?

Setting up a development environment with VS Code Easy
A. Java SDK
B. Android SDK
C. .NET SDK
D. Windows Driver Kit

8 Which VS Code extension provides language support for C# development?

Setting up a development environment with VS Code Easy
A. Python Debugger
B. C# Dev Kit
C. PHP IntelliSense
D. Java Extension Pack

9 Which command creates a new .NET console application?

Introduction to .NET CLI and .NET CLI Commands Easy
A. dotnet new console
B. dotnet build console
C. dotnet run console
D. dotnet add console

10 Which .NET CLI command compiles a project?

Introduction to .NET CLI and .NET CLI Commands Easy
A. dotnet help
B. dotnet new
C. dotnet build
D. dotnet clean

11 Which .NET CLI command runs a project from its source code?

Introduction to .NET CLI and .NET CLI Commands Easy
A. dotnet test
B. dotnet pack
C. dotnet restore
D. dotnet run

12 Which component executes managed .NET applications?

Overview of the .NET Core Platform Easy
A. CoreCLR
B. NuGet
C. Kestrel
D. Razor

13 Which package manager is commonly used to add libraries to .NET projects?

Overview of the .NET Core Platform Easy
A. NuGet
B. Maven
C. Composer
D. RubyGems

14 Who developed the C# programming language?

Introduction to C# Easy
A. Microsoft
B. Adobe
C. Oracle
D. Mozilla

15 Which programming style is directly supported by C#?

Introduction to C# Easy
A. Markup-only programming
B. Object-oriented programming
C. Query-only programming
D. Assembly-only programming

16 Which C# version introduced the async and await keywords?

History of C# Version Easy
A. C# 5.0
B. C# 2.0
C. C# 3.0
D. C# 4.0

17 Which C# version introduced nullable reference types?

History of C# Version Easy
A. C# 8.0
B. C# 5.0
C. C# 7.0
D. C# 6.0

18 What does the C# compiler normally produce from C# source code?

C# Code Execution Easy
A. Database query code
B. Native assembly source
C. HTML markup code
D. Intermediate Language code

19 What does the Just-In-Time compiler do during C# program execution?

C# Code Execution Easy
A. Converts IL into native code
B. Converts images into binary files
C. Converts data into SQL tables
D. Converts HTML into C# code

20 Which Visual Studio workload is commonly selected for creating C# console applications?

Installing and Configuring C# in Visual Studio Easy
A. .NET desktop development
B. Python development
C. Linux kernel development
D. Node.js development

21 A team wants the same ASP.NET Core web application to run behind IIS on Windows and Nginx on Linux. Which ASP.NET Core feature most directly supports this requirement?

Introduction to ASP.NET Core and its features Medium
A. Built-in Web Forms controls
B. Cross-platform runtime support
C. Automatic database replication
D. Windows-only process hosting

22 An ASP.NET Core application needs a different email service implementation during automated testing. Which built-in feature is best suited to this requirement?

Introduction to ASP.NET Core and its features Medium
A. Dependency injection
B. Razor compilation
C. Response compression
D. Static file middleware

23 A legacy project targets ASP.NET Core 2.2. The team wants to move to the first ASP.NET Core release that followed the unified .NET naming introduced after .NET Core 3.1. Which target should it choose?

ASP.NET Core Version History Medium
A. ASP.NET Core 3.5
B. ASP.NET Core 5.0
C. ASP.NET Core 4.0
D. ASP.NET Core 6.0

24 A company prioritizes a longer support period for a production ASP.NET Core application. Which release type should it normally select?

ASP.NET Core Version History Medium
A. A current STS release
B. The oldest available release with all historical compatibility packages installed
C. A preview release
D. A Long Term Support release

25 An existing application depends heavily on ASP.NET Web Forms and Windows-specific libraries. Which platform is the most practical target if the application will remain Windows-only and cannot be substantially rewritten?

Difference Between .NET Framework and .NET Core Medium
A. Mono WebAssembly
B. .NET Framework
C. .NET Standard
D. .NET Core 1.0

26 Two applications on one Linux server must use different runtime versions without changing the machine-wide runtime. Which capability of .NET Core or modern .NET best addresses this?

Difference Between .NET Framework and .NET Core Medium
A. Global Assembly Cache registration
B. Application pool recycling
C. Windows Registry configuration
D. Side-by-side runtime deployment

27 After installing VS Code and the C# extension, a developer opens a new terminal but the dotnet command is not recognized. What is the most likely missing component?

Setting up a development environment with VS Code Medium
A. The NuGet desktop client
B. The SQL Server extension
C. The IIS server role
D. The .NET SDK

28 A developer can edit C# files in VS Code but cannot build or debug a newly cloned project. Which sequence is the most appropriate first check?

Setting up a development environment with VS Code Medium
A. Run dotnet --info, restore dependencies, and build the project
B. Install IIS, register every assembly, and restart the operating system
C. Convert the project to Web Forms and add a web.config file
D. Open only the source file and execute it through a browser

29 A developer has modified package references in a project file and wants to download the required NuGet packages without compiling the project. Which command should be used?

Introduction to .NET CLI and .NET CLI Commands Medium
A. dotnet publish
B. dotnet build
C. dotnet restore
D. dotnet run

30 A team needs deployment-ready output containing the application and its required files in a selected folder. Which command is designed for this task?

Introduction to .NET CLI and .NET CLI Commands Medium
A. dotnet publish
B. dotnet clean
C. dotnet format
D. dotnet test

31 A library author wants one compiled API contract to be usable by multiple compatible .NET implementations. Which concept was designed to define that shared API surface?

Overview of the .NET Core Platform Medium
A. .NET Standard
B. Kestrel
C. The Global Assembly Cache
D. Entity Framework migrations

32 Which component executes managed .NET code and provides services such as garbage collection and exception handling?

Overview of the .NET Core Platform Medium
A. The code editor
B. The project template
C. The runtime
D. The package source

33 A method must accept objects that provide a Save() operation, even when their classes do not share a base implementation. Which C# construct best expresses this contract?

Introduction to C# Medium
A. An interface
B. A namespace
C. An enumeration
D. A sealed class containing several overloaded methods and a static constructor

34 What is the result of the following C# code?

int x = 7;

int y = 2;

double result = x / y;

Introduction to C# Medium
A. A compilation error
B. 4.0
C. 3.5
D. 3.0

35 A developer wants to use nullable reference type annotations such as string? to improve null-safety analysis. In which C# version was this feature introduced?

History of C# Version Medium
A. C# 6.0
B. C# 9.0
C. C# 7.0
D. C# 8.0

36 A project uses record declarations to model immutable data-oriented types with value-based equality. Which language version first introduced records?

History of C# Version Medium
A. C# 10.0
B. C# 9.0
C. C# 8.0
D. C# 7.3

37 When a C# project is built, what does the C# compiler normally produce before the runtime executes the program?

C# Code Execution Medium
A. Java bytecode and a manifest
B. A text script interpreted line by line
C. CIL and assembly metadata
D. Native code for every processor

38 A .NET application starts running a method for the first time. Which process commonly converts that method's intermediate language into native machine instructions?

C# Code Execution Medium
A. Static file bundling
B. Just-in-time compilation
C. Package restoration
D. Source code formatting

39 During Visual Studio installation, a student wants the templates and tools needed to build ASP.NET Core applications. Which workload should be selected?

Installing and Configuring C# in Visual Studio Medium
A. ASP.NET and web development
B. Game development with Unity
C. Desktop development with C++
D. Linux and embedded C++ development

40 Visual Studio opens a C# project but reports that its target framework cannot be found. What is the most appropriate corrective action?

Installing and Configuring C# in Visual Studio Medium
A. Disable IntelliSense and remove the project file
B. Install a database server and recreate the solution as a database project
C. Install the matching .NET SDK or targeting pack
D. Rename every .cs file to use a .cpp extension

41 An ASP.NET Core app must serve static files without authentication, authenticate MVC requests, and ensure endpoint-specific authorization policies are evaluated. Which middleware order is correct?

Introduction to ASP.NET Core and its features Hard
A. UseAuthentication(); UseStaticFiles(); UseAuthorization(); UseRouting(); MapControllers();
B. UseStaticFiles(); UseRouting(); UseAuthentication(); UseAuthorization(); MapControllers();
C. UseStaticFiles(); UseAuthorization(); UseRouting(); UseAuthentication(); MapControllers();
D. UseRouting(); UseAuthorization(); UseAuthentication(); UseStaticFiles(); MapControllers();

42 A singleton service constructor receives a scoped DbContext. Scope validation is enabled. What is the correct diagnosis and redesign?

Introduction to ASP.NET Core and its features Hard
A. The dependency is valid; scoped services automatically inherit the singleton service lifetime.
B. The dependency is invalid; inject a scope factory and resolve the context inside a created scope.
C. The dependency is invalid; register the context as transient so each database call gets one.
D. The dependency is valid; the container creates a new context whenever a singleton method runs.

43 An ASP.NET Core app behind a TLS-terminating reverse proxy repeatedly redirects HTTPS requests back to HTTPS. The proxy forwards X-Forwarded-Proto: https, but the app observes HTTP. Which change most directly addresses the loop?

Introduction to ASP.NET Core and its features Hard
A. Configure forwarded headers before HTTPS redirection and trust the known proxy.
B. Configure static files before HTTPS redirection and disable unknown file types.
C. Configure response compression before HTTPS redirection and enable MIME mappings.
D. Configure endpoint routing before HTTPS redirection and require an authorization policy.

44 A legacy application targets ASP.NET Core 2.1 and relies on running either on .NET Core or on the full .NET Framework. A team proposes upgrading directly to ASP.NET Core 3.0 while keeping the full .NET Framework target. What blocks that plan?

ASP.NET Core Version History Hard
A. ASP.NET Core 3.0 requires IIS in-process hosting, which is unavailable in .NET Framework.
B. ASP.NET Core 3.0 runs only on .NET Framework 4.8, not on .NET Core.
C. ASP.NET Core 3.0 runs only on .NET Core 3.0 or later, not on .NET Framework.
D. ASP.NET Core 3.0 requires Web Forms hosting, which is unavailable in .NET Framework.

45 Which migration issue most specifically reflects the routing change introduced with ASP.NET Core 3.0?

ASP.NET Core Version History Hard
A. Authorization middleware must run after route matching so it can inspect endpoint metadata.
B. Authentication middleware must run before exception handling so it can inspect failures.
C. Authentication middleware must run after controller execution so it can inspect results.
D. Authorization middleware must run before static files so it can inspect MIME metadata.

46 A Windows-only ASP.NET MVC 5 application heavily uses System.Web, but a new Linux service must reuse its platform-neutral business rules. Which architecture is most viable?

Difference Between .NET Framework and .NET Core Hard
A. Retarget the MVC 5 project to .NET Standard and retain all existing controllers unchanged.
B. Copy System.Web into the Linux runtime and preserve the existing request pipeline.
C. Reference the MVC 5 web project directly and deploy the complete solution on Linux.
D. Move platform-neutral rules into a compatible library and rewrite the web layer in ASP.NET Core.

47 Two applications on one server require incompatible runtime patch levels and must be deployed without changing the machine-wide .NET installation. Which .NET capability best satisfies this requirement?

Difference Between .NET Framework and .NET Core Hard
A. Register both applications in IIS using the same installed CLR configuration.
B. Compile each application with CodeDOM against the machine-wide framework version.
C. Install both applications into the Global Assembly Cache with binding redirects.
D. Publish each application as self-contained with its selected runtime version.

48 A repository contains Api/Api.csproj and Tests/Tests.csproj, but no solution file. VS Code is opened at the repository root, and a build task runs dotnet build with no arguments. The CLI reports that it cannot determine which project to use. What is the most maintainable fix?

Setting up a development environment with VS Code Hard
A. Install separate SDK versions per project and make the task select either installation.
B. Create a solution containing both projects and make the task build that solution.
C. Delete the test project during debugging and make the task restore the API project.
D. Move both project files to the repository root and make the task build the folder.

49 A VS Code debugger successfully launches an ASP.NET Core project, but the app uses Production settings even though launchSettings.json defines ASPNETCORE_ENVIRONMENT=Development. The debug configuration launches the compiled DLL directly. What best explains the behavior?

Setting up a development environment with VS Code Hard
A. VS Code ignores environment variables for .NET processes; pass the value as a controller argument.
B. Direct DLL launch does not automatically apply a launchSettings.json profile; configure the environment in launch.json.
C. Direct DLL launch always forces Production; change the environment only in appsettings.json.
D. ASP.NET Core reads the environment only during compilation; rebuild the DLL with a debug symbol file.

50 A CI pipeline runs dotnet restore --locked-mode followed by dotnet build --no-restore. A developer changes a package reference without updating the lock file. What should happen?

Introduction to .NET CLI and .NET CLI Commands Hard
A. Restore fails because locked mode detects that dependency resolution would change the lock file.
B. Restore succeeds because locked mode ignores direct package references during dependency resolution.
C. Build succeeds because the existing assets file takes precedence over the changed project reference.
D. Build updates the lock file because --no-restore suppresses only remote package downloads.

51 Which command publishes a Linux x64 application with its own runtime and permits execution on a compatible host without a separately installed .NET runtime?

Introduction to .NET CLI and .NET CLI Commands Hard
A. dotnet build -c Release -r linux-x64 --no-restore
B. dotnet pack -c Release -r linux-x64 --include-symbols
C. dotnet run -c Release -r linux-x64 --no-build
D. dotnet publish -c Release -r linux-x64 --self-contained true

52 A repository requires every developer and CI agent to use the same version of a custom dotnet tool without installing it globally. Which setup provides reproducible tool resolution?

Introduction to .NET CLI and .NET CLI Commands Hard
A. Commit a local tool manifest, declare the version, and run dotnet tool restore.
B. Commit the SDK workload cache, declare the feature band, and run dotnet workload repair.
C. Commit the global tools directory, declare the path, and run dotnet restore.
D. Commit the NuGet HTTP cache, declare the source, and run dotnet nuget locals.

53 A framework-dependent application targets net8.0. A machine has only .NET 9 installed, and the application's runtime configuration uses the default roll-forward behavior. What is the expected result?

Overview of the .NET Core Platform Hard
A. Startup always fails because framework-dependent apps require the exact runtime patch version.
B. Startup normally succeeds because framework-dependent apps select any higher major runtime.
C. Startup always succeeds because the SDK recompiles the app against the installed runtime.
D. Startup normally fails because default roll-forward does not select a new major runtime.

54 A project builds successfully with .NET SDK 8, but running its framework-dependent output on a server fails with a message that the required framework is missing. Which statement reconciles these facts?

Overview of the .NET Core Platform Hard
A. The compiler resolved NuGet dependencies at build time, while the server still needs the NuGet cache.
B. The SDK embedded the complete runtime during compilation, while the server still needs the same SDK.
C. The compiler produced native machine code for the server, while the server still needs Roslyn installed.
D. The SDK supplied reference assemblies for compilation, while the server still needs a compatible shared runtime.

55 Consider var actions = new List<Action>(); for (int i = 0; i < 3; i++) actions.Add(() => Console.Write(i));. What is printed when all actions execute after the loop?

Introduction to C# Hard
A. 333, because the closures share the captured loop variable whose final value is 3.
B. 123, because each closure captures the value after the loop increment operation.
C. 222, because the loop variable stops changing after the final successful iteration.
D. 012, because each closure receives a separate copy of the loop variable automatically.

56 A library targets netstandard2.0 but is compiled with a modern SDK. The team wants to use C# records while preserving the same target framework. Which statement is most accurate?

History of C# Version Hard
A. Language version and target framework are separate, though records may require compatibility support such as IsExternalInit.
B. Records require changing the target to net5.0 because syntax versions are fixed by the runtime target.
C. Records require installing .NET Framework 4.8 because record metadata is emitted only by its compiler.
D. Language version follows the operating system, so records work only when compilation occurs on Windows.

57 A project enables nullable reference types and changes string Name to string? Name. Which consequence is most accurate for ordinary .NET execution?

History of C# Version Hard
A. The compiler changes null-state analysis and emits annotations, but the CLR still represents both as System.String references.
B. The compiler inserts a mandatory runtime null check on every read and changes the field's underlying CLR type.
C. The CLR prevents null assignment through verifier rules even when the assignment originates from older assemblies.
D. The CLR creates a distinct nullable string value type and throws whenever it receives an unwrapped reference.

58 A release build calls a generic method M<T> with both string and object, then with both int and double. Which JIT behavior is generally expected?

C# Code Execution Hard
A. All instantiations must share one native body because generic type information is erased before JIT compilation.
B. Reference-type instantiations can share native code, while value-type instantiations generally receive specialized code.
C. All instantiations must receive separate native bodies because metadata stores a complete method copy for each type.
D. Value-type instantiations can share native code, while reference-type instantiations always receive specialized code.

59 Which sequence best describes normal execution of a framework-dependent C# application without ahead-of-time native compilation?

C# Code Execution Hard
A. The C# compiler emits CIL and metadata; the CLR loads assemblies; the JIT compiles invoked methods to native code.
B. The C# compiler emits JVM bytecode; the CLR translates each assembly into CIL and then interprets every instruction.
C. The C# compiler emits source tokens; the CLR invokes Roslyn for every method call and caches the resulting syntax tree.
D. The C# compiler emits native code and metadata; the CLR converts native methods back into CIL before execution.

60 Visual Studio can open an existing net8.0 project as text, but reports that the target framework is unsupported and cannot build it. The machine has an older Visual Studio release and only a .NET 6 SDK. What is the correct remediation?

Installing and Configuring C# in Visual Studio Hard
A. Install a newer C# extension because Visual Studio delegates all project builds to VS Code extensions.
B. Install a Visual Studio version that supports .NET 8 and add the .NET 8 SDK or targeting components.
C. Install only the .NET 8 runtime because Visual Studio derives reference assemblies from the running CLR.
D. Install only the C++ desktop workload because it supplies targeting packs for every managed framework.