Tìm kiếm:
TRANG NHÀ
Giới thiệu VNEDU.ORG
Điều khoản và bản quyền
Liên lạc VNEDU
TRẮC NGHIỆM TRỰC TUYẾN
---Công Cụ:---
Soạn Biểu thức
Bảng màu HTML
Ký hiệu đặc biệt 01
Ký hiệu đặc biệt 02
Ký hiệu đặc biệt 03
Ký hiệu đặc biệt 04
Ký hiệu đặc biệt 05
Ký hiệu đặc biệt 06
Ký hiệu đặc biệt 07
Ký hiệu đặc biệt [Toán]
Tin Học   ||  Căn Bản    Văn Phòng    Hệ Thống - Mạng    Phần Mềm Ứng Dụng    Kỹ thuật số    Lập trình    SQL  

Trắc Nghiệm C# - Bài 51
Ngày làm bài: Hôm nay lúc 03:45:34 (Server time)
Số câu hỏi: 10.   Tổng điểm: 10
Yêu cầu hoàn thành: 60 phút.
Thời gian còn lại: 
Cỡ chữ câu hỏi:  Cỡ chữ đáp án:


1-
Which of the following statements are correct about an enum used inC#.NET?
  1. To use the keyword enum, we should either use [enum] or System.Enum.
  2. enum is a keyword.
  3. Enum is class declared in System.Type namespace.
  4. Enum is a class declared in the current project's root namespace.
  5. Enum is a class declared in System namespace.
  A - 
1, 3
  B - 
2, 4
  C - 
2, 5
  D - 
3, 4
2-
Which of the following will be the correct output for the C#.NET code snippet given below?
enum color : int
{
    red = -3,
    green,
    blue 
}
Console.Write( (int) color.red + ", "); 
Console.Write( (int) color.green + ", "); 
Console.Write( (int) color.blue );

  A - 
-3, -2, -1
  B - 
-3, 0, 1
  C - 
0, 1, 2
  D - 
red, green, blue
3-
Which of the following statements is correct about the C#.NET code snippet given below?
enum per
{
    married, 
    unmarried, 
    divorced, 
    spinster
}
per.married = 10; 
Console.WriteLine(per.unmarried);

  A - 
The program will output a value 11.
  B - 
The program will output a value 1.
  C - 
The program will output a value 2.
  D - 
The program will report an error since an enum element cannot be assigned a value outside the enum declaration.
4-
Which of the following is the correct output for the C#.NET code snippet given below?
enum color: int
{ 
    red,
    green, 
    blue = 5, 
    cyan,
    magenta = 10, 
    yellow 
}
Console.Write( (int) color.green + ", " ); 
Console.Write( (int) color.yellow );

  A - 
2, 11
  B - 
1, 11
  C - 
2, 6
  D - 
1, 5
5-
Which of the following CANNOT be used as an underlying datatype for an enum in C#.NET?
  A - 
byte
  B - 
short
  C - 
float
  D - 
int
6-
Which of the following statements are correct about enum used in C#.NET?
  1. Every enum is derived from an Object class.
  2. Every enum is a value type.
  3. There does not exist a way to print an element of an enum as a string.
  4. Every enum is a reference type.
  5. The default underlying datatype of an enum is int.
  A - 
1, 2, 5
  B - 
1, 4
  C - 
3, 5
  D - 
2, 3, 4
7-
Which of the following statements is correct about the C#.NET code snippet given below?
enum color : byte
{
    red = 500,
    green = 1000,
    blue = 1500
}

  A - 
Byte values cannot be assigned to enum elements.
  B - 
Enum elements should always take successive values.
  C - 
Since 500, 1000, 1500 exceed the valid range of byte compiler will report an error.
  D - 
Enum must always be of int type.
8-
Which of the following is the correct output for the C#.NET code snippet given below?
enum color
{
    red,
    green,
    blue 
}
color c = color.red;
Type t;
t = c.GetType();
string[ ]str;
str = Enum.GetNames(t);
Console.WriteLine(str[ 0 ]);

  A - 
red
  B - 
0
  C - 
1
  D - 
-1
9-
Which of the following statements are correct about the C#.NET code snippet given below?
namespace IndiabixConsoleApplication
( 
class Sample
{ 
    private enum color : int
    { 
        red, 
        green, 
        blue
    }
    public void fun()
    {
        Console.WriteLine(color.red); 
    }
}
class Program
{ 
    static void Main(string[ ] args)
    { 
        // Use enum color here
    } 
} 
}
  1. To define a variable of type enum color in Main(), we should use the statement, color c; .
  2. enum color being private it cannot be used in Main().
  3. We must declare enum color as public to be able to use it outside the class Sample.
  4. To define a variable of type enum color in Main(), we should use the statement, Sample.color c; .
  5. We must declare private enum color outside the class to be able to use it in Main().
  A - 
1, 2, 3
  B - 
2, 3, 4
  C - 
3, 4
  D - 
4, 5
10-
Which of the following statements is correct about an enum used in C#.NET?
  A - 
Enum is a reference type.
  B - 
Enum is a value type.
  C - 
Whether it a value type or a reference type depends upon size.
  D - 
Whether it a value type or a reference type depends upon a Project Setting made in Visual Stiiclio.NET.
 
[Người đăng: Thành Lãm - ST]
Ghé thăm Kênh của Vị Sư "hai lần chết đi sống lại"
Tu Si Chau Soc Thon

https://www.youtube.com/channel/UCoyC9WTTVR-M3qpTKKEXGnQ

Chau Soc Thon Official Channel


Phong Bảo Official
Phong Bao Official
Xem Nhiều nhất
Trắc Nghiệm Pascal - Bài 20
Trắc Nghiệm ASP.NET - Bài 12
Trắc Nghiệm Ngôn Ngữ Lập Trình C - Bài 16
Trắc Nghiệm ASP.NET - Bài 01
Trắc Nghiệm ASP.NET - Bài 03
Trắc nghiệm C++ - Bài 18
Trắc Nghiệm C# - Bài 53
Trắc Nghiệm ASP.NET - Bài 02
Trắc Nghiệm C# - Bài 42
Trắc Nghiệm Java - Bài 01
Trắc Nghiệm ASP.NET - Bài 04
Trắc Nghiệm Pascal - Bài 22
Trắc Nghiệm ASP.NET - Bài 13
Trắc Nghiệm ASP.NET - Bài 09
Trắc Nghiệm ASP.NET - Bài 08
Trắc nghiệm PHP - Bài 01
Trắc Nghiệm ASP.NET - Bài 06
Trắc Nghiệm ASP.NET - Bài 11
Trắc Nghiệm ASP.NET - Bài 05
Trắc Nghiệm ASP.NET - Bài 23
Đề Xuất
Trắc Nghiệm ASP.NET (English) - Bài 15
Trắc nghiệm XML - Bài 29
Trắc Nghiệm Java - Bài 23
Trắc Nghiệm Thiết Kế Web (English) - Bài 46
Trắc Nghiệm Thiết Kế Web (English) - Bài 44
Trắc Nghiệm Pascal - Bài 15
Trắc Nghiệm Thiết Kế Web Và Flash - Bài 15
Trắc nghiệm XML - Bài 14
Trắc nghiệm Linux ( English ) - Bài 21
Trắc Nghiệm Thiết Kế Web (English) - Bài 41
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 26
Trắc Nghiệm Java - Bài 51
Trắc Nghiệm ASP.NET - Bài 14
Trắc Nghiệm Java - Bài 37
Trắc Nghiệm Java - Bài 09
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 15
Trắc Nghiệm Java - Bài 40
Trắc Nghiệm Visual Basic - Bài 34
Trắc Nghiệm ASP.NET - Bài 11
Trắc nghiệm Ngôn Ngữ Lập Trình C++ - Bài 13
Phát triển hệ thống: TRƯƠNG HỮU ĐỨC - Phiên bản 3.0 - © Copyright 2013 - 2024 - VNEDU.ORG

free counters