C# Interview Questions on Data Types

What are the 3 types of comments in C#?
1. Single Line Comments. You define single line comments with // as shown below.
//This is an example for single line comment
2. Multi line comments. You define multi line comments with /* */ as shown below.
/*This is an example for
Multi Line comments*/
3. XML Comments. You define XML comments with /// as shown below.
///This is an example for defining XML comments.

Is C# a strongly-typed language?
Yes



What are the 2 broad classifications of data types available in C#?
1.
Built in data types.
2. User defined data types.

Give some examples for built in datatypes in C#?
1.
int
2. float
3. bool

How do you create user defined data types in C#?
You use the struct, class, interface, and enum constructs to create your own custom types. The .NET Framework class library itself is a collection of custom types provided by Microsoft that you can use in your own applications.


4 comments:

  1. Hi venkat,

    i got one doubt. "What are the 2 broad classifications of data types available in C#?" Isnt it value types and reference types. if i am wrong please let me know.

    Thanks
    Simi Sreedharan

    ReplyDelete
  2. simi u r right.ref type also cald user defnd type

    ReplyDelete
    Replies
    1. no, Struct is a user defined type but is a value type

      Delete
  3. "Value type and Ref Type" are the ways these data types (BildIn, UserDefined) can be used.

    ReplyDelete

If you are aware of any other C# questions asked in an interview, please post them below. If you find anything missing or wrong, please feel free to correct by submitting the form below.

 
Disclaimer - Terms of use - Contact Us