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. Operating system drivers
B. Spreadsheet calculation models
C. Desktop publishing documents
D. Web applications and APIs

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 1.0
B. ASP.NET Core 2.0
C. ASP.NET Core 5.0
D. ASP.NET Core 3.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 5
D. .NET Core 2.0

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. .NET Core
D. Internet Information Services

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

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

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. Windows Driver Kit
D. .NET SDK

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

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

9 Which command creates a new .NET console application?

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

10 Which .NET CLI command compiles a project?

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

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

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

12 Which component executes managed .NET applications?

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

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

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

14 Who developed the C# programming language?

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

15 Which programming style is directly supported by C#?

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

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

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

17 Which C# version introduced nullable reference types?

History of C# Version Easy
A. C# 5.0
B. C# 8.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. HTML markup code
B. Intermediate Language code
C. Database query code
D. Native assembly source

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

C# Code Execution Easy
A. Converts images into binary files
B. Converts HTML into C# code
C. Converts data into SQL tables
D. Converts IL into native 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. Node.js development
C. Python development
D. Linux kernel 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. Automatic database replication
B. Windows-only process hosting
C. Built-in Web Forms controls
D. Cross-platform runtime support

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. Response compression
C. Static file middleware
D. Razor compilation

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 6.0
B. ASP.NET Core 4.0
C. ASP.NET Core 5.0
D. ASP.NET Core 3.5

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. A preview release
C. The oldest available release with all historical compatibility packages installed
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 Core 1.0
D. .NET Standard

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. Application pool recycling
B. Windows Registry configuration
C. Global Assembly Cache registration
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 SQL Server extension
B. The IIS server role
C. The NuGet desktop client
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. Open only the source file and execute it through a browser
B. Install IIS, register every assembly, and restart the operating system
C. Run dotnet --info, restore dependencies, and build the project
D. Convert the project to Web Forms and add a web.config file

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 build
B. dotnet restore
C. dotnet publish
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 format
B. dotnet publish
C. dotnet test
D. dotnet clean

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. The Global Assembly Cache
B. Entity Framework migrations
C. Kestrel
D. .NET Standard

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 runtime
B. The project template
C. The code editor
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. A sealed class containing several overloaded methods and a static constructor
B. A namespace
C. An enumeration
D. An interface

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. 3.5
B. 4.0
C. A compilation error
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# 8.0
B. C# 7.0
C. C# 9.0
D. C# 6.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# 7.3
B. C# 8.0
C. C# 10.0
D. C# 9.0

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. CIL and assembly metadata
B. Java bytecode and a manifest
C. Native code for every processor
D. A text script interpreted line by line

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. Source code formatting
B. Static file bundling
C. Just-in-time compilation
D. Package restoration

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. Linux and embedded C++ development
C. Game development with Unity
D. Desktop development with C++

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. Rename every .cs file to use a .cpp extension
B. Disable IntelliSense and remove the project file
C. Install a database server and recreate the solution as a database project
D. Install the matching .NET SDK or targeting pack

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. UseStaticFiles(); UseAuthorization(); UseRouting(); UseAuthentication(); MapControllers();
B. UseStaticFiles(); UseRouting(); UseAuthentication(); UseAuthorization(); MapControllers();
C. UseRouting(); UseAuthorization(); UseAuthentication(); UseStaticFiles(); MapControllers();
D. UseAuthentication(); UseStaticFiles(); UseAuthorization(); UseRouting(); 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 valid; the container creates a new context whenever a singleton method runs.
C. The dependency is invalid; register the context as transient so each database call gets one.
D. The dependency is invalid; inject a scope factory and resolve the context inside a created scope.

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 endpoint routing before HTTPS redirection and require an authorization policy.
B. Configure forwarded headers before HTTPS redirection and trust the known proxy.
C. Configure response compression before HTTPS redirection and enable MIME mappings.
D. Configure static files before HTTPS redirection and disable unknown file types.

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 runs only on .NET Core 3.0 or later, not on .NET Framework.
B. ASP.NET Core 3.0 requires IIS in-process hosting, which is unavailable in .NET Framework.
C. ASP.NET Core 3.0 runs only on .NET Framework 4.8, not on .NET Core.
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 after controller execution so it can inspect results.
C. Authentication middleware must run before exception handling so it can inspect failures.
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. Reference the MVC 5 web project directly and deploy the complete solution on Linux.
B. Move platform-neutral rules into a compatible library and rewrite the web layer in ASP.NET Core.
C. Copy System.Web into the Linux runtime and preserve the existing request pipeline.
D. Retarget the MVC 5 project to .NET Standard and retain all existing controllers unchanged.

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. Compile each application with CodeDOM against the machine-wide framework version.
B. Publish each application as self-contained with its selected runtime version.
C. Install both applications into the Global Assembly Cache with binding redirects.
D. Register both applications in IIS using the same installed CLR configuration.

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. Move both project files to the repository root and make the task build the folder.
B. Install separate SDK versions per project and make the task select either installation.
C. Delete the test project during debugging and make the task restore the API project.
D. Create a solution containing both projects and make the task build that solution.

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. Direct DLL launch always forces Production; change the environment only in appsettings.json.
B. ASP.NET Core reads the environment only during compilation; rebuild the DLL with a debug symbol file.
C. Direct DLL launch does not automatically apply a launchSettings.json profile; configure the environment in launch.json.
D. VS Code ignores environment variables for .NET processes; pass the value as a controller argument.

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. Build succeeds because the existing assets file takes precedence over the changed project reference.
C. Build updates the lock file because --no-restore suppresses only remote package downloads.
D. Restore succeeds because locked mode ignores direct package references during dependency resolution.

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 publish -c Release -r linux-x64 --self-contained true
C. dotnet run -c Release -r linux-x64 --no-build
D. dotnet pack -c Release -r linux-x64 --include-symbols

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 the global tools directory, declare the path, and run dotnet restore.
B. Commit a local tool manifest, declare the version, and run dotnet tool restore.
C. Commit the NuGet HTTP cache, declare the source, and run dotnet nuget locals.
D. Commit the SDK workload cache, declare the feature band, and run dotnet workload repair.

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 normally fails because default roll-forward does not select a new major runtime.
B. Startup always succeeds because the SDK recompiles the app against the installed runtime.
C. Startup always fails because framework-dependent apps require the exact runtime patch version.
D. Startup normally succeeds because framework-dependent apps select any higher 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 produced native machine code for the server, while the server still needs Roslyn installed.
B. The compiler resolved NuGet dependencies at build time, while the server still needs the NuGet cache.
C. The SDK embedded the complete runtime during compilation, while the server still needs the same SDK.
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. 012, because each closure receives a separate copy of the loop variable automatically.
C. 222, because the loop variable stops changing after the final successful iteration.
D. 123, because each closure captures the value after the loop increment operation.

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. Records require changing the target to net5.0 because syntax versions are fixed by the runtime target.
B. Language version follows the operating system, so records work only when compilation occurs on Windows.
C. Language version and target framework are separate, though records may require compatibility support such as IsExternalInit.
D. Records require installing .NET Framework 4.8 because record metadata is emitted only by its compiler.

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

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. Value-type instantiations can share native code, while reference-type instantiations always receive specialized code.
B. All instantiations must share one native body because generic type information is erased before JIT compilation.
C. All instantiations must receive separate native bodies because metadata stores a complete method copy for each type.
D. Reference-type instantiations can share native code, while value-type instantiations generally 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 source tokens; the CLR invokes Roslyn for every method call and caches the resulting syntax tree.
C. The C# compiler emits native code and metadata; the CLR converts native methods back into CIL before execution.
D. The C# compiler emits JVM bytecode; the CLR translates each assembly into CIL and then interprets every instruction.

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 only the C++ desktop workload because it supplies targeting packs for every managed framework.
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 a newer C# extension because Visual Studio delegates all project builds to VS Code extensions.