This section contains aptitude questions and answers on C# data types (set 2).
1) There are following options are given below, which of them does NOT store negative value?
- Long
- Short
- Byte
- Single
- Double
Correct answer: 3
Byte
Byte type does not store negative value.
2) There are following options are given below, which of them is NOT Value Type?
- Integer type
- User define structure
- Enumeration
- Arrays
Correct answer: 4
Arrays
Arrays, Interface, user define classes and delegates are reference types whereas built-in types (int, float, char, etc), structure and enumerations are value type.
3) There are following options are given below, which of them is NOT an Integer Type?
- int
- char
- short
- long
Correct answer: 2
char
In C#, char stores Unicode characters, where int, short, long and byte are store integer values.
4) There are following options are given below, which of them is NOT Reference Type?
- Built in Types (int, short, long, char, etc)
- Arrays
- Delegates
- Interfaces
Correct answer: 1
Built in Types (int, short, long, char, etc)
Arrays, Interface, user define classes and delegates are reference types whereas built-in types (int, float, char, etc), structure and enumerations are value type.
5) How many bits of data can be store in an int variable?
- 32 bits
- 16 bits
- 8 bits
- 64 bits
Correct answer: 1
32 bits
If we declare a variable of int type, it occupies 32 bits space in memory.
6) Which statement is correct about integer type variables?
- Integer type variables cannot store floating point values.
- Integer type variables can store characters.
- Integer type variables are reference types.
- Integer type variables are not value types.
Correct answer: 1
Integer type variables cannot store floating point values.
An integer is a built-in value type, it can store only integer values.
7) Which is the correct size of byte types?
- 16 bits
- 8 bits
- 32 bits
- 64 bits
Correct answer: 2
8 bits
If we declare a variable of byte type, it occupies 8 bits space in memory.
8) Which is the correct size of short types?
- 16 bits
- 8 bits
- 32 bits
- 64 bits
Correct answer: 1
16 bits
If we declare a variable of short type, it occupies 16 bits space in memory.
9) Which is the correct size of sbyte types?
- 16 bits
- 8 bits
- 32 bits
- 64 bits
Correct answer: 2
8 bits
If we declare a variable of sbyte type, it occupies 8 bits space in memory.
10) Which is the correct size of long types?
- 16 bits
- 8 bits
- 32 bits
- 64 bits
Correct answer: 4
64 bits
If we declare a variable of long type, it occupies 64 bits space in memory.
11) Which is the correct size of ulong types?
- 16 bits
- 8 bits
- 32 bits
- 64 bits
Correct answer: 4
64 bits
If we declare a variable of ulong type, it occupies 64 bits space in memory.
12) Which is the correct size of ushort types?
- 16 bits
- 8 bits
- 32 bits
- 64 bits
Correct answer: 1
16 bits
If we declare a variable of ushort type, it occupies 16 bits space in memory.
13) How many bytes of data can be store in a uint variable?
- 1 byte
- 2 byte
- 4 byte
- 8 byte
Correct answer: 3
4 byte
If we declare a variable of uint type, it occupies 4 bytes space in memory.
14) Which is correct equivalent .NET type of sbyte?
- System.Byte
- System.SByte
- System.SignByte
- System.SuperByte
Correct answer: 2
System.SByte
System.SByte is the correct equivalent type of sbyte in .NET framework.
15) Which is correct equivalent .NET type of byte?
- System.Byte
- System.SByte
- System.SignByte
- System.SuperByte
Correct answer: 1
System.Byte
System.Byte is the correct equivalent type of byte in .NET framework.
16) Which is correct equivalent .NET type of short?
- System.Int16
- System.UInt16
- System.Int32
- System.Int64
Correct answer: 1
System.Int16
System.Int16 is the correct equivalent type of short in .NET framework.
17) Which is correct equivalent .NET type of ushort?
- System.Int16
- System.UInt16
- System.Int32
- System.Int64
Correct answer: 2
System.UInt16
System.UInt16 is the correct equivalent type of short in .NET framework.
18) Which is correct equivalent .NET type of int?
- System.Int16
- System.UInt16
- System.Int32
- System.Int64
Correct answer: 3
System.Int32
System.Int32 is the correct equivalent type of int in .NET framework.
19) Which is correct equivalent .NET type of uint?
- System.Int16
- System.UInt16
- System.Int32
- System.UInt32
Correct answer: 4
System.UInt32
System.UInt32 is the correct equivalent type of uint in .NET framework.
20) Which is correct equivalent .NET type of long?
- System.Int16
- System.Int64
- System.Int32
- System.UInt64
Correct answer: 4
System.UInt64
System.Int64 is the correct equivalent type of long in .NET framework.
21) Which is correct equivalent .NET type of ulong?
- System.Int16
- System.Int64
- System.Int32
- System.UInt64
Correct answer: 4
System.UInt64
System.UInt64 is the correct equivalent type of ulong in .NET framework.
22) Which is the correct range sbyte in C#?
- 0 to 255
- -128 to 127
- -120 to 119
- -127 to 126
Correct answer: 2
-128 to 127
The correct range of sbyte is from -128 to 127.
23) Which is the correct range byte in C#?
- 0 to 255
- -128 to 127
- -120 to 119
- -127 to 126
Correct answer: 1
0 to 255
The correct range of byte is from 0 to 255.
24) Which is the correct range short in C#?
- 0 to 255
- -32,768 to 32,767
- 0 to 65,535
- -127 to 126
Correct answer: 2
-32,768 to 32,767
The correct range of short is from -32,768 to 32,767.
25) Which is the correct range ushort in C#?
- 0 to 255
- -32,768 to 32,767
- 0 to 65,535
- -127 to 126
Correct answer: 3
0 to 65,535
The correct range of ushort is from 0 to 65,535.