Publishing ASP.NET applications MCQs ASP.NET

What is the most common method to publish an ASP.NET application from Visual Studio?
A. FTP
B. Publish to Folder
C. Web Deploy
D. Docker
Answer: C

Which file is essential when publishing an ASP.NET Web Forms application?
A. Global.asax
B. web.config
C. appsettings.json
D. Startup.cs
Answer: B

What is the primary purpose of the appsettings.json file in an ASP.NET Core app?
A. To configure routing
B. To store application settings and configuration
C. To manage authentication
D. To define controller actions
Answer: B

Which Visual Studio option allows you to publish an ASP.NET app directly to Azure?
A. Web Deploy
B. FTP
C. Azure App Service
D. File System
Answer: C

What does the ‘Framework-dependent deployment’ option mean when publishing an ASP.NET Core app?
A. The application includes the .NET runtime
B. The application depends on an installed .NET runtime on the host
C. The application does not require any runtime
D. The application includes all dependencies
Answer: B

Which deployment option packages the application as a single executable?
A. Self-contained deployment
B. Framework-dependent deployment
C. Web Deploy
D. Docker deployment
Answer: A

What is the primary purpose of Web Deploy in ASP.NET applications?
A. To create a package for local deployment
B. To manage database connections
C. To publish an application to IIS, Azure, or a remote server
D. To convert code into machine language
Answer: C

Which file is generated when publishing an ASP.NET app to Azure using the Web Deploy method?
A. .zip
B. .pubxml
C. .json
D. .config
Answer: B

How can you specify environment-specific configurations when publishing an ASP.NET Core app?
A. Using web.config
B. Setting environment variables
C. Modifying Startup.cs
D. Using appsettings.{Environment}.json
Answer: D

Which tool can you use to publish an ASP.NET Core application from the command line?
A. dotnet publish
B. dotnet run
C. dotnet deploy
D. nuget pack
Answer: A

What is the purpose of the Publish folder in an ASP.NET application?
A. To store temporary files
B. To contain the final deployable version of the app
C. To manage database connections
D. To cache compiled assemblies
Answer: B

How can you deploy an ASP.NET application using Docker?
A. Create a Dockerfile and build a container image
B. Use Web Deploy
C. Copy files manually to the server
D. Modify appsettings.json
Answer: A

What is the advantage of using a self-contained deployment for ASP.NET Core applications?
A. The app can run on any machine without needing the .NET runtime pre-installed
B. The app is optimized for cloud hosting
C. The app has a smaller file size
D. The app runs faster
Answer: A

Which command can be used to publish an ASP.NET Core app with Release configuration?
A. dotnet publish --release
B. dotnet publish -c Release
C. dotnet run --release
D. dotnet build --release
Answer: B

In Visual Studio, where can you configure advanced publishing options like connection strings or app settings for Azure?
A. Solution Explorer
B. Publish Profile settings
C. Properties Window
D. Startup.cs
Answer: B

What does the dotnet publish command do in ASP.NET Core?
A. Compiles and packages the application for deployment
B. Starts the development server
C. Installs NuGet packages
D. Sets up the database
Answer: A

Which file extension is typically used for publish profiles in Visual Studio?
A. .json
B. .xml
C. .pubxml
D. .yaml
Answer: C

What is a benefit of using Azure App Service for publishing an ASP.NET Core app?
A. Integrated CI/CD pipeline support
B. Requires no configuration
C. Local database support only
D. Automatic compilation of code
Answer: A

What is the role of the RuntimeIdentifier in an ASP.NET Core publish configuration?
A. To specify which .NET runtime to include
B. To define the target platform (e.g., win-x64, linux-x64)
C. To manage application settings
D. To configure the database
Answer: B

Which of the following methods allows you to publish an ASP.NET application to IIS?
A. Web Deploy
B. FTP
C. Publish to Folder
D. All of the above
Answer: D

What is the main difference between Framework-dependent and Self-contained deployment in ASP.NET Core?
A. Framework-dependent deployment includes the runtime; self-contained does not
B. Framework-dependent requires the runtime to be installed on the server; self-contained includes it
C. Self-contained requires less disk space
D. Framework-dependent runs on any OS
Answer: B

Which file needs to be updated with environment-specific configuration when publishing to Azure?
A. web.config
B. Startup.cs
C. appsettings.{Environment}.json
D. Global.asax
Answer: C

What is a benefit of publishing an ASP.NET app as a Docker container?
A. Simplified version control
B. Cross-platform support
C. Larger deployment size
D. Requires IIS
Answer: B

When publishing an ASP.NET Core application to a Linux server, which server is commonly used?
A. IIS
B. Nginx
C. Apache
D. Kestrel
Answer: B

Which of the following is NOT a valid deployment option for an ASP.NET application?
A. File System
B. GitHub Actions
C. Web Deploy
D. Google Play Store
Answer: D

How do you manage environment-specific configurations when deploying to Azure App Service?
A. Use App Service Configuration settings
B. Modify web.config
C. Modify appsettings.json directly
D. Use Docker
Answer: A

Which command in the Azure CLI is used to deploy an ASP.NET application to Azure App Service?
A. az webapp deploy
B. az appservice publish
C. az appservice plan create
D. az publish webapp
Answer: A

What is the purpose of the dotnet store command in ASP.NET Core?
A. To install NuGet packages
B. To package libraries for sharing
C. To publish the app to a cloud service
D. To build and cache platform-specific packages
Answer: D

Which service in Azure is commonly used to deploy ASP.NET Core web applications?
A. Azure App Service
B. Azure Virtual Machines
C. Azure Blob Storage
D. Azure CDN
Answer: A

What is the advantage of using GitHub Actions to publish an ASP.NET Core app?
A. Built-in CI/CD pipelines
B. Local development only
C. Requires manual deployment
D. No support for Linux hosting
Answer: A

Which command can be used to clean the output folder before publishing an ASP.NET app?
A. dotnet clean
B. dotnet reset
C. dotnet remove
D. dotnet unpublish
Answer: A

How can you include database migration scripts when publishing an ASP.NET Core app?
A. Add them to the Publish Profile settings
B. Modify Startup.cs
C. Use Entity Framework Core migrations
D. Add them to the web.config file
Answer: C

What does the “Remove additional files at destination” option do in Visual Studio’s publish settings?
A. It deletes all files in the destination folder before publishing
B. It keeps the original files intact during publishing
C. It archives the existing files
D. It excludes certain files from publishing
Answer: A

Which file is essential when publishing an ASP.NET Core app to IIS?
A. web.config
B. appsettings.json
C. Global.asax
D. Program.cs
Answer: A

What is the role of app_offline.htm in an ASP.NET app during publishing?
A. To temporarily take the app offline during deployment
B. To show an error page
C. To handle routing
D. To configure application settings
Answer: A

Which of the following deployment strategies ensures zero downtime for ASP.NET Core apps?
A. Blue-Green Deployment
B. Single Server Deployment
C. Manual FTP Deployment
D. Localhost Deployment
Answer: A

Which of the following tools can be used for automated deployments in Azure DevOps?
A. Pipelines
B. FTP
C. Docker Swarm
D. IIS
Answer: A

Which extension is used for transforming configuration files like web.config during publishing?
A. .xml
B. .transform
C. .pubxml
D. .json
Answer: B

What is the advantage of using the dotnet watch command when developing an ASP.NET Core app?
A. It automatically rebuilds and restarts the app on code changes
B. It deploys the app to the server
C. It publishes the app to Azure
D. It updates NuGet packages
Answer: A

Which environment variable is commonly used to specify the hosting environment in ASP.NET Core?
A. ASPNETCORE_ENVIRONMENT
B. NET_ENV
C. CORE_ENVIRONMENT
D. APP_ENV
Answer: A

What is the default publishing method when using the Publish option in Visual Studio for ASP.NET apps?
A. File System
B. Web Deploy
C. FTP
D. Docker
Answer: B

Which tool can be used to package an ASP.NET Core app into a single executable?
A. dotnet publish with --self-contained
B. dotnet build
C. nuget pack
D. dotnet run
Answer: A

What does “Azure App Service” provide when publishing an ASP.NET Core app?
A. Scalable web hosting with built-in CI/CD options
B. Local-only hosting
C. High latency and slow performance
D. No support for custom domains
Answer: A

How do you ensure that an ASP.NET Core app runs in a specific environment when deployed?
A. Set the ASPNETCORE_ENVIRONMENT variable
B. Modify Startup.cs
C. Add a new web.config file
D. Use the dotnet setenv command
Answer: A

Which feature allows you to manage secrets securely when publishing an ASP.NET app to Azure?
A. Azure Key Vault
B. Azure CDN
C. Web Deploy
D. FTP
Answer: A