Unit 1: Introduction to .NET and C# - Practice Quiz
1 What is .NET primarily used for?
2 Which feature allows .NET applications to run on multiple operating systems?
3 Which platform was originally designed mainly for Windows applications?
4 What is a major characteristic of .NET Core?
5 What does the .NET SDK provide?
6 What is the main purpose of the .NET Runtime?
7 What does CLR stand for?
8 Which service is commonly provided by the CLR?
9 What is the .NET Class Library?
10 Which task can be supported by classes in the .NET Class Library?
11 Which application is a full-featured IDE for .NET development?
12 What is Visual Studio Code commonly described as?
13 Which command creates a new .NET project?
dotnet make
dotnet open
dotnet new
dotnet start
14 Which command builds a .NET project?
dotnet compile
dotnet create
dotnet package
dotnet build
15 Which file commonly contains configuration for a .NET project?
.music extension
.hardware extension
.csproj extension
.photo extension
16 What is NuGet used for in .NET development?
17 Which command runs a .NET application from its project folder?
dotnet run
dotnet launch
dotnet perform
dotnet execute
18 What type of programming language is C#?
19 Which method is traditionally used as the starting point of a C# console program?
Begin
Main
Launch
Start
20 What is Git mainly used for?
21 A development team wants to share business logic between applications running on Windows, Linux, and macOS. Which .NET feature most directly supports this requirement?
22 A C# application creates many temporary objects while processing requests. Which .NET feature automatically reclaims memory occupied by objects that are no longer reachable?
23 A company is starting a new cross-platform web service and wants the currently unified, actively developed .NET platform. Which platform should it choose?
24 An existing application depends heavily on ASP.NET Web Forms and Windows-specific .NET Framework libraries. Which migration decision is most appropriate initially?
25 A production server only needs to execute a framework-dependent .NET application and will never compile source code. What is the minimum appropriate installation?
26
A developer can run an existing .NET application but receives an error that the dotnet new command is unavailable. What is the most likely cause?
27 A C# project is compiled successfully, but its methods have not yet been translated into native processor instructions. What form is the compiled code typically in?
28 When a managed .NET method is called for the first time, which CLR component commonly translates its intermediate code into native machine code?
29 A developer needs to read a text file without writing operating-system-specific file access code. Which .NET class library type is the most appropriate starting point?
System.Console
System.Random
System.Math
System.IO.File
30 A developer is configuring VS Code for C# development on Linux. Which combination provides the essential compiler tools and editor language support?
31
A developer wants to create a console project named InventoryApp in a new directory. Which command performs this task?
dotnet new console -n InventoryApp
dotnet build console -n InventoryApp
dotnet run console -n InventoryApp
dotnet add console -n InventoryApp
32 A cloned project references several NuGet packages, but the package files are not available locally. Which command explicitly downloads the required dependencies?
dotnet publish
dotnet clean
dotnet restore
dotnet format
33 A developer needs to change a console application's target framework and enable nullable reference type analysis. Which file should be edited?
launchSettings.json file
.csproj file
Program.cs file
.sln file
34
After compiling a .NET project, a developer sees bin and obj directories. Which description correctly distinguishes them?
bin holds settings, while obj holds solution files
bin holds final outputs, while obj holds intermediate files
bin holds source files, while obj holds final outputs
bin holds packages, while obj holds Git history
35
A project requires the Newtonsoft.Json library, and the developer wants the dependency recorded in the project file. Which command should be used?
dotnet restore package Newtonsoft.Json
dotnet build package Newtonsoft.Json
dotnet add package Newtonsoft.Json
dotnet reference package Newtonsoft.Json
36 Two developers restore the same project and should receive the same dependency graph when package versions have not changed. Which generated file helps NuGet use the resolved dependency information?
Properties/launchSettings.json
obj/project.assets.json
.git/HEAD
bin/Debug/app.dll
37 A developer has already built a project and wants to run it without triggering another build. Which command is most appropriate?
dotnet restore --no-build
dotnet build --no-run
dotnet execute --cached
dotnet run --no-build
38
A C# variable declared as int count = 5; must later store the value 5.75. Which change best preserves the fractional part?
int and call ToString()
double
bool
int and cast the value
39 Consider a traditional C# console application containing several classes. Which method signature can serve as its entry point?
static void Main(string[] args)
static int Run(object args)
public void Start(string[] args)
private void Main(int args)
40
A developer has modified Program.cs and wants to create a local Git snapshot before sending it to GitHub. Which command sequence is correct?
git pull Program.cs followed by git stage "Update program"
git clone Program.cs followed by git commit "Update program"
git add Program.cs followed by git commit -m "Update program"
git push Program.cs followed by git add -m "Update program"
41 A team needs to run the same application on Windows and Linux while preserving managed memory, type safety, asynchronous programming support, and access to a large standard library. Which .NET characteristic most directly enables this combination?
42
An existing ASP.NET application depends on System.Web and must remain hosted on IIS in a Windows-only environment. Which migration choice has the lowest compatibility risk?
System.Web
43 A deployment server must execute a framework-dependent application but must not compile, restore, or create new projects. Which installation is normally sufficient?
44 A C# method allocates objects repeatedly, and no explicit deallocation occurs. Which CLR responsibility most directly prevents unreachable managed objects from remaining indefinitely in memory?
45 Two libraries written in different .NET languages exchange objects through public methods. Which CLR feature most directly makes this interoperability possible?
46 A project targets a modern .NET version and needs file access, collections, JSON serialization, and networking. Why can it use these APIs without implementing operating-system-specific versions of each feature?
47
A developer can open a C# file in VS Code but receives unresolved project references and cannot run dotnet build. Which diagnosis is most accurate?
48 A Visual Studio solution opens successfully, but a web project lacks debugging support and cannot start with its expected profile. What is the most likely setup issue?
Main method
startup.cs
49 A developer wants to verify that a project compiles without producing output binaries in its normal output location. Which command best matches that intent?
dotnet restore --no-build
dotnet clean --no-build
dotnet build --no-restore
dotnet run --no-build
50 A CI job must run an already-restored project and fail if a build is implicitly required. Which command expresses that requirement?
dotnet run --no-build
dotnet restore --no-cache
dotnet new --no-build
dotnet clean --no-restore
51
A project file contains a PackageReference, and the project has a Program.cs file but no manually maintained list of every source file. Which explanation is correct for modern SDK-style projects?
52
A project targets net8.0 and references a package that supports only net6.0. What is the most important compatibility question before assuming the reference will work?
Program.cs is placed before the project file
53 A package reference is added to a project file, but a clean build on another machine fails because the package cannot be found. Which action is normally required before compilation?
git merge
54 A project uses a package version range, and two developers restore it at different times and receive different transitive dependency versions. Which practice most directly improves reproducibility?
55 A framework-dependent application is built on one machine and copied to another machine that lacks the required target runtime. What is the expected result when it is executed?
56 A team wants a deployment artifact that can run on a target machine without requiring that machine to have the corresponding .NET runtime installed. Which approach is appropriate?
dotnet restore only
57
A method receives a string parameter and assigns a new string to that parameter. The caller's variable still refers to the original string. Which language behavior explains this result?
58
A nullable reference type warning appears when a value obtained from configuration is assigned to a non-nullable string. What does the warning primarily indicate?
59
In a modern console project, a developer adds top-level statements and also declares a conventional static void Main() method. The project fails to compile. What is the most likely reason?
Main
60 A file-scoped namespace declaration is followed by a second namespace declaration in the same file. Why is this invalid?
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →