Search Placementyogi.com
 

C# Data Types - Basic Objective Questions

1

Which of the following data types are value types?

  1. int, uint, float, doubl
  2. short, ushort
  3. string
  4. long, ulong
  5. byte, sbyte
  6. object
A.

1, 2, 3, 4

B.

1, 2

C.

1, 2, 4, 5

D.

3, 6

E.

1, 2, 3

See Answer & Explanation Lets Discuss
Correct answer is : C
Explanation

No explanation available. Let's Discuss

 
2

Which of the following data type does not store a sign value?

A.

int

B.

float

C.

single

D.

long

E.

byte

See Answer & Explanation Lets Discuss
Correct answer is : E
Explanation

No explanation available. Let's Discuss

 
3

Which of the following statement is true about data types in C#?

  1. Size of byte and sbyte is same.
  2. Size of short and ushort is same.
  3. Size of int and uint is same.
  4. Size of long and ulong is same.
  5. Size of double and Decimal is same.
A.

1, 5

B.

2, 5

C.

3, 4, 5

D.

1, 2, 3, 4

E.

5

See Answer & Explanation Lets Discuss
Correct answer is : D
Explanation

Size of byte and sbyte: 1 byte

Size of short and ushort: 2 bytes

Size of int and uint: 4 bytes

Size of long and long: 8 bytes

Size of double: 8 bytes

Size of Decimal: 16 bytes 

 
4

Which of the following statement is correct regarding the output of C# program given below:

using System;
namespace PlacementYogi
{
    class DataTypes
    {
        static void Main(string[] args)
        {
            int result;
            short var1 = 30;
            short var2 = 300;          
            result = var1 * var2;
            Console.WriteLine(result);
        }
    }
}
A.

An error is reported as widening conversion cannot take place.

B.

During arithmetic operation, if the result exceeds the high or low value of the range, value wraps around till the other side of the range.

C.

An overflow error will be thrown since the result of the multiplication exceeds the range of a Short Integer.

D.

Value 8000 will be printed on console.

E.

None of the above.

See Answer & Explanation Lets Discuss
Correct answer is : D
Explanation

No explanation available. Let's Discuss

 
5

Which of the following statement is correct? (Choose all that apply)

A.

We can assign values of any type to variables of type object.

B.

When a value type is boxed, an entirely new object must be allocated and constructed.

C.

When a variable of a value type is converted to object, it is said to be unboxed.

D.

When a variable of type object is converted to a value type, it is said to be boxed.

E.

Boolean variable cannot be assigned  a value of null.

See Answer & Explanation Lets Discuss
Correct answer is : A,B
Explanation

No explanation available. Let's Discuss

 
 

Banner to LogicGuns.com

Hide Page Information

C# Data Types - Basic Objective Questions and Answers with Explanation

Here you can find C# data types interview questions with answers and explanation.

Why Data Types in C#?

In this section you can learn and practice Data types (Questions with Answers) to improve your skills in order to face the interview, competitive examination and various entrance test (CAT, GATE, GRE, MAT, Bank Exam etc.) with full confidence.

Where can I get C# Data Types Questions and Answers with Explanation?

PlacementYogi provides you lots of fully solved Data Types questions and answers with explanation. Fully solved examples with detailed answer description, explanation are given and it would be easy to understand. All students, fresher can download Data Types quiz questions with answers as PDF files and eBooks.

Where can I get C# Data Types Interview Questions and Answers (objective type, multiple choice)?

Here you can find objective Data Types questions and answers for interview and entrance examination. Multiple choice and true or false type and yes or no type questions are also provided.