C# Data Types Aptitude Questions and Answers | Set 1

This section contains aptitude questions and answers on C# data types (set 1).

1) "int" is an alias of _________.
  1. System.Int16
  2. System.Int32
  3. System.Int64
  4. System.Byte

2) "char" is an alias of _________.
  1. System.Char
  2. System.String
  3. System.Text
  4. Character

3) A "byte" type variable stores the value between the range of ________.
  1. -128 to +127
  2. 0 to 127
  3. 0 to 255
  4. 0 to 256

4) A "sbyte" type variable stores the value between the range of ________.
  1. -128 to +127
  2. 0 to 127
  3. 0 to 255
  4. 0 to 256

5) What will be the output of the following program?
static void Main(string[] args)
{
	byte a = 10;
	byte b = 20;
	byte sum = a + b;
	Console.WriteLine(sum);
}
  1. 30
  2. Compilation error
  3. Run time error
  4. None

6) What will be the output of the following program?
static void Main(string[] args)
{
	sbyte a = -10;
	sbyte b = 20;
	sbyte sum = a + b;
	Console.WriteLine(sum);
}
  1. 10
  2. Compilation error
  3. Run time error
  4. None

7) Which is the correct range int in C#?
  1. 0 to 255
  2. -32,768 to 32,767
  3. -2,147,483,648 to 2,147,483,647
  4. 0 to 4,294,967,295

8) Which is the correct range uint in C#?
  1. 0 to 255
  2. -32,768 to 32,767
  3. -2,147,483,648 to 2,147,483,647
  4. 0 to 4,294,967,295

9) Which is the correct range long in C#?
  1. -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
  2. 0 to 18,446,744,073,709,551,615
  3. -2,147,483,648 to 2,147,483,647
  4. 0 to 4,294,967,295

10) Which is the correct range ulong in C#?
  1. -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
  2. 0 to 18,446,744,073,709,551,615
  3. -2,147,483,648 to 2,147,483,647
  4. 0 to 4,294,967,295

11) C# is developed by?
  1. Anders Hejlsberg
  2. Dennis richie
  3. Ken Thompson
  4. Bjarne Stroustrup

12) How many bytes of data can be store in a char variable?
  1. 1 byte
  2. 2 bytes
  3. 4 bytes
  4. 8 bytes

13) What is the equivalent .NET type of float type in C#?
  1. System.Single
  2. System.Double
  3. System.Decimal
  4. System.float

14) There are following options are given below, which of them is not a valid .NET Type?
  1. System.Single
  2. System.Double
  3. System.Decimal
  4. System.float

15) What is the equivalent .NET type of double type in C#?
  1. System.Single
  2. System.Double
  3. System.Decimal
  4. System.float

16) What is the equivalent .NET type of decimal type in C#?
  1. System.Single
  2. System.Double
  3. System.Decimal
  4. System.float

17) What is the correct size of float type variable in C#?
  1. 32 bytes
  2. 16 bytes
  3. 4 bytes
  4. 8 bytes

18) What is the correct size of double type variable in C#?
  1. 32 bytes
  2. 16 bytes
  3. 4 bytes
  4. 8 bytes

19) What is the correct size of decimal type variable in C#?
  1. 32 bytes
  2. 16 bytes
  3. 4 bytes
  4. 8 bytes

20) By default a real number is?
  1. Float
  2. Double
  3. Decimal
  4. Single

21) To use real number for float type, what character we need to use as a suffix in C#?
  1. 'f' or 'F'
  2. 'M' or 'm'
  3. 'D' or 'd'
  4. 'K' or 'k'

22) To use real number for decimal type, what character we need to use as a suffix in C#?
  1. 'f' or 'F'
  2. 'M' or 'm'
  3. 'D' or 'd'
  4. 'K' or 'k'

23) What is the precision of a float type number in C#?
  1. Up to 15 digits
  2. Up to 7 digits
  3. Up to 28 digits
  4. Up to 20 digits

24) What is the precision of a double type number in C#?
  1. Up to 15 digits
  2. Up to 7 digits
  3. Up to 28 digits
  4. Up to 20 digits

25) What is the precision of a decimal type number in C#?
  1. Up to 15 digits
  2. Up to 7 digits
  3. Up to 28 digits
  4. Up to 20 digits





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.