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

Q41.
Select error in the given program :
Static Void Main(String[] args)
 {
     const int m = 100;
     int n = 10;
     const int k = n / 5 * 100 * n ;
     Console.WriteLine(m * k);
     Console.ReadLine();
 }
Discuss
Answer: (b).Expression assigned to ‘k’ should be constant in nature
Q42.
Arrange the following datatype in order of increasing magnitude sbyte, short, long, int.
Discuss
Answer: (b).sbyte < short < int < long
Q43.
Which datatype should be more preferred for storing a simple number like 35 to improve execution speed of a program?
Discuss
Answer: (a).sbyte
Q44.
Which Conversion function of ‘Convert.TOInt32()’ and ‘Int32.Parse()’ is efficient?

1) Int32.Parse() is only used for strings and throws argument exception for null string
2) Convert.Int32() used for datatypes and returns directly ‘0’ for null string
Discuss
Answer: (a).2
Q45.
Correct way to assign values to variable ‘c’ when int a=12, float b=3.5,int c;
Discuss
Answer: (c).c = a + convert.ToInt32(b);
Discuss
Answer: (c).int a = 12;
float b = 6.2f;
int c;
c = a / convert.ToInt32(b) + a * convert.ToInt32(b);
Console.WriteLine(c);
Q47.
Does the output remain same or different for both cases?
1)

  char l ='k';
  float b = 19.0f;
  int c;
  c = (l / convert.ToInt32(b));
  Console.Writeline(c);

2)

   char l ='k';
   float b = 19.0f;
   int c;
   c = Convert.ToInt32(l / b);
   console.writeline(c);
Discuss
Answer: (b).No
Q48.
Default Type of number without decimal is ?
Discuss
Answer: (c).Int
Q49.
Correct output for code is?
static void Main(string[] args)
 {
     float a = 10.553f;
     long b = 12L;
     int  c;
     c = Convert.ToInt32(a + b);
     Console.WriteLine(c);
 }
Discuss
Answer: (c).23
Discuss
Answer: (c).float somevariable = (float) 12.502D
Page 5 of 14

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!