General C# Questions

By
1.) What is a Class?
A class is a user-defined data type.It is like a template.

2.) What is the importance of the Main Method in C# Program?
Every C# program start executing from the main method .We can not run any C# program without Main Method(),so Main Method is more important for executing any C# program.

3.) What are the types of comment styles in c#                                                             
  • Single Line comment (/*......*/)
  • Multiline comments (// .......)
  • More Details...
4.) What is an alias?                                                                                                              
An alias is a name ,which we can use instead of the Real Name.
Ex.
using S= System.console; //S is alias for System.Console class
class example
{
public static void Main()
{
S.WriteLine ("Hello student");
}
}
More Details...
5.) What are different between Writ() and WriteLine() Method in C#?                   
 Write():-It is used to print the value in same line.
WriteLine():-It is used to print the value in a New Line.

6.) Where can we use 'using' Directive in C#?                                                                
We can use 'using' Directive only with Namespace not Class.
Ex.
using System;                                             Valid
using System.Console;                            invalid
More Details...

7.) What are command Line arguments?                                                                        
 Command Line arguments are parameters supplied to the Main Method at the time of invoking it for execution.

8.) Why we use ReadLine() Method in C#?                                                                    
ReadLine() Method is used to Read the value Line by Line.

9.) What are the reason for Compile Time Error in C# program?                           
  • Syntax Error
  • Logic Error
10.) Can we use multiple Main Method in C#?                                                           
Yes,We can use Multiple main method in C# program.

0 comments:

Post a Comment

Powered by Blogger.