I have selected for you some interesting, but not very well-known questions from the world of .NET and C #. Plus, I wrote some questions myself, based on books, articles and videos that I liked.1. What will be displayed on the screen? (if anything is displayed at all)string nullString = (string)null;
Console.WriteLine (nullString is string);
2. What will be displayed by the console .NET application?Console.WriteLine (Math.Round(1.5));
Console.WriteLine (Math.Round(2.5));
Answer2 2. — . , Mono 2 3.
3. What will be the result of executing the following code:static void Main(string[] args)
{
float f = Sum(0.1f, 0.2f);
float g = Sum(0.1f, 0.2f);
Console.WriteLine(f == g);
}
static float Sum(float f1, float f2)
{
return f1 + f2;
}
a) Trueb) Falsec) An exception will be thrownd) It cannot be said unambiguously (most likely true, but it can also be false)4. What will be the result of executing the following code:float price = 4.99F;
int quantity = 17;
float total = price * quantity;
Console.WriteLine("The total price is ${0}.", total);
a) The total price is $ 85b) The total price is $ 84.83c) The total price is $ 84d) The total price is $ 84.829995. What is the best way to store passwords in a database? Select one or more of the answers:a) As plaintextb) Encrypted using DESc) Encrypted using AESd) Cached using MD5e) Cached using SHA512Answere
MD5 .
, keyed hash : HMACSHA1 MACTripleDES
6. In the .NET environment, there are many different timers. Which of the timers does not exist?a) Timer from System.Windows.Formsb) DispatchTimer from System.Windows.Threadingc) DispatchTimer from Windows.UI.XAMLd) Timer from System.Timerse) Timer from System.Windows.Threading.Timersf) Timer from System .ThreadingAnswere
Credits: CLR via C# Jeffrey Richter
7. What .NET REPL does not exist on the network?a) dotnetfiddle.netb) repl.it/languages/csharpc) csharpcompiler.netd) dotnet.microsoft.com/platform/try-dotnete) csharppad.com8. If you want to indicate that the number is of type long, then you can specify the letter l or L. at the end of the number. For example, like this:var l = 138l;
Using which letter can I specify the decimal type?a) C or cb) D or dc) M or md) E or e9. What will be displayed on the screen of the console application containing the following code: class Program
{
static Program()
{
Console.WriteLine("Static constructor");
}
public Program()
{
Console.WriteLine("Constructor");
}
static void Main(string[] args)
{
Console.WriteLine("Main");
Console.ReadLine();
}
}
Answer«Static constructor» «Main»
, . . .
10. What will be displayed as a result? [Flags]
public enum Status
{
Funny = 0x01,
Hilarious = 0x02,
Boring = 0x04,
Cool = 0x08,
Interesting = 0x10,
Informative = 0x20,
Error = 0x40
}
public static void Main (string[] args) {
var code = 24;
Console.WriteLine (String.Format("This Quiz is: {0}", (Status)code));
}
11. What is the difference between String and string?12. What does the Visual Studio symbol mean (or at least initially mean)?13. Please map:Async / awaitTry / catchValidateAntiForgeryTokenwith the following abbreviations:TAP , SEH , STPAnswerAsync/await -> TAP (Task asynchronous programming model)
Try/catch -> SEH (Structured Exception Handling)
ValidateAntiForgeryToken -> STP (Synchronizer Token Pattern)
14. Which of the following is not a .NET CMS?a) mojoPortalb) N2 CMSc) Atomic CMSd) Composite C1e) Concrete5f) Piranha CMS15. What will be displayed on the screen? (if something is displayed)
class Program
{
private static int y = x;
private static int x = 5;
static void Main(string[] args)
{
Console.WriteLine(y);
Console.ReadLine();
}
}
16. What class of the Concurrent Collection does not exist in .Neta) ConcurrentQueueb) ConcurrentStackc) ConcurrentListd) ConcurrentDictionarye) ConcurrentBag17. What method of calling async code in a synchronous way is preferable (of course, this is done in rare situations when await doesn’t work):a) Wait ()b) Result ()c) GetAwaiter (). GetResult ()