Вы находитесь на странице: 1из 12

Day 1

1. What is .NET?
a. A technology from Microsoft or platform based on .NET Framework
2. What is DLL Hell?
3. Why .NET?
a. Multiple language support
b. Cross-Language Integration or Interoperability among the
languages
c. All languages get compiled into a common format called as
Intermediate Language (IL)
d. Single software required to run applications written any .NET based
language called as CLR (Common Language Runtime)
e. Single IDE for any kind of development
f. Different kind of application development using same language
i. Console Application
ii. Web Application
iii. Mobile Applications
iv. Web Service
v. Class Library
4. What is Framework?
a. A software which provides a set of libraries, configuration files and
some tools
b. .NET Framework, Mono Framework
c. Struts, Hibernate, Spring etc.
5. What is .NET Framework?
a. A framework from Microsoft which runs only on MS Windows and
supports all languages under .NET
6. What is Mono Framework?
a. Implementation of .NET Framework specification for any operating
system using C# as language as open source by Novell
7. What are different versions of .NET Framework?
a. 1.0
b. 1.1
c. 2.0
d. 3.0
e. 3.5
f. 4.0
8. What is Visual Studio?
a. An IDE from Microsoft
b. Visual Studio 2001
c. Visual Studio 2003
d. Visual Studio 2005
e. Visual Studio 2008
f. Visual Studio 2010
9. What are different versions of Visual Studio?
a. Express Edition
b. Standard
c. Professional

d. Team Suite
10.What is IL or MSIL or CIL?
a. There is one point to be made regarding the abbreviation IL. During
the development of .NET, the official term for IL was Microsoft
intermediate language (MSIL). However with the final release of .NET,
the term was changed to Common Intermediate Language (CIL). Thus,
as you read the .NET literature, understand that IL, MSIL, and CIL are
all describing the same exact entity. In keeping with the current
terminology, I will use the abbreviation CIL throughout this text.
11.What is CLR?
a. The runtime layer is properly referred to as the Common Language
Runtime, or CLR. The primary role of the CLR is to locate, load, and
manage .NET types on your behalf. The CLR also takes care of a
number of low-level details such as memory management; creating
application domains, threads, and object context boundaries; and
performing various security checks

Figure 1: How CLR Works

12.What is CTS?
a. Another building block of the .NET platform is the Common Type
System, or CTS. The CTS specification fully describes all possible data
types and programming constructs supported by the runtime, specifies
how these entities can interact with each other, and details how they
are represented in the .NET metadata format.
i. System.Int32 C# (int), VB (Integer)
13.What is CLS?
a. Understand that a given .NET-aware language might not support each
and every feature defined by the CTS. The Common Language
Specification (CLS) is a related specification that defines a subset of

common types and programming constructs that all .NET programming


languages can agree on. Thus, if you build .NET types that only expose
CLS-compliant features, you can rest assured that all .NET-aware
languages can consume them. Conversely, if you make use of a data
type or programming construct that is outside of the bounds of the
CLS, you cannot guarantee that every .NET programming language can
interact with your .NET code library.
14.How to ensure the CLS Compliancy?
a. Using the setting in AssemblyInfo.cs file or using attribute
[CLSComplient]
i. // Tell the C# compiler to check for CLS compliance.
ii. [assembly: System.CLSCompliant(true)]
15.What is BCL or FCL?
a. Base Class Library or Framework Class Library
b. In addition to the CLR and CTS/CLS specifications, the .NET platform
provides a base class library that is available to all .NET programming
languages. Not only does this base class library encapsulate various
primitives such as threads, file input/output (I/O), graphical rendering,
and interaction with various external hardware devices, but it also
provides support for a number of services required by most real-world
applications.
16.How all things get linked to each other?

Figure 2: The CLR, CTS, CLS, and base class library relationship

17.What is ILDASM?
a. Intermediate Language De-Assembler
b. It show the CIL Code, Metadata and Manifest Information inside an
assembly
c. Using Ctrl+M to show the Meta Data
18.Can we see the actual code within an assembly?
a. Yes, using some tools like .NET Reflector
b. http://reflector.red-gate.com/download.aspx
19.What is Interoperability or Cross Language Integration?

20.What is the URL from where we can know about the languages under .NET?
a. http://www.dotnetlanguages.net
21.Why C# is most popular language?
a. Due to the fact that C# is a hybrid of numerous languages, the result is
a product that is as syntactically cleanif not cleanerthan Java, is
about as simple as VB6, and provides just about as much power and
flexibility as C++ (without the associated ugly bits). Here is a partial
list of core C# features that are found in all versions of the language:
i. No pointers required! C# programs typically have no need for
direct pointer manipulation
ii. Automatic memory management through garbage collection.
Given this, C# does not support a delete keyword.
iii. Formal syntactic constructs for classes, interfaces, structures,
enumerations, and delegates.
iv. The C++-like ability to overload operators for a custom type,
without the complexity
v. Support for attribute-based programming. This brand of
development allows you to annotate types and their members to
further qualify their behavior.
b. With the release of .NET 2.0 (circa 2005), the C# programming
language was updated to support numerous new bells and whistles,
most notably the following:
i. The ability to build generic types and generic members. Using
generics, you are able to build very efficient and type-safe code
that defines numerous placeholders specified at the time you
interact with the generic item.
ii. Support for anonymous methods, which allow you to supply an
inline function anywhere a delegate type is required.
iii.
Numerous simplifications to the delegate/event model,
including covariance, contravariance, and method group
conversion.
iv. The ability to define a single type across multiple code files,
using the partial keyword.
c. As you might guess, .NET 3.5 adds even more functionality to the C#
programming language (C# 2008, to be exact), including the following
features:
i. Support for strongly typed queries (LINQ, or Language
Integrated Query) used to interact with various forms of data
ii. Support for anonymous types, which allow you to model the
shape of a type rather than its behavior
iii. The ability to extend the functionality of an existing type using
extension methods
iv.
Inclusion of a lambda operator (=>), which even further
simplifies working with .NET delegate types
v. A new object initialization syntax, which allows you to set
property values at the time of object creation

22.What are different usages of using keyword?


a. Import the namespace
b. Create the alias
c. Create disposable objects
23.What are disposable objects?
a. An object which destroys automatically when goes out of scope and do
not wait for Garbage Collector
b. Only those classes which are inherited from IDisposable interface can
be used to create the disposable
using (SqlConnection cn = new SqlConnection())
{
}

24.What is a namespace?
25.What are different usages of @?
a. To allow to use a keyword as identifier
i. int @float;
ii. Neutralize the meaning of Escape Character
iii. With parameters in SQL Server
iv. Creating pre-formatted strings
26.What is an assembly?
a. A file compiled from any .NET based language contains intermediate
language and meta data. Such file is called as assembly. An assembly
can be in the form of .exe or .dll
b. When a *.dll or an *.exe has been created using a .NET-aware compiler,
the resulting module is bundled into an assembly.
c. An assembly contains CIL code, which is conceptually similar to Java
bytecode in that it is not compiled to platform-specific instructions by
the .NET runtime.
d. In addition to CIL instructions, assemblies also contain metadata that
describes in vivid detail the characteristics of every type living within
the binary.
e. Finally, in addition to CIL and type metadata, assemblies themselves
are also described using metadata, which is officially termed a
manifest. The manifest contains information about the current version
of the assembly, culture information (used for localizing string and
image resources), and a list of all externally referenced assemblies that
are required for proper execution.

27.Is .NET platform Independent?


a. Yes
b. Using .NET universe: CLI (Common Language Infrastructure)
c. When Microsoft released the C# programming language and the .NET
platform, they also crafted a set of formal documents that described
the syntax and semantics of the C# and CIL languages, the .NET
assembly format, core .NET namespaces, and the mechanics of a
hypothetical .NET runtime engine (known as the Virtual Execution
System, or VES)
d. Better yet, these documents have been submitted to (and ratified by)
ECMA International as official international standards
(http://www.ecma-international.org). The specifications of interest are
i. ECMA-334: The C# Language Specification
ii. ECMA-335: The Common Language Infrastructure (CLI)
e. The importance of these documents becomes clear when you
understand that they enable third parties to build distributions of
the .NET platform for any number of operating systems and/or
processors.
f. The good news, however, is that the mainstream .NET distributions
extend the CLI libraries with Microsoft-compatible equivalents of
ASP.NET, ADO.NET, and Windows Forms in order to provide fullfeatured, production-level development platforms. To date, there are
two major implementations of the CLI (beyond Microsofts Windowsspecific offering).
i. http://www.mono-project.com
1. The Mono project is an open source distribution of the CLI
that targets various Linux distributions (e.g., SuSE,
Fedora, and so on) as well as Win32 and Mac OS X.
ii. http://www.dotgnu.org
1. Portable.NET is another open source distribution of the CLI
that runs on numerous operating systems. Portable.NET
aims to target as many operating systems as possible

(Win32, AIX, BeOS, Mac OS X, Solaris, all major Linux


distributions, and so on).
g. Both Mono and Portable.NET provide an ECMA-compliant C#
compiler, .NET runtime engine, code samples, documentation, as well
as numerous development tools that are functionally equivalent to the
tools that ship with Microsofts .NET Framework 3.5 SDK. Furthermore,
Mono and Portable.NET collectively ship with a VB .NET, Java, and C
complier.
28.What are different options used with CSC.EXE compiler?
a. /out
i. This option is used to specify the name of the assembly to be
created. By default, the assembly name is the same as the
name of the initial input *.cs file.
b. /target:exe
i. This option builds an executable console application. This is the
default assembly output type, and thus may be omitted when
building this type of application.
c. /target:library
i. This option builds a single-file *.dll assembly.
d. /target:module
i. This option builds a module. Modules are elements of multifile
assemblies
e. /target:winexe
i. Although you are free to build graphical user interfacebased
applications using the /target:exe option, /target:winexe
prevents a console window from appearing in the background
f. /r:filenamedll,filename.dll
i. To give reference to external assemblies
29. How to create a class diagram for a class?
a. Select a program file from Solution Explorer and click on View Class
Diagram button
30.How to test a method of a class?
a. Create an object of the class using new instance then execute that
method
31.What are different syntaxes of entry point?
a. void Main()
b. int Main()
c. void Main(string []args)
d. int Main(string []args)
32.How to get value returned by Main()?
a. Using ERRORLEVEL system variable or using
System.Diagnostics.Process.ExitCode
// Note we are now returning an int, rather than void.
static int Main(string[] args)
{
// Display a message and wait for Enter key to be pressed.
Console.WriteLine("***** My First C# App *****");
Console.WriteLine("Hello World!");

Console.WriteLine();
Console.ReadLine();
// Return an arbitrary error code.
return -1;
}
@echo off
rem A batch file for SimpleCSharpApp.exe
rem which captures the app's return value.
SimpleCSharpApp
@if "%ERRORLEVEL%" == "0" goto success
:fail
echo This application has failed!
echo return value = %ERRORLEVEL%
goto end
:success
echo This application has succeeded!
echo return value = %ERRORLEVEL%
goto end
:end
echo All Done.
33.How to use the command line arguments at command prompt and from
visual studio?
a. We can also get the command line input using following method
i. string[] theArgs = System.Environment.GetCommandLineArgs();
34.What else we can do with Environment class?
a. It provides additional properties to give information about the current
operating system
foreach (string drive in Environment.GetLogicalDrives())
Console.WriteLine("Drive: {0}", drive);
Console.WriteLine("OS: {0}", Environment.OSVersion);
Console.WriteLine("Number of processors:
{0}",Environment.ProcessorCount);
Console.WriteLine(".NET Version: {0}",Environment.Version);
35.What is OOPs?
36.What is class?
37.What is object?
38.What is reference?
39.What are constructor and destructors?
40.Components of a class
a. Fields
i. Variables
ii. Constants
iii. Read only
b. Methods
c. Properties
d. Indexer
e. Delegates
41.Types of Members inside a class
a. Static

b. Non-Static
42.Types of Classes
a. Concrete class
b. Abstract class
c. Sealed class
43.Types of methods
a. Concreate
b. Abstract
c. Sealed
44.What are virtual methods?
45.What are conditions to override a method?
a. The method must be abstract or virtual
b. Use override keyword with virtual and also with abstract method if
allowing to override further
46.What keyword is used for hiding?
a. new keyword
47.What is the difference between method hiding and overriding?
a. Overriding is required if runtime polymorphism is to be implemented
48.What are interfaces and what are usages of interfaces?
49.Exception Handling
a. try
b. catch
c. finally
d. throw
50.What ADO.NET?
a. Providers
i. Odbc
ii. OleDb
iii. SqlClient
iv. OracleClient
b. Category of classes
i. Connection
ii. Command
iii. Adapter
iv. DataReader
v. Parameter
c. DataTable
d. DataSet
e. DataView
51.What is MVC (Model-View-Controller) Architecture?
a. It helps in reducing the efforts when different views are used
b. Sample
i. Create a project to manage data for students
1. rollno
2. name
3. course
ii. Views: Windows, Web Based
iii. Back-ends : SQL Server, Oracle
iv. OR-Mapping

Step 1: Create a library for mapping tables with classes

namespace Mapping
{
public class Student
{
public Student()
{
}
public Student(int rollno, string name, string course)
{
this.RollNo = rollno;
this.Name = name;
this.Course = course;
}
public int RollNo
{
get;
set;
}
public string Name
{
get;
set;
}
public string Course

{
}
}

set;
get;

Database Specific Programming (Model)


Add another project as class library to Manage business logic for Sql Server
Add another project as class library to Manage business logic for Oracle
Give reference of OR Mapping library into database specific libraries

Sending Emails from an application


Requirements
1.
2.
3.
4.
5.
6.
7.
8.

SMTP Server : mail.bpsharma.in


Port No : 25
User Id : revision@bpsharma.in
Password: abcd
From : revision@bpsharma.in
To
Message Body
Subject

Вам также может понравиться