Bird
Raised Fist0
C Sharp (C#)programming~10 mins

.NET SDK Installation and Setup in C Sharp (C#) - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print the .NET runtime version installed on your machine.

C Sharp (C#)
Console.WriteLine(".NET Runtime Version: " + [1]);
Drag options to blanks, or click blank then click option'
AEnvironment.GetEnvironmentVariable("DOTNET_VERSION")
BSystem.Environment.Version.ToString()
Cdotnet --version
DConsole.ReadLine()
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to run shell commands like 'dotnet --version' directly in code.
Using Console.ReadLine() which waits for user input instead of showing version.
2fill in blank
medium

Complete the code to create a new console project using the .NET CLI command.

C Sharp (C#)
var process = new System.Diagnostics.Process();
process.StartInfo.FileName = "dotnet";
process.StartInfo.Arguments = "[1]";
process.Start();
Drag options to blanks, or click blank then click option'
Abuild console
Bcreate console
Cinit console
Dnew console
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'create' or 'init' which are not valid dotnet commands.
Using 'build' which compiles but does not create a project.
3fill in blank
hard

Fix the error in the code that tries to check if the .NET SDK is installed by running 'dotnet --version'.

C Sharp (C#)
var process = new System.Diagnostics.Process();
process.StartInfo.FileName = "dotnet";
process.StartInfo.Arguments = "[1]";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.Start();
Drag options to blanks, or click blank then click option'
A--version
Bshow-version
Cversion
D-version
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-version' or 'version' without double dashes.
Setting UseShellExecute to true which prevents output redirection.
4fill in blank
hard

Fill both blanks to install the latest .NET SDK using the command line.

C Sharp (C#)
string command = "dotnet [1] [2]";
Drag options to blanks, or click blank then click option'
Ainstall
Bupdate
Cnew
Dupgrade
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'new' which creates projects, not installs SDK.
Using 'upgrade' which is not a dotnet CLI command.
5fill in blank
hard

Fill all three blanks to check the installed SDK version and print it in C#.

C Sharp (C#)
var process = new System.Diagnostics.Process();
process.StartInfo.FileName = "dotnet";
process.StartInfo.Arguments = "[1]";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = [2];
process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();
Console.WriteLine("Installed SDK version: " + [3]);
Drag options to blanks, or click blank then click option'
A--version
Bfalse
Coutput
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Setting UseShellExecute to true which disables output redirection.
Using wrong argument like '-version' or 'version'.
Printing the wrong variable instead of the output.

Practice

(1/5)
1. What is the primary purpose of installing the .NET SDK on your computer?
easy
A. To build and run C# programs
B. To browse the internet
C. To edit images
D. To play music files

Solution

  1. Step 1: Understand what SDK means

    The .NET SDK contains tools needed to develop and run C# programs.
  2. Step 2: Match purpose with options

    Only To build and run C# programs mentions building and running C# programs, which is the SDK's purpose.
  3. Final Answer:

    To build and run C# programs -> Option A
  4. Quick Check:

    .NET SDK purpose = build and run C# programs [OK]
Hint: SDK is for development tools, not unrelated tasks [OK]
Common Mistakes:
  • Confusing SDK with software for browsing or media
  • Thinking SDK is only for running, not building
  • Assuming SDK is an editor or player
2. Which command correctly checks the installed .NET SDK version in the terminal?
easy
A. dotnet check-version
B. dotnet version
C. dotnet --version
D. dotnet show version

Solution

  1. Step 1: Recall the official command

    The official command to check .NET SDK version is dotnet --version.
  2. Step 2: Compare with options

    Only dotnet --version matches the exact command syntax.
  3. Final Answer:

    dotnet --version -> Option C
  4. Quick Check:

    Check version command = dotnet --version [OK]
Hint: Use double dash before version to check SDK version [OK]
Common Mistakes:
  • Using single dash or missing dashes
  • Adding extra words like 'check' or 'show'
  • Confusing with other dotnet commands
3. After installing the .NET SDK, you run these commands:
dotnet new console -o MyApp
cd MyApp
dotnet run

What will be the output?
medium
A. Error: Command not found
B. Hello, World!
C. No output, program does nothing
D. Project creation failed

Solution

  1. Step 1: Understand commands run

    dotnet new console -o MyApp creates a new console app named MyApp; cd MyApp moves into that folder; dotnet run runs the app.
  2. Step 2: Recall default console app output

    The default console app prints "Hello, World!" when run.
  3. Final Answer:

    Hello, World! -> Option B
  4. Quick Check:

    dotnet new console output = Hello, World! [OK]
Hint: Default console app prints Hello, World! on run [OK]
Common Mistakes:
  • Expecting no output or errors after correct commands
  • Confusing project creation with running
  • Not changing directory before running
4. You try to run dotnet run but get an error saying no project found. What is the most likely cause?
medium
A. You did not navigate into the project folder
B. The .NET SDK is not installed
C. You typed dotnet run incorrectly
D. Your computer is offline

Solution

  1. Step 1: Analyze error message

    Error says no project found, meaning dotnet run can't find a project file in current folder.
  2. Step 2: Identify common cause

    This usually happens if you forget to change directory into the project folder after creating it.
  3. Final Answer:

    You did not navigate into the project folder -> Option A
  4. Quick Check:

    No project found error = wrong folder [OK]
Hint: Always cd into project folder before running dotnet run [OK]
Common Mistakes:
  • Assuming SDK is missing without checking
  • Blaming internet connection for local build errors
  • Ignoring folder navigation step
5. You want to create a new console app named Calculator and run it immediately. Which sequence of commands is correct?
hard
A. dotnet new console Calculator && dotnet run
B. dotnet run Calculator && dotnet new console
C. cd Calculator && dotnet new console && dotnet run
D. dotnet new console -o Calculator && cd Calculator && dotnet run

Solution

  1. Step 1: Understand command order

    First create project folder with dotnet new console -o Calculator, then move into it with cd Calculator, then run with dotnet run.
  2. Step 2: Check options for correct syntax and order

    Only dotnet new console -o Calculator && cd Calculator && dotnet run has correct order and syntax to create, enter folder, and run.
  3. Final Answer:

    dotnet new console -o Calculator && cd Calculator && dotnet run -> Option D
  4. Quick Check:

    Create, cd, run sequence = dotnet new console -o Calculator && cd Calculator && dotnet run [OK]
Hint: Create folder, cd in, then run in that folder [OK]
Common Mistakes:
  • Running before creating project
  • Not changing directory before running
  • Using wrong command syntax for project creation
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard