1.

Choose the statement which defines the Nullable type Correctly:a) A special version of a value type that is represented by a structureb) A nullable type can also store the value nullc) Nullable types are objects of System.Nullable, where T must be a non nullable value typed) All of the mentioned Answer: dExplanation: A nullable type is a special version of the value type that is represented by a structure. In addition to the values defined by the underlying type, a nullable type can also store the value null. Thus, a nullable type has the same range and characteristics as its underlying type. It simply adds the ability to represent a value which indicates that a variable of that type is unassigned. Nullable types are objects of System.Nullable, where T must be a nonnullable value type.7. What does the following code depicts? i. System.Nullable count;_x000D_ ii. bool? done;a) Code i declares the objects of nullable of type Nullable defined in the System namespaceb) Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’c) Both Code i declares the objects of nullable of type Nullable defined in the System namespace & Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’d) None of the mentioned Answer: cExplanation: None.8. Which operator is commonly used to find the size of the type of C#?a) size()b) sizeof(type)c) both size() & sizeof(type)d) none of the mentioned Answer: bExplanation: None.9. What will be the output of the following C# code snippet? unsafe struct FixedBankRecord { public fixed byte Name[80]; public double Balance; public long ID; } class UnsafeCode { unsafe static void Main() { Console.WriteLine("Size of FixedBankRecord is " + sizeof(FixedBankRecord)); Console.ReadLine(); } }

A. A special version of a value type that is represented by a structureb) A nullable type can also store the value nullc) Nullable types are objects of System.Nullable, where T must be a non nullable value typed) All of the mentioned Answer: dExplanation: A nullable type is a special version of the value type that is represented by a structure. In addition to the values defined by the underlying type, a nullable type can also store the value null. Thus, a nullable type has the same range and characteristics as its underlying type. It simply adds the ability to represent a value which indicates that a variable of that type is unassigned. Nullable types are objects of System.Nullable<T>, where T must be a nonnullable value type.7. What does the following code depicts? i. System.Nullable count;_x000D_ ii. bool? done;a) Code i declares the objects of nullable of type Nullable<T> defined in the System namespaceb) Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’c) Both Code i declares the objects of nullable of type Nullable<T> defined in the System namespace & Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’d) None of the mentioned Answer: cExplanation: None.8. Which operator is commonly used to find the size of the type of C#?a) size()b) sizeof(type)c) both size() & sizeof(type)d) none of the mentioned Answer: bExplanation: None.9. What will be the output of the following C# code snippet? unsafe struct FixedBankRecord { public fixed byte Name[80]; public double Balance; public long ID; } class UnsafeCode { unsafe static void Main() { Console.WriteLine("Size of FixedBankRecord is " + sizeof(FixedBankRecord)); Console.ReadLine(); } }a) Run time error
B. A nullable type can also store the value nullc) Nullable types are objects of System.Nullable, where T must be a non nullable value typed) All of the mentioned Answer: dExplanation: A nullable type is a special version of the value type that is represented by a structure. In addition to the values defined by the underlying type, a nullable type can also store the value null. Thus, a nullable type has the same range and characteristics as its underlying type. It simply adds the ability to represent a value which indicates that a variable of that type is unassigned. Nullable types are objects of System.Nullable<T>, where T must be a nonnullable value type.7. What does the following code depicts? i. System.Nullable count;_x000D_ ii. bool? done;a) Code i declares the objects of nullable of type Nullable<T> defined in the System namespaceb) Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’c) Both Code i declares the objects of nullable of type Nullable<T> defined in the System namespace & Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’d) None of the mentioned Answer: cExplanation: None.8. Which operator is commonly used to find the size of the type of C#?a) size()b) sizeof(type)c) both size() & sizeof(type)d) none of the mentioned Answer: bExplanation: None.9. What will be the output of the following C# code snippet? unsafe struct FixedBankRecord { public fixed byte Name[80]; public double Balance; public long ID; } class UnsafeCode { unsafe static void Main() { Console.WriteLine("Size of FixedBankRecord is " + sizeof(FixedBankRecord)); Console.ReadLine(); } }a) Run time errorb) 80
C. Nullable types are objects of System.Nullable, where T must be a non nullable value typed) All of the mentioned Answer: dExplanation: A nullable type is a special version of the value type that is represented by a structure. In addition to the values defined by the underlying type, a nullable type can also store the value null. Thus, a nullable type has the same range and characteristics as its underlying type. It simply adds the ability to represent a value which indicates that a variable of that type is unassigned. Nullable types are objects of System.Nullable<T>, where T must be a nonnullable value type.7. What does the following code depicts? i. System.Nullable count;_x000D_ ii. bool? done;a) Code i declares the objects of nullable of type Nullable<T> defined in the System namespaceb) Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’c) Both Code i declares the objects of nullable of type Nullable<T> defined in the System namespace & Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’d) None of the mentioned Answer: cExplanation: None.8. Which operator is commonly used to find the size of the type of C#?a) size()b) sizeof(type)c) both size() & sizeof(type)d) none of the mentioned Answer: bExplanation: None.9. What will be the output of the following C# code snippet? unsafe struct FixedBankRecord { public fixed byte Name[80]; public double Balance; public long ID; } class UnsafeCode { unsafe static void Main() { Console.WriteLine("Size of FixedBankRecord is " + sizeof(FixedBankRecord)); Console.ReadLine(); } }a) Run time errorb) 80c) 96
D. All of the mentioned Answer: dExplanation: A nullable type is a special version of the value type that is represented by a structure. In addition to the values defined by the underlying type, a nullable type can also store the value null. Thus, a nullable type has the same range and characteristics as its underlying type. It simply adds the ability to represent a value which indicates that a variable of that type is unassigned. Nullable types are objects of System.Nullable<T>, where T must be a nonnullable value type.7. What does the following code depicts? i. System.Nullable count;_x000D_ ii. bool? done;a) Code i declares the objects of nullable of type Nullable<T> defined in the System namespaceb) Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’c) Both Code i declares the objects of nullable of type Nullable<T> defined in the System namespace & Code ii declares a nullable type in much shorter and in more commonly used way using ‘?’d) None of the mentioned Answer: cExplanation: None.8. Which operator is commonly used to find the size of the type of C#?a) size()b) sizeof(type)c) both size() & sizeof(typ
E. both size() & sizeof(type)d) none of the mentioned Answer: bExplanation: None.9. What will be the output of the following C# code snippet? unsafe struct FixedBankRecord { public fixed byte Name[80]; public double Balance; public long ID; } class UnsafeCode { unsafe static void Main() { Console.WriteLine("Size of FixedBankRecord is " + sizeof(FixedBankRecord)); Console.ReadLine(); } }a) Run time errorb) 80c) 96d) Compile time error Answer: cExplanation: The purpose of a fixed-size buffer is to allow the creation of a struct in which the array of elements that make up the buffer are contained within the struct. By using a fixed-size buffer, we let the entire array to be contained within the struct. The overall size of FixedBankRecord is 96, which is the sum of its members.Output :
Answer» E. both size() & sizeof(type)d) none of the mentioned Answer: bExplanation: None.9. What will be the output of the following C# code snippet? unsafe struct FixedBankRecord { public fixed byte Name[80]; public double Balance; public long ID; } class UnsafeCode { unsafe static void Main() { Console.WriteLine("Size of FixedBankRecord is " + sizeof(FixedBankRecord)); Console.ReadLine(); } }a) Run time errorb) 80c) 96d) Compile time error Answer: cExplanation: The purpose of a fixed-size buffer is to allow the creation of a struct in which the array of elements that make up the buffer are contained within the struct. By using a fixed-size buffer, we let the entire array to be contained within the struct. The overall size of FixedBankRecord is 96, which is the sum of its members.Output :


Discussion

No Comment Found