c#枚举数字转枚举_C#枚举能力问题和解答 套装2

c#枚举数字转枚举

1) There are following statements are given below, which of them are correct about enumeration in C#?
  1. A variable of enum cannot have a private access specifier.

  2. A variable of enum cannot have a protected access specifier.

  3. A variable of enum cannot have a public access specifier.

  4. We can define a variable of enum inside a class or a namespace.

Options:

  1. Only A

  2. Only B

  3. Only D

  4. A and B

Answer & Explanation

Correct answer: 3
Only D

Only D statement is correct about enum.

1)下面给出了以下语句,其中哪些对于C#中的枚举是正确的?
  1. 枚举变量不能具有私有访问说明符。

  2. 枚举变量不能具有受保护的访问说明符。

  3. 枚举变量不能具有公共访问说明符。

  4. 我们可以在类或名称空间中定义enum变量。

选项:

  1. 只有一个

  2. 只有B

  3. 只有D

  4. A和B

答案与解释

正确答案:3
只有D

关于枚举,只有D语句是正确的。

2) There are following statements are given below, which of them are correct about enumeration in C#?
  1. int is a default underlying data type of enum.

  2. We cannot print elements of enum in the form of string.

  3. Every enum created in C#.Net is derived from Object class.

  4. We need to use an implicit cast to convert enum type to an integral type.

Options:

  1. Only B

  2. Only D

  3. B and D

  4. A and C

Answer & Explanation

Correct answer: 4
A and C

The A and C statements are correct about enum.

2)下面给出了以下语句,其中哪些对于C#中的枚举是正确的?
  1. int是枚举的默认基础数据类型。

  2. 我们不能以字符串形式打印枚举元素。

  3. 在C#.Net中创建的每个枚举都是从Object类派生的。

  4. 我们需要使用隐式转换将枚举类型转换为整数类型。

选项:

  1. 只有B

  2. 只有D

  3. B和D

  4. A和C

答案与解释

正确答案:4
A和C

A和C语句关于枚举是正确的。

3) Can we declare an enum inside the class?
  1. Yes

  2. No

Answer & Explanation

Correct answer: 1
Yes

Yes, we can declare an enum inside the class.

3)我们可以在类中声明一个枚举吗?
  1. 没有

答案与解释

正确答案:1

是的 ,我们可以在类中声明一个枚举。

4) Is it true, the value of each successive enum is decreased by 1?
  1. Yes

  2. No

Answer & Explanation

Correct answer: 2
No

No, it is not true.

4)是的,每个连续的枚举的值都减1吗?
  1. 没有

答案与解释

正确答案:2
没有

,这是不正确的。

5) Is it true, the value of each successive enum is increased by 1?
  1. Yes

  2. No

Answer & Explanation

Correct answer: 1
Yes

Yes, it is true.

5)是的,每个连续的枚举的值增加1吗?
  1. 没有

答案与解释

正确答案:1

是的 ,这是真的。

翻译自: https://www.includehelp.com/dot-net/csharp-enumeration-aptitude-questions-and-answers-2.aspx

c#枚举数字转枚举

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值