Logo 
Search:

cpp Interview FAQs

Submit Interview FAQ
No Records Found!!!
Go Ahead and Post your Interview FAQ
Home » Interview FAQs » cppRSS Feeds
C#
Comments: 0

Does C# do array bounds checking?

Yes. An IndexOutOfRange exception is used to signal an error.
Posted By:Sonya Flores      Posted On: Sep 20

C#
Comments: 0

How do I do a case-insensitive string comparison?

Use the string.Compare method. Its third parameter specifies case sensitivity.

"fred" == "Fred" // false
string.Compare( "fred", "Fred", StringComparison.CurrentCultureIgnoreCase ) == 0 // true
For more control over the comparison,...
Posted By:Felicia Hill      Posted On: Sep 17

C#
Comments: 0

Does C# support a variable number of arguments?

Yes, using the params keyword. The arguments are specified as a list of arguments of a specific type, e.g. int. For ultimate flexibility, the type can be object. The standard example of a method which uses this approach is System.Console.WriteLine().
Posted By:Corinne Rogers      Posted On: Sep 02

C#
Comments: 0

How can I process command-line arguments?

Like this:

using System;

class CApp
{
public static void Main( string[] args )
{
Console.WriteLine( "You passed the following arguments:" );
foreach( string arg in args )
...
Posted By:Agatha Miller      Posted On: Sep 24

C#
Comments: 0

Does C# have a 'throws' clause?

No, unlike Java, C# does not require (or even allow) the developer to specify the exceptions that a method can throw.
Posted By:Laurel Collins      Posted On: Nov 28

C#
Comments: 0

How can I check the type of an object at runtime?

You can use the is keyword. For example:

using System;

class CApp
{
public static void Main()
{
string s = "fred";
long i = 10;

Console.WriteLine( "{0} is {1}an integer...
Posted By:Orville Rodriguez      Posted On: Feb 06

C#
Comments: 0

Does C# do array bounds checking?

Yes. An IndexOutOfRange exception is used to signal an error.
Posted By:Sonya Flores      Posted On: Sep 20

C#
Comments: 0

How do I do a case-insensitive string comparison?

Use the string.Compare method. Its third parameter specifies case sensitivity.

"fred" == "Fred" // false
string.Compare( "fred", "Fred", StringComparison.CurrentCultureIgnoreCase ) == 0 // true
For more control over the comparison,...
Posted By:Felicia Hill      Posted On: Sep 17

C#
Comments: 0

Does C# support a variable number of arguments?

Yes, using the params keyword. The arguments are specified as a list of arguments of a specific type, e.g. int. For ultimate flexibility, the type can be object. The standard example of a method which uses this approach is System.Console.WriteLine().
Posted By:Corinne Rogers      Posted On: Sep 02

C#
Comments: 0

How can I process command-line arguments?

Like this:

using System;

class CApp
{
public static void Main( string[] args )
{
Console.WriteLine( "You passed the following arguments:" );
foreach( string arg in args )
...
Posted By:Agatha Miller      Posted On: Sep 24

C#
Comments: 0

Does C# have a 'throws' clause?

No, unlike Java, C# does not require (or even allow) the developer to specify the exceptions that a method can throw.
Posted By:Laurel Collins      Posted On: Nov 28

C#
Comments: 0

How can I check the type of an object at runtime?

You can use the is keyword. For example:

using System;

class CApp
{
public static void Main()
{
string s = "fred";
long i = 10;

Console.WriteLine( "{0} is {1}an integer...
Posted By:Orville Rodriguez      Posted On: Feb 06

  39  40  41  42  43  44  45  46  47  48  49