Basic and Features of C#.Net Interview Questions(30)
10.What are the types of applications that can be created using C#.Net?
21.What is ReadLine()?
22.What is Clear()?
25.Can we set the specifier of the main() method in C#.Net as private?
26. Can we set different types of parameters and return-types in main() method?
27.What is Command Line Arguments?
28. What is the use of GetCommandLineArgs() method?
29.What is the purpose of System.Environment Class?
30.What is a variable?
1.What
is C#.Net?
A)C#.Net(“#”
pronounced as Sharp) is an elegant and type-safe object-oriented language that
enables developers to build a variety of secure and robust applications that
run on the .Net Framework.
C#.Net is a most powerful
programming language among all other programming languages in .Net Framework
because C#.Net is a combination features of C++,VB 6.0 and Java and additional
features.
2.What
is the Genesis structure of C#.Net?
A) C#
syntax is highly expressive, yet it is also simple and easy to learn. The
curly-brace syntax of C# will be instantly recognizable to anyone familiar with
C, C++ or Java. Developers who know any of these languages are typically able
to begin to work productively in C# within a very short time.
3.List
the Powerful Features of C#.Net?
A)C#
syntax simplifies many of the complexities of C++ and provides powerful
features such as
Ø
Nullable
Value Types
Ø
Enumerations
Ø
Delegates
Ø
Lambda Expressions and
Ø
Direct
memory access,
Some
Features which are not found in Java. C# supports such an advanced features are
Ø
Generic Methods and Types, which provide
increased type safety and performance,
Ø
Iterators,
which enable implementers of collection classes to define custom iteration behaviors
that are simple to use by client code.
Ø
Language-Integrated
Query (LINQ) expressions make the strongly-typed query a first-class language
construct.
4.C#.Net
Belongs which type of language?
A)C#.Net
is a high level programming language.
5.Is
C#.Net Supports OOPS ?
A)Yes
C#.Net supports object oriented programming language features.
6.C#.Net
is a case Sensitive or Not a case Sensitive Programming Langauage?
A)C#.Net
is a Case Sensitive Programming Language.
7.What
are the features of OOPS that supported by C#.Net?
A) As an
object-oriented language, C# supports the concepts of
Ø
Encapsulation
Ø
Inheritance,
and
Ø
Polymorphism.
8.What
are the comments in C#.Net?
A) 1.
Single Line Comments. You define single line comments with // as shown below.
//This
is an example for single line comment
2. Multi
line comments. You define multi line comments with /* */ as shown below.
/*This
is an example for Multi Line comments*/
3. XML
Comments. You define XML comments with /// as shown below.
///This
is an example for defining XML comments.
9.Brief
about .Net Framework Platform
Architecture?
A) C#
programs run on the .NET Framework, an integral component of Windows that
includes a virtual execution system called the common language runtime (CLR)
and a unified set of class libraries. The CLR is the commercial implementation
by Microsoft of the common language infrastructure (CLI), an international
standard that is the basis for creating execution and development environments
in which languages and libraries work together seamlessly.
Source
code written in C# is compiled into an intermediate language (IL) that conforms
to the CLI specification. The IL code and resources, such as bitmaps and
strings, are stored on disk in an executable file called an assembly, typically
with an extension of .exe or .dll. An assembly contains a manifest that
provides information about the assembly's types, version, culture, and security
requirements.
When the
C# program is executed, the assembly is loaded into the CLR, which might take
various actions based on the information in the manifest. Then, if the security
requirements are met, the CLR performs just in time (JIT) compilation to
convert the IL code to native machine instructions. The CLR also provides other
services related to automatic garbage collection, exception handling, and
resource management. Code that is executed by the CLR is sometimes referred to
as "managed code," in contrast to "unmanaged code" which is
compiled into native machine language that targets a specific system. The
following diagram illustrates the compile-time and run-time relationships of C#
source code files, the .NET Framework class libraries, assemblies, and the CLR.
F.G:fr1.png
Language
interoperability is a key feature of the .NET Framework. Because the IL code
produced by the C# compiler conforms to the Common Type Specification (CTS), IL
code generated from C# can interact with code that was generated from the .NET
versions of Visual Basic, Visual C++, or any of more than 20 other
CTS-compliant languages. A single assembly may contain multiple modules written
in different .NET languages, and the types can reference each other just as if
they were written in the same language.
In
addition to the run time services, the .NET Framework also includes an extensive
library of over 4000 classes organized into namespaces that provide a wide
variety of useful functionality for everything from file input and output to
string manipulation to XML parsing, to Windows Forms controls. The typical C#
application uses the .NET Framework class library extensively to handle common
"plumbing" chores.
10.What are the types of applications that can be created using C#.Net?
A) You
can use C# to create
Ø
Console
Applications
Ø
Traditional
Windows client applications
Ø
XML
Web services
Ø
Distributed
components
Ø
Client-server
applications
Ø
Database
applications, and much, much more.
Visual
C# provides an advanced code editor, convenient user interface designers,
integrated debugger, and many other tools to make it easier to develop applications
based on version 4.0 of the C# language and version 4.0 of the .NET Framework.
11.What
is Console Applications?
A)
Visual C# Express Edition development environment as you build the simplest
form of C# program, a console application.Console Applications are similar to
c,c++ programs.In Console Applications
we completely work in CUI(Command User Interface)based environment.
Because console applications
perform all their input and output at the command line, they are ideal for quickly
trying out language features and writing command-line utilities.
12.What
is the purpose of “Using” Keyword?
A)”Using”
is a keyword is used to include any namespace on the top of the program.
E.G:Using System.Text;
13.Define
Solution explorer?
A)Solution
explorer is a virtual webdirectory for our program presented at right side of
our visual studio environment.It is similar to windows explorer in windows.Usin
solution explorer we can do following activities.They are:
Ø
Create
Files/Folders
Ø
Delete
Files/Folders
Ø
Rename
Files/Folders
Ø
Copy
Files/Folders
Ø
Move
Files/Folders
With in
the same solution.
14.What
is Console Class?
A)
Console is a Class used to work with Input and output streams. Console class is
present in “System” namespace.
15.What
are the functions with console class?
A)Console
consists of many functions.Some of them
are listed below.They are:
Ø
Beep(int,int)
Ø
Write(“Message”)
Ø
WriteLine(“Message”)
Ø
Read()
Ø
ReadLine()
Ø
ReadKey()
Ø
Clear()
For More
Info Refer:
16.What
is the purpose of Beep(int,int) method?
A)Beep(int,int)
method is used to produce a beep sound it accepts two integer parameters.
17.What
is Write(“Message”)?
A) Write(“Message”) is used to display any
message to the user in the output stream.After displaying the message blinking
cursor remains in the same line.
E.G:Console.Write(“I
Welcomes U”);
O/P:I
Welcomes U_
18.What
is WriteLine(“Message”)?
A) WriteLine(“Message”) is used to display any
message to the user in the output stream.After displaying the message blinking
cursor in the next line.
E.G:Console.Write(“I
Welcomes U”);
O/P:I
Welcomes U
_
19.How
can you relate Console.Write(“Message”) and Console.WriteLine(“Message”)?
A)Console.WriteLine(“Message”)=Console.Write(“Message\n”)
20.What
is Read()?
A)This
method is used to read a single character from the input stream.
21.What is ReadLine()?
A)This
method is used to read a group of characters from the input stream.
22.What is Clear()?
A)This
method is used to clears the contents of screen and is same as clrscr() in c.
23.What
is the difference between Console.Read() and Console.ReadLine()?
A)
SNo
|
Read()
|
ReadLine()
|
1
|
Read Single/Next
Character from the input stream
|
Read group of
Character from the input stream
|
2
|
Reads maximum of
only 1 characters
|
Reads maximum of
255 characters(Depends on OperatingSystem refWindows)
|
3
|
Reads Ascii Value
of the character
|
Reads string
value of the characters
|
4
|
Return type is
integer
|
Return type is
string
|
24.What
is the use of main() function in C#.Net?
A)main()
function is an entry point of an application.Main() method is of public acess
specifier by default including with static type.
25.Can we set the specifier of the main() method in C#.Net as private?
A)Yes.When
the access specifier is set as private for the Main() method then other
assemblies may not invoke this class.Startup scope gets limited to the class in
context itself.
26. Can we set different types of parameters and return-types in main() method?
A)Yes.
The Main() method may easily be played around with by developers by passing
different parameters and setting different return types. See the code below,
that demonstrates different ways the Main() method may be implemented:
C#
Example
(1)public
static void Main(string[] args)<br />
{//NO
return type, the argument is an array of strings
}
(2) public static int Main(string[]
args)<br />
{
//Return
type is int, argument is an array of strings
}
(3)
public static int Main()
{
//Return
type is int, NO arguments
}
(4)
public static void Main()
{
//Return
type is void, NO arguments
}
27.What is Command Line Arguments?
A)
Command Line Arguments are used to pass an array of values to a main() method
with an indexing value
of arrays as a[0],a[1] etc…
of arrays as a[0],a[1] etc…
28. What is the use of GetCommandLineArgs() method?
A) The GetCommandLineArgs() method is used to
access the command line arguments. The return value of this method is an array
of strings. See the code example below:
C#
Example:
public
static int Main(string[] args)
{
string[]
strArgs = System.Environment.GetCommandLineArgs();
Console.WriteLine("Arguments
{0}", strArgs[0]);
}
29.What is the purpose of System.Environment Class?
A. The
class System.Environment is used to retrieve information about the operating
system.
Some of
the static members of this class are as follows:
1)
Environment.OSVersion - Gets the version of the operating system
2)
Environment.GetLogicalDrives() - method that returns the drives
3)
Environment.Version - returns the .NET version running the application
4)
Environment.MachineName - Gets name of the current machine
5)
Environment.Newline - Gets the newline symbol for the environment
6)
Environment.ProcessorCount - returns number of processors on current machine
7)
Environment.SystemDirectory - returns complete path to the System Directory
8)
Environment.UserName - returns name of the entity that invoked the application
30.What is a variable?
A)variable
holds of information as per the user
requirement.Variable can be declared as per the user input value.
Syntax:Datatype variablename
E.G:int a;
0 comments:
Post a Comment