adplus-dvertising

Welcome to the Data Types,Variables and Operators MCQs Page

Dive deep into the fascinating world of Data Types,Variables and Operators with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Data Types,Variables and Operators, a crucial aspect of C# Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Data Types,Variables and Operators, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within C# Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Data Types,Variables and Operators. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of C# Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Data Types,Variables and Operators. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Data Types,Variables and Operators MCQs | Page 10 of 14

Explore more Topics under C# Programming

Q91.
Correct Output for the given set of programming code is :
class Program
 {
     static void Main(string[] args)
     {
         int i ;
         for ( i = 0; i < 5; i++)
         {
             int j = 0;
             j += i; 
             Console. WriteLine(j);
         }
         Console. WriteLine(i);
         Console. ReadLine();
     }
 }
Discuss
Answer: (b).0, 1, 2, 3, 4, 5
Q92.
Correct Output for the given set of programming code is :
static void Main(string[] args)
  {
      int i ;
      for (i = 0; i < 5; i++)
      {
          int j = 0;
          j += i; 
          Console. WriteLine(j);
      }
      Console. WriteLine( i * j);
      Console. ReadLine();
  }
Discuss
Answer: (c).Compile time error
Q93.
Scope of variable is related to definition of variable as:

a. Region of code within which variable value is valid and hence can be accessed.
b. No, relation with region where variable is declared its value is valid in entire scope.
Discuss
Answer: (a).a
Q94.
Select the correct output for the following programming code
class Program
 {
     public static void Main(string[] args)
     {
         int i = 100;
         for (a = 0; a < 5; a++)
         {
             int i = 200;
             Console. WriteLine(a * i);
         }
         Console. ReadLine();
     }
 }
Discuss
Answer: (c).Compile time error
Q95.
Syntax for declaration and initialization of data variable is :
Discuss
Answer: (a).<data type><var_name> = <Value>;
Q96.
Select the correct output for the following set of code :
class Program
 {
     public static void Main(string[] args)
     {
         int i, j;
         i = (j = 5) + 10;
         Console. WriteLine(i);
         Console. WriteLine(j);
         Console. ReadLine();
     }
 }
Discuss
Answer: (c).15, 5
Discuss
Answer: (a).โ€˜Boxingโ€™ is the process of converting a value type to the reference type and โ€˜Unboxingโ€™ is the process of converting reference to value type
Q98.
Select differences between reference type and value type :

1. Memory allocated to โ€˜Value typeโ€™ is from heap and reference type is from โ€˜System. ValueTypeโ€™
2. Memory allocated to โ€˜Value typeโ€™ is from โ€˜System. ValueTypeโ€™ and reference type is from โ€˜Heapโ€™
3. Structures, enumerated types derived from โ€˜System. ValueTypeโ€™ are created on stack, hence known as ValueType and all โ€˜classesโ€™ are reference type because values are stored on heap
Discuss
Answer: (b).2, 3
Q99.
Correct output for the following set of code is :
public static void Main(string[] args)
    {
        int i = 123;
        object o = i;
        i = 456;
        System. Console. WriteLine("The value-type value = {0}", i);
        System. Console. WriteLine("The object-type value = {0}", o);
        Console. ReadLine();
    }
Discuss
Answer: (b).456, 123
Q100.
Correct output for the following set of code is :
public static void Main(string[] args)
  {
      int i = 546;
      object o = i;
      int n =(int) o;
      o = 70;
      System. Console. WriteLine("The value-type value = {0}", n);
      System. Console. WriteLine("The object-type value = {0}", o);
      Console. ReadLine();
  }
Discuss
Answer: (c).546, 70

Suggested Topics

Are you eager to expand your knowledge beyond C# Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!