博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c#之.net 版本问题_C#和.NET棘手的问题
阅读量:2509 次
发布时间:2019-05-11

本文共 6654 字,大约阅读时间需要 22 分钟。

c#之.net 版本问题

I have collected some most interesting and not well-known questions from the web. And also based on interesting books, articles and videos I have seen, I have wrote some of questions myself.

我从网络上收集了一些最有趣且不为人所知的问题。 而且,根据我所看到的有趣的书籍,文章和视频,我自己写了一些问题。

I want propose you to guess right answer.

我想建议您猜测正确的答案。

1. What would be displayed? (if something would be displayed at all)

1.将显示什么? (如果将完全显示某些内容)

string nullString = (string)null;Console.WriteLine (nullString is string);

回答 (Answer)

Credits: h

学分:h

2. What would be displayed on the screen in .NET console application?

2. .NET控制台应用程序的屏幕上将显示什么?

Console.WriteLine (Math.Round(1.5));Console.WriteLine (Math.Round(2.5));

回答 (Answer)

3. What would be the result of

3.会有什么结果

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) True

a)正确

b) False

b)错误

c) Exception would be thrown

c)将引发异常

d) That depend (could be either true or false)

d)依赖(可以为真或为假)

回答 (Answer)

When running normally, the JIT can store the result of the sum more accurately than a float can really represent — it can use the default x86 80-bit representation, for instance, for the sum itself, the return value, and the local variable.

正常运行时,JIT可以比浮点数实际表示的结果更准确地存储和的结果-例如,它可以使用默认的x86 80位表示形式来表示和本身,返回值和局部变量。

Credits:

学分:

4. What would be the result of

4.的结果是什么

float price = 4.99F;int quantity = 17;float total = price * quantity;Console.WriteLine("The total price is ${0}.", total);

a) The total price is $85

a)总价格为$ 85

b) The total price is $84.83

b)总价格为$ 84.83

c) The total price is $84

c)总价为$ 84

d) The total price is $84.82999

d)总价格为$ 84.82999

回答 (Answer)

Credits:

学分:

5. What is the right way to store passwords in database? Choose one or multiple correct answers

5.在数据库中存储密码的正确方法是什么? 选择一个或多个正确答案

a) In plain text

a)纯文本

b) Encrypted with DES

b)用DES加密

c) Encrypted with AES

c)用AES加密

d) Hashed with MD5

d)与MD5混战

e) Hashed with SHA512

e)与SHA512混为一谈

回答 (Answer)

Don’t use MD5 anymore

不再使用MD5

By the way it is also possible to use keyed hashing algorithms: HMACSHA1 or MACTripleDES

顺便说一句,也可以使用键控哈希算法:HMACSHA1或MACTripleDES

6. In between different .NET technologies there is a lot of timers. Which one timer does not exist?

6.在不同的.NET技术之间,有很多计时器。 哪一个计时器不存在?

a) Timer from System.Windows.Forms

a)来自System.Windows.Forms的计时器

b) DispatchTimer from System.Windows.Threading

b)来自System.Windows.Threading的DispatchTimer

c) DispatchTimer from Windows.UI.XAML

c)Windows.UI.XAML中的DispatchTimer

d) Timer from System.Timers

d)来自System.Timers的计时器

e) Timer from System.Windows.Threading.Timers

e)来自System.Windows.Threading.Timers的计时器

f) Timer from System.Threading

f)来自System.Threading的计时器

回答 (Answer)

Credits: CLR via C# Jeffrey Richter

鸣谢:通过C#进行的CLR Jeffrey Richter

7. Which one .NET REPL does not exists?

7.哪一个.NET REPL不存在?

a) dotnetfiddle.net

a)dotnetfiddle.net

b) repl.it/languages/csharp

b)repl.it/语言/ csharp

c) csharpcompiler.net

c)csharpcompiler.net

d) dotnet.microsoft.com/platform/try-dotnet

d)dotnet.microsoft.com/platform/try-dotnet

e) csharppad.com

e)csharppad.com

回答 (Answer)

8. If you want to set a type long for a number in C# you can add at the end letter L or l. For example:

8.如果要在C#中为数字设置长类型,则可以在末尾添加字母L或l。 例如:

var l = 138l;

With which letter it is possible to mark a decimal type?

可以用哪个字母标记十进制类型?

a) C or c

a)C或c

b) D or d

b)D或d

c) M or m

c)M或m

d) E or e

d)E或e

回答 (Answer)

9. What will display on the screen console application that will contain next code:

9.屏幕控制台应用程序上将显示的内容将包含以下代码:

class Program    {         static Program()        {            Console.WriteLine("Static constructor");        }         public Program()        {            Console.WriteLine("Constructor");        }        static void Main(string[] args)        {            Console.WriteLine("Main");            Console.ReadLine();        }    }

回答 (Answer)

As you might know, static constructor is called automatically before the first instance is created or any static members are referenced. And only then public constructor is called. But in this case, we are in console application and public constructor doesn’t called.

您可能知道,在创建第一个实例或引用任何静态成员之前,将自动调用静态构造函数。 然后只有公共构造函数被调用。 但是在这种情况下,我们在控制台应用程序中,并且没有调用public构造函数。

10. What would be displayed as result?

10.结果将显示什么?

[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));      }

回答 (Answer)

24 that would be 0011000 in binary system

24在二进制系统中为0011000

Writing numbers in column

在栏中写数字

Funny = 0

有趣= 0

Hilarious = 0

搞笑= 0

Boring = 0

无聊= 0

Cool = 1

酷= 1

Interesting = 1

有趣= 1

Informative = 0

信息量= 0

Error = 0

错误= 0

Credits:

学分:

11. Where is a difference between String and string?

11.字符串和字符串之间有何区别?

回答 (Answer)

Use next link to get more details

使用下一个链接获取更多详细信息

12. What does mean (or at least has meant initially) Visual Studio sign?

12. Visual Studio标志是什么意思(至少起初是什么意思)?

回答 (Answer)

Credits:

鸣谢:

13. Please match:

13.请匹配:

Async/await

异步/等待

Try/catch

试着抓

ValidateAntiForgeryToken

ValidateAntiForgeryToken

with abbreviations:

缩写:

TAP (TAP)

,

SEH (SEH)

,

STP (STP)

回答 (Answer)

Try/catch -> SEH (Structured Exception Handling)

尝试/捕获-> SEH(结构化异常处理)

ValidateAntiForgeryToken -> STP (Synchronizer Token Pattern)

ValidateAntiForgeryToken-> STP(同步器令牌模式)

14. Which one is not .NET CMS?

14.哪个不是.NET CMS?

a) mojoPortal

a)mojoPortal

b) N2 CMS

b)N2 CMS

c) Atomic CMS

c)原子CMS

d) Composite C1

d)复合C1

e) Concrete5

e)混凝土5

f) Piranha CMS

f)食人鱼CMS

回答 (Answer)

15. What would be displayed on the screen?

15.屏幕上将显示什么?

class Program    {        private static int y = x;        private static int x = 5;        static void Main(string[] args)        {            Console.WriteLine(y);            Console.ReadLine();        }    }

回答 (Answer)

Sometimes declaring variables order plays a role.

有时,声明变量顺序很重要。

16. Which Concurrent Collection class is missing in .Net

16. .Net中缺少哪个并发集合类

a) ConcurrentQueue

a)ConcurrentQueue

b) ConcurrentStack

b)并发堆栈

c) ConcurrentList

c)并发列表

d) ConcurrentDictionary

d)并发词典

e) ConcurrentBag

e)并发袋

回答 (Answer)

17. What is the preferable way to run async code synchronously (if it’s not possible to use await):

17.同步运行异步代码的最佳方法是什么(如果不可能使用等待):

a) Wait()

a)等待()

b) Result()

b)结果()

c) GetAwaiter().GetResult()

c)GetAwaiter()。GetResult()

回答 (Answer)

Wait and Result are throwing aggregate exception instead of normal

等待和结果抛出聚合异常,而不是正常

Credits:

鸣谢:

翻译自:

c#之.net 版本问题

转载地址:http://imbwd.baihongyu.com/

你可能感兴趣的文章
java开发操作系统内核:由实模式进入保护模式之32位寻址
查看>>
第五讲:单例模式
查看>>
Python编程语言的起源
查看>>
Azure ARMTemplate模板,VM扩展命令
查看>>
使用Masstransit开发基于消息传递的分布式应用
查看>>
[CF808A] Lucky Year(规律)
查看>>
关于推送遇到的一些问题
查看>>
寒假作业3 抓老鼠啊~亏了还是赚了?
查看>>
Orcal Job创建实例
查看>>
Django
查看>>
批量Excel数据导入Oracle数据库(引用 自 wuhuacong(伍华聪)的专栏)
查看>>
处理移动障碍
查看>>
优化VR体验的7个建议
查看>>
2015年创业中遇到的技术问题:21-30
查看>>
《社交红利》读书总结--如何从微信微博QQ空间等社交网络带走海量用户、流量与收入...
查看>>
JDK工具(一)–Java编译器javac
查看>>
深入.NET框架与面向对象的回顾
查看>>
merge http://www.cplusplus.com/reference/algorithm/merge/
查看>>
Python-DB接口规范
查看>>
改变label中的某字体颜色
查看>>