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 13 of 14

Explore more Topics under C# programming

Q121.
Select the relevant output for the following set of code:
static void Main(string[] args)
 {
     int a = 4;
     int b = 5;
     int c = 6;
     int d = 8;
     if (((a * b / c) + d) >= ((b * c + d ) / a))
     {
         Console.WriteLine("Line 1 - a is greater to b");
         Console.WriteLine((a * b / c) + d);
     }
     else
     {
         Console.WriteLine("Line 1 - a is not greater to b");
         Console.WriteLine((b * c + d )/ a);
     }
 }
Discuss
Answer: (a). โ€œLine 1 โ€“ a is greater to bโ€
11
Q122.
Check for given code whether the given relation operator works according to the if condition or not.
static void Main(string[] args)
 {
     int a = 10;
     int b = 5;
     int c = 12; 
     int e = 8;
     int d;
     d = Convert.ToInt32((a * (c - b) / e + (b + c)) <= (e * (c + a) / (b + c) + a));
     Console.WriteLine(d);
     if (d == 1)
     {
         Console.WriteLine("C# is great language!");
         Console.WriteLine((a * (c - b) / e + (b + c)));
     }
     else
     {
         Console.WriteLine("harsh is not great language!");
         Console.WriteLine((e * (c + a) / (b + c) + a));
     }
 }
Discuss
Answer: (d).0
C# is not great!
20
Q123.
Which of the following is/are not Relational operators in C#.NET ?
Discuss
Answer: (b).<>=
Q124.
The relevant output for the following set of code is :
int n = 2;
    int p = 4;
    int q = 5;
    int w = 3;
    if ( !((p * q) /n <= (q * w) + n/p ))
    {
        Console.WriteLine( ++p + w++ + " " + ++n);
        Console.WriteLine("b");
    }
    else
    {
        Console.WriteLine(--p + q-- + " " + --n);
        Console.WriteLine("a");
    }
Discuss
Answer: (b).8 1
a
Q125.
Select the relevant output for the set of code :

m = 5;
int y;
1. y = m++;
2. y = ++m;
Discuss
Answer: (c).y = 5, m = 6; y = 7, m = 7
Q126.
Predict the output for the follwing set of code :
static void Main(string[] args)
  {
      int a = 3, b = 5, c = 1;
      int z = ++b;
      int y = ++c;
      b = Convert.ToInt32((Convert.ToBoolean(z)) && (Convert.ToBoolean(y)) || Convert.ToBoolean(Convert.ToInt32(!(++a == b))));
      a = Convert.ToInt32(Convert.ToBoolean(c) || Convert.ToBoolean(a--));
      Console.WriteLine(++a);
      Console.WriteLine(++b);
      Console.WriteLine(c);
  }
Discuss
Answer: (c).2 ,2 ,2
Q127.
Select the output for the relevant code set :
static void Main(string[] args)
 {
     int a = 4, b = 5, c = 7, u = 9;
     int h;
     h = (Convert.ToInt32(u < b)) + (a + b--) + 2;
     Console.WriteLine(h);
     Console.WriteLine(b);
     Console.WriteLine(u < b);
 }
Discuss
Answer: (b).11, 4, False
Q128.
Select the suitable output for the following set of code :
static void Main(string[] args)
 {
     int m = 10, n = 5, p = 20;
     bool b1 =  m * p / n <= p * n / m ;
     int l = p - 2 * m;
     bool b2 = l == 0;
     int z = Convert.ToInt32(b2);
     int k = Convert.ToInt32(b1);
     Console.WriteLine(k);
     Console.WriteLine(z);
 }
Discuss
Answer: (c).0 1
Q129.
Select the output for the following set of code :
class method1
 {
     public int fun(int m)
     {
         return( m++ % 10);
     }
 }
 class Program
 {
     static void Main(string[] args)
     {
         int a = 23, b = 0, c;
         method1 z = new method1();
         c = z.fun (++b * --a % 2);
         int d = (z.fun (c-- + --a));
         Console.WriteLine(c);
         Console.WriteLine(a++);
         Console.WriteLine(d);
         Console.ReadLine();
     }
 }
Discuss
Answer: (b).-1, 21, 1
Q130.
Select the output for the following set of Code :
static void Main(string[] args)
  {
      int a = 8, b = 6, c = 10;
      int d = a * c * 2 / Convert.ToInt32(Math.Pow ((c - b), 2));
      if (d == (c = Convert.ToInt32(Math.Sqrt (a * a + b * b))) && c == 10)
      {
          Console.WriteLine("figure is hypotenuse");
      }
      else
      {
         Console.WriteLine("figure is square");
      }
  }
Discuss
Answer: (a).Figure is square

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!