C# Essentials Quiz Questions and Answers

The string built using the String class are immutable (unchangeable), whereas, the ones built- using the StringBuilder class are mutable.

Answer :
  • Yes

Given the following for loop statement, what is the value of the count variable once the loop has finished executing? var count = 0; for (int i = 5; i < 12; i++) { count++; }

Answer :
  • 7

Which is the correct way of Declaration of Values to variables ‘a’ and ‘b’?

Answer :
  • int a = 32; int b = 40;

Which is the String method used to compare two strings with each other ?

Answer :
  • Compare()

You are creating a console application by using C#. You need to access the application assembly. Which code segment should you use?

Answer :
  • Assembly.GetExecutingAssembly();

What is enum in C#?

Answer :
  • All of the above

How many types of Properties do we have in C#?

Answer :
  • All of the above

What is Managed Code in C#?

Answer :
  • Both of the above.

What is Boxing in C#?

Answer :
  • Both of the above.

What is the difference between ref and out keywords?

Answer :
  • Both of the above.