mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-02 16:01:34 -04:00
feat(curriculum): add questions to C# challenges (#50766)
This commit is contained in:
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
A developer needs to iterate through an array of items to find one that matches a certain criteria. Which is the best iteration statement for this purpose?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`foreach`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`for`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`while`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
What is the purpose of the `break` keyword?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
The `break` keyword tells the runtime to continue evaluating other cases in the `switch` construct.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
The `break` keyword tells the runtime to stop evaluating other cases in the `switch` construct.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
The `break` keyword tells the runtime to exit the application.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
A developer needs to create an iteration statement. Under what condition is a `while` statement a better choice than a `do` statement?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
When the expression values evaluated by the iteration statement are unknown prior to the iteration code block.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
When the expression values evaluated by the iteration statement are known prior to the iteration code block.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
When the developer creates nested `do` or `while` loops.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following describes the affect of a `using` statement?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
Affects only the first code block in the code file.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
Affects only the current code block in the code file.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
Affects all of the code in the code file.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following lines of code is a valid use of the conditional operator?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`int value = amount >= 10? 10: 20;`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`int value = amount >= 10: 10? 20;`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`int value = amount >= 10? 10| 20;`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,21 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
When is it appropriate to use a `switch-case` construct rather than a `if-elseif-else` construct?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
A `switch-case` construct is appropriate when more than 2-3 `else if` code blocks are required.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
A `switch-case` construct is appropriate when the number of `case` patterns is small.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
A `switch-case` construct is appropriate when the selection statement is inside a loop.
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following `for` statements is correct?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`for (int x = 20: x < 80: x++)`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`for (int j = 0; j == 80; j + 1)`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`for (int counter = 20; counter < 80; counter++)`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the choices below is not a valid operator in C#?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`%%`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`&&`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`||`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
What is an object?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
A memory address.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
A stateless class.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
An instance of a class.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
A developer is working with two other developers to update a collection of applications. The developers will use code comments during the update process. Which of the following describes an appropriate use of code comments?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
When updates are made, the developers use line and block comments to identify each individual code update.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
When updates are made, the developers leave all existing code comments intact. New comments are added to indicate when old comments no longer apply.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
When updates are made, the developers summarize changes using block comments.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following is a bad reason to use a code comment?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
To describe the high-level intent of the code.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
To temporarily comment out a line of code while evaluating a feature in a different way.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
To explain how a new C# keyword works.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
A developer writes an application that uses a `foreach` loop to iterate through an array containing 20 elements. After the application is complete, the developer learns that the array must be updated to include 40 elements. The application needs to examine all 40 array elements. Which of the following items describes the required code update?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
Create a second `foreach` loop that iterates through the additional items.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
No changes are required to the `foreach` loop.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
Place the original `foreach` loop inside the code block of a second `foreach` loop that iterates twice.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following choices provides the best description of an Integrated Development Environment (IDE)?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
Visual Studio Code is an Integrated Development Environment.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
An Integrated Development Environment is tool that makes it easier to write code.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
An IDE is a suite of tools that supports the full software development lifecycle.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,21 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following foreach statements is syntactically correct?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`foreach (int value of values)`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`foreach (int value with values)`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
`foreach (int value in values)`
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
A developer wants to create a method that returns a value in an array. Which of the following options would be a good choice for a method signature?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`string GetValueAtIndex(string[] array, int index)`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`bool GetValueAtIndex(string[] array, int index)`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`int GetValueAtIndex(int index)`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following options correctly returns a `string` value?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`return "";`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`return 'a';`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`return 5;`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Given the method signature, `void Print(string name, string number = "", bool member = false)`, which of the following options correctly uses named and optional arguments?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`Print("Tony", member: true);`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`Print(number: "555", member: false)`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`Print("Tony", false)`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,29 +16,21 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
What is the purpose of defining an optional parameter in a method?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
To cause a method to perform a different task.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
To overload a method.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
To simplify the required parameters when a parameter isn't significant to the result.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following correctly declares a method?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`DisplayNumbers();`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`void DisplayNumbers{};`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`void DisplayNumbers() { }`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,21 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following options can be used set a breakpoint in Visual Studio Code?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
Left-click in the column to the left of a line number in the code editor.
|
||||
Correct. A breakpoint can be set by positioning the mouse pointer in the column to the left of a line number and then left-clicking.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
Select Toggle Breakpoint on the Edit menu.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
Right-click in the middle of a line of code, and then select Toggle Breakpoint.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
When should a method throw an exception?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
A method should throw an exception when the method can complete its intended purpose.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
A method should throw an exception when the method can't complete its intended purpose.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
A method should throw an exception when an exception type matches the intended purpose of the method.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,16 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
When is an `ArgumentOutOfRangeException` exception thrown?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
An `ArgumentOutOfRangeException` exception is thrown when an attempt is made to index an array outside the bounds of the array.
|
||||
|
||||
---
|
||||
An `ArgumentOutOfRangeException` exception is thrown when the value of an argument is outside the allowable range of values as defined by the method.
|
||||
|
||||
B
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
An `ArgumentOutOfRangeException` exception is thrown when an attempt is made to store a value of one type in an array of another type.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
When is an `ArrayTypeMismatchException` exception thrown?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
An `ArrayTypeMismatchException` exception is thrown when an attempt is made to store a value of one type in an array of another type.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
An `ArrayTypeMismatchException` exception is thrown when attempting to access a member on a type whose value is null.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
An `ArrayTypeMismatchException` exception is thrown when an attempt is made to index an array outside the bounds of the array.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which section of the RUN AND DEBUG view is used to track the current point of execution within the running application?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
The VARIABLES section.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
The CALL STACK section.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
The WATCH section.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
What is the relationship between the type of exception and the information it contains?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
The type of exception determines the information it contains.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
The type of exception and the information it contains are unrelated.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
The information contained in an exception determines the type of exception.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
To sort a string array, why is it be important to use the `String.Trim()` method on each array element before sorting?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
Only string arrays with elements trimmed with `String.Trim()` can sort
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`String.Trim()` removes leading white space that would sort before numbers and letters.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
The array sort is noticeably faster using `String.Trim()` on each element.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
A piece of code must store whole numeric values between negative and positive `1,000,000`. Which data type should you choose?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
float
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
double
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
int
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
What type of action is being performed when changing a `float` into an `int`?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
A narrowing conversion.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
A widening conversion.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
An illegal conversion.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
For the C# code `Console.WriteLine("C110".PadLeft(6, '0'));`, which is the expected output?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`C11000`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`C110000000`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`00C110`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
For the code `decimal.TryParse(numberString, out myConvert))` when the type of `numberString` is a String. Which best describes the value type for `myConvert` when the `TryParse()` is successful?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
A string representing numeric digits.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
A Boolean value.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
A decimal
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which method finds the next index of either the `-` char, the `=` char, or the `_` char?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`IndexOfAny()`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`Remove()`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`IndexOf()`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which method changes the order of items in an `string` array?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`myArray.Resize()`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`myArray.Clear()`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`Array.Sort()`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
What is wrong with the following code? `int sophiaSum; Console.WriteLine("Sophia: " + sophiaSum);`
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`sophiaSum` is not initialized before use
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`sophiaSum` is not implicitly typed to a string
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`sophiaSum` should use the var keyword
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
1
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Suppose `decimal gradePointAverage = 3.99872831;`. What is the value of `(int) gradePointAverage`?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
3.99
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
4
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
3
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
@@ -16,28 +16,24 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
What is the value of the following result? `int result = 3 + 1 * 5 / 2;`
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
10
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
5
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
6
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
5.5
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following lines of code correctly uses string interpolation assuming that the variable `value` is a string?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
'`Console.WriteLine(@"My value: {value}");'`'
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
'`Console.WriteLine($"My value: {value}");`'
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
'`Console.WriteLine(@"My value: [value]");`'
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,20 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
Which of the following lines of code creates a variable correctly?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`int x = 12.3m;`
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`decimal x = 12.3m;`
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
`bool x = 'False';`
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
2
|
||||
|
||||
@@ -16,28 +16,24 @@ This challenge will be partially completed on Microsoft's learn platform. Follow
|
||||
|
||||
## --text--
|
||||
|
||||
What is C#?
|
||||
What is the difference between `Console.Write` and `Console.WriteLine`?
|
||||
|
||||
## --answers--
|
||||
|
||||
A
|
||||
`Console.Write` prints the output on a new line.
|
||||
|
||||
---
|
||||
|
||||
B
|
||||
`Console.WriteLine` prints the output on a new line.
|
||||
|
||||
---
|
||||
|
||||
C
|
||||
`Console.WriteLine` appends a new line after the output.
|
||||
|
||||
---
|
||||
|
||||
D
|
||||
|
||||
---
|
||||
|
||||
E
|
||||
There is no difference.
|
||||
|
||||
## --video-solution--
|
||||
|
||||
4
|
||||
3
|
||||
|
||||
Reference in New Issue
Block a user