Unit 1: Introduction to .NET and C# - Practice Quiz

CSE253 — .Net Programming 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is .NET primarily used for?

Introduction to .NET and its features Easy
A. Developing different types of applications
B. Designing only printed documents
C. Managing only computer hardware
D. Creating only spreadsheet formulas

2 Which feature allows .NET applications to run on multiple operating systems?

Introduction to .NET and its features Easy
A. Manual memory allocation
B. Single-user access
C. Fixed hardware support
D. Cross-platform support

3 Which platform was originally designed mainly for Windows applications?

Difference between .NET Framework, .NET Core and .NET Easy
A. .NET CLI
B. .NET Core
C. .NET Framework
D. Modern .NET

4 What is a major characteristic of .NET Core?

Difference between .NET Framework, .NET Core and .NET Easy
A. It works only with Windows XP
B. It requires no programming language
C. It is used only for databases
D. It supports multiple operating systems

5 What does the .NET SDK provide?

.NET SDK and Runtime Easy
A. Only database backup files
B. Only desktop wallpaper tools
C. Only files for running applications
D. Tools for building applications

6 What is the main purpose of the .NET Runtime?

.NET SDK and Runtime Easy
A. Installing operating systems
B. Creating project templates
C. Running .NET applications
D. Editing source code only

7 What does CLR stand for?

Common Language Runtime (CLR) Easy
A. Common Link Resource
B. Common Language Runtime
C. Computer Language Register
D. Code Loading Repository

8 Which service is commonly provided by the CLR?

Common Language Runtime (CLR) Easy
A. Automatic memory management
B. Physical disk manufacturing
C. Internet connection installation
D. Keyboard layout printing

9 What is the .NET Class Library?

.NET Class Library Easy
A. A list of internet websites
B. A collection of computer drivers
C. A collection of reusable classes
D. A tool for formatting disks

10 Which task can be supported by classes in the .NET Class Library?

.NET Class Library Easy
A. Reading and writing files
B. Manufacturing a processor
C. Changing electrical voltage
D. Replacing computer hardware

11 Which application is a full-featured IDE for .NET development?

Setting up development environment using Visual Studio and VS Code Easy
A. File Explorer
B. Paint
C. Visual Studio
D. Calculator

12 What is Visual Studio Code commonly described as?

Setting up development environment using Visual Studio and VS Code Easy
A. A lightweight source code editor
B. A physical programming device
C. A database server platform
D. A computer operating system

13 Which command creates a new .NET project?

Introduction to .NET CLI and commonly used CLI commands Easy
A. dotnet make
B. dotnet open
C. dotnet new
D. dotnet start

14 Which command builds a .NET project?

Introduction to .NET CLI and commonly used CLI commands Easy
A. dotnet compile
B. dotnet create
C. dotnet package
D. dotnet build

15 Which file commonly contains configuration for a .NET project?

Project structure in .NET applications Easy
A. A document with a .music extension
B. A folder with a .hardware extension
C. A project file with a .csproj extension
D. A text file with a .photo extension

16 What is NuGet used for in .NET development?

NuGet Package Manager Easy
A. Designing physical computer parts
B. Creating operating system accounts
C. Managing computer power settings
D. Managing reusable software packages

17 Which command runs a .NET application from its project folder?

Building and executing .NET applications Easy
A. dotnet run
B. dotnet launch
C. dotnet perform
D. dotnet execute

18 What type of programming language is C#?

Introduction to C# Easy
A. A hardware description language
B. A general-purpose programming language
C. A markup language for web pages
D. A query language for tables only

19 Which method is traditionally used as the starting point of a C# console program?

C# program structure Easy
A. Begin
B. Main
C. Launch
D. Start

20 What is Git mainly used for?

Introduction to Git and GitHub for source code management Easy
A. Compiling computer hardware
B. Managing screen brightness
C. Tracking changes in source code
D. Designing presentation slides

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?

Introduction to .NET and its features Medium
A. Cross-platform application support
B. Windows-only desktop integration
C. Language-specific memory management
D. Registry-based configuration support

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?

Introduction to .NET and its features Medium
A. Package restoration
B. Just-in-time debugging
C. Assembly signing
D. Garbage collection

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?

Difference between .NET Framework, .NET Core and .NET Medium
A. .NET Core 2.1
B. .NET Framework 4.8
C. Modern .NET
D. ASP.NET Web Forms

24 An existing application depends heavily on ASP.NET Web Forms and Windows-specific .NET Framework libraries. Which migration decision is most appropriate initially?

Difference between .NET Framework, .NET Core and .NET Medium
A. Replace the runtime with only the .NET SDK
B. Compile it as a Linux-native application immediately
C. Keep it on .NET Framework while assessing dependencies
D. Move it directly to .NET without compatibility testing

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?

.NET SDK and Runtime Medium
A. The NuGet command-line client
B. The Visual Studio IDE
C. The complete .NET SDK
D. The matching .NET Runtime

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?

.NET SDK and Runtime Medium
A. The project contains no namespace
B. The application uses garbage collection
C. Only the .NET Runtime is installed
D. Only the .NET SDK is installed

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?

Common Language Runtime (CLR) Medium
A. C# source statements
B. Common Intermediate Language
C. Native machine instructions
D. NuGet package metadata

28 When a managed .NET method is called for the first time, which CLR component commonly translates its intermediate code into native machine code?

Common Language Runtime (CLR) Medium
A. C# preprocessor
B. Just-in-time compiler
C. NuGet resolver
D. Garbage collector

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?

.NET Class Library Medium
A. System.Console
B. System.Random
C. System.Math
D. 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?

Setting up development environment using Visual Studio and VS Code Medium
A. .NET Runtime and a Git extension
B. .NET SDK and a C# extension
C. Visual Studio Build Tools and IIS
D. NuGet client and a theme extension

31 A developer wants to create a console project named InventoryApp in a new directory. Which command performs this task?

Introduction to .NET CLI and commonly used CLI commands Medium
A. dotnet new console -n InventoryApp
B. dotnet build console -n InventoryApp
C. dotnet run console -n InventoryApp
D. 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?

Introduction to .NET CLI and commonly used CLI commands Medium
A. dotnet publish
B. dotnet clean
C. dotnet restore
D. 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?

Project structure in .NET applications Medium
A. The launchSettings.json file
B. The .csproj file
C. The Program.cs file
D. The .sln file

34 After compiling a .NET project, a developer sees bin and obj directories. Which description correctly distinguishes them?

Project structure in .NET applications Medium
A. bin holds settings, while obj holds solution files
B. bin holds final outputs, while obj holds intermediate files
C. bin holds source files, while obj holds final outputs
D. 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?

NuGet Package Manager Medium
A. dotnet restore package Newtonsoft.Json
B. dotnet build package Newtonsoft.Json
C. dotnet add package Newtonsoft.Json
D. 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?

NuGet Package Manager Medium
A. Properties/launchSettings.json
B. obj/project.assets.json
C. .git/HEAD
D. 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?

Building and executing .NET applications Medium
A. dotnet restore --no-build
B. dotnet build --no-run
C. dotnet execute --cached
D. 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?

Introduction to C# Medium
A. Keep int and call ToString()
B. Change the type to double
C. Change the type to bool
D. Keep int and cast the value

39 Consider a traditional C# console application containing several classes. Which method signature can serve as its entry point?

C# program structure Medium
A. static void Main(string[] args)
B. static int Run(object args)
C. public void Start(string[] args)
D. 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?

Introduction to Git and GitHub for source code management Medium
A. git pull Program.cs followed by git stage "Update program"
B. git clone Program.cs followed by git commit "Update program"
C. git add Program.cs followed by git commit -m "Update program"
D. 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?

Introduction to .NET and its features Hard
A. Managed execution over a cross-platform runtime
B. Platform-specific native compilation
C. Use of only interpreted C# code
D. A shared Windows registry configuration

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?

Difference between .NET Framework, .NET Core and .NET Hard
A. Keep it on a compatible version of .NET Framework
B. Move directly to .NET 8 without code changes
C. Port the application to .NET Core using System.Web
D. Replace IIS with the .NET CLI runtime

43 A deployment server must execute a framework-dependent application but must not compile, restore, or create new projects. Which installation is normally sufficient?

.NET SDK and Runtime Hard
A. Only the C# compiler package
B. Only the NuGet client
C. The matching .NET Runtime
D. The matching .NET SDK

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?

Common Language Runtime (CLR) Hard
A. Assembly version binding
B. Source-code compilation
C. NuGet package restoration
D. Garbage collection

45 Two libraries written in different .NET languages exchange objects through public methods. Which CLR feature most directly makes this interoperability possible?

Common Language Runtime (CLR) Hard
A. A package-locking algorithm
B. A platform-specific user interface
C. A shared Git repository
D. A common type system

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?

.NET Class Library Hard
A. The compiler embeds every API into each source file
B. GitHub supplies the APIs during program execution
C. The CLR converts all operating-system calls into SQL
D. The .NET Class Library exposes standardized reusable APIs

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?

Setting up development environment using Visual Studio and VS Code Hard
A. VS Code itself includes the complete .NET SDK
B. The editor is installed, but the required SDK or extensions may be missing
C. The project must be converted to a Visual Studio solution
D. C# projects cannot be built outside Visual Studio

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?

Setting up development environment using Visual Studio and VS Code Hard
A. The solution must be stored inside a GitHub repository
B. The project needs a second Main method
C. The project file must be renamed to startup.cs
D. The required Visual Studio workload or project components were not installed

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?

Introduction to .NET CLI and commonly used CLI commands Hard
A. dotnet restore --no-build
B. dotnet clean --no-build
C. dotnet build --no-restore
D. 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?

Introduction to .NET CLI and commonly used CLI commands Hard
A. dotnet run --no-build
B. dotnet restore --no-cache
C. dotnet new --no-build
D. 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?

Project structure in .NET applications Hard
A. The project file excludes all source files by default
B. The CLR discovers source files at runtime
C. NuGet generates source files during every compilation
D. The SDK implicitly includes conventional source files

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?

Project structure in .NET applications Hard
A. Whether Program.cs is placed before the project file
B. Whether the package name contains the target framework
C. Whether the package has compatible assets or a compatible target framework
D. Whether GitHub has indexed the package source

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?

NuGet Package Manager Hard
A. Install the CLR manually
B. Rename the package reference
C. Run package restore
D. Run 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?

NuGet Package Manager Hard
A. Delete the project file before restoring
B. Compile exclusively through Visual Studio
C. Use a lock file and controlled package sources
D. Reference every package only by its display name

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?

Building and executing .NET applications Hard
A. The CLR silently recompiles it for the installed runtime
B. NuGet restores the runtime during application startup
C. The application usually fails because the required runtime is unavailable
D. The application automatically bundles the missing runtime

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?

Building and executing .NET applications Hard
A. Publish only the project file
B. Use dotnet restore only
C. Use a self-contained deployment
D. Use a framework-dependent deployment

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?

Introduction to C# Hard
A. The CLR forbids reassignment of string variables
B. Parameters are passed by value unless specified otherwise
C. C# converts all parameters into value types
D. Strings are mutable reference objects

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?

Introduction to C# Hard
A. The string is guaranteed to be empty
B. The value is automatically converted to a value type
C. The runtime has already thrown a null exception
D. The compiler cannot prove that the value is non-null

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?

C# program structure Hard
A. The CLR requires two entry points for console applications
B. Top-level statements generate an entry point, creating a conflict
C. A console project cannot contain methods
D. Top-level statements require a namespace named Main

60 A file-scoped namespace declaration is followed by a second namespace declaration in the same file. Why is this invalid?

C# program structure Hard
A. The namespace must be declared after all type declarations
B. A file-scoped namespace must be the only namespace declaration in its file
C. File-scoped namespaces can appear only in project files
D. Namespaces cannot contain classes in C#