Documente Academic
Documente Profesional
Documente Cultură
VB.NET QUESTIONS
1) Entity integrity
2) Domain integrity
3) Referential integrity
4) User-defined integrity
Entity Integrity: Entity integrity defines a row as a unique entity for a particular table. Entity integrity
enforces the integrity of the identifier column(s) or the primary key of a table (through indexes, UNIQUE
constraints, PRIMARY KEY constraints, or IDENTITY properties).
Domain Integrity: Domain integrity is the validity of entries for a given column. You can enforce domain
integrity by restricting the type (through data types), the format (through CHECK constraints and rules),
or the range of possible values (through FOREIGN KEY constraints, CHECK constraints, DEFAULT efinitions,
NOT NULL definitions, and rules).
Referential Integrity: Referential integrity preserves the defined relationships between tables when
records are entered or deleted. In Microsoft® SQL Server™ 2000, referential integrity is based on
relationships between foreign keys and primary keys or between foreign keys and unique keys (through
FOREIGN KEY and CHECK constraints). Referential integrity ensures that key values are consistent across
tables. Such consistency requires that there be no references to nonexistent values and that if a key value
changes, all references to it change consistently throughout the database. When you enforce referential
integrity, SQL Server prevents users from:
· Adding records to a related table if there is no associated record in the primary table.
· Changing values in a primary table that result in orphaned records in a related table.
· Deleting records from a primary table if there are matching related records.
For example, with the sales and titles tables in the pubs database, referential integrity is based on the
relationship between the foreign key (title_id) in the sales table and the primary key (title_id) in the titles
table.
User-Defined: Integrity User-defined integrity allows you to define specific business rules that do not fall
into one of the other integrity categories. All of the integrity categories support user-defined integrity (all
column- and table-level constraints in CREATE TABLE, stored procedures, and triggers).
Question: SQL Server runs on which TCP/IP port and From where can you change the default
port?
Answer: SQL Server runs on port 1433 but we can also change it for better security and From the
network Utility TCP/IP properties -->Port number.both on client and the server.
Question: What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
Answer: Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is
applied to each row before they are part of the GROUP BY function in a query.
Normalizing a logical database design involves using formal methods to separate the data into multiple,
related tables. A greater number of narrow tables (with fewer columns) is characteristic of a normalized
database. A few wide tables (with more columns) is characteristic of an nonnomalized database.
Reasonable normalization often improves performance. When useful indexes are available, the Microsoft®
SQL Server™ 2000 query optimizer is efficient at selecting rapid, efficient joins between tables.
As normalization increases, so do the number and complexity of joins required to retrieve data. Too many
complex relational joins between too many tables can hinder performance. Reasonable normalization often
includes few regularly executed queries that use joins involving more than four tables.
Sometimes the logical database design is already fixed and total redesign is not feasible. Even then,
however, it might be possible to normalize a large table selectively into several smaller tables. If the
database is accessed through stored procedures, this schema change could take place without affecting
applications. If not, it might be possible to create a view that hides the schema change from the
applications.
Question: Can you tell me the difference between DELETE &TRUNCATE commands?
Answer: Delete command removes the rows from a table based on the condition that we provide with a
WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the
table after we run the truncate command.
OOPS
Question: What Is OOPS ?
Answer: OOPs is an Object Oriented Programming language,which is the extension of Procedure Oriented
Programming language.OOPS reduce the code of the program because of the extensive feature of
Polymorphism. OOPS have many properties such as Data-Hiding,Inheritence,Data Absraction,Data
Encapsulation and many moreEverything in the world is an object. The type of the object may vary. In
OOPS, we get the power to create objects of our own, as & when required.
if ds.Tables(0).Rows.Count= 0 then
'No record
else
'record found
dr= cmd.ExecuteReader(CommandBehavior.CloseConnection);
The associated connection will be closed automatically when the Close method of the Datareader is called.
This makes it all the more important to always remember to call Close on your datareaders.
Question:-Which method do you invoke on the DataAdapter control to load your generated
dataset with data?
Answer: The Fill() method.
Question:-What are good ADO.NET object(s) to replace the ADO Recordset object?
Answer: There are alot...but the base once are SqlConnection, OleDbConnection, etc...
Question:-Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Answer:Valid answers are:
• A DataSet can represent an entire relational database in memory, complete with tables, relations,
and views.
• A DataSet is designed to work without any continuing connection to the original data source.
• Data in a DataSet is bulk-loaded, rather than being loaded on demand.
• There's no concept of cursor types in a DataSet.
• DataSets have no current record pointer You can use For Each loops to move through the data.
• You can store many edits in a DataSet, and write them to the original data source in a single
operation.
• Though the DataSet is universal, other objects in ADO.NET come in different versions for different
data sources.
Use the View State property to save data in a hidden field on a page. Because ViewState stores data on
the page, it is limited to items that can be serialized. If you want to store more complex items in View
State, you must convert the items to and from a string.
Query strings Use these strings to pass information between requests and responses as part of the Web
address. Query strings are visible to the user, so they should not contain secure information such as
passwords.
Cookies Use cookies to store small amounts of information on a client. Clients might refuse cookies, so
your code has to anticipate that possibility.
View state ASP.NET stores items added to a page’s ViewState property as hidden fields on the page.
Session state Use Session state variables to store items that you want keep local to the current session
(single user).
Application state Use Application state variables to store items that you want be available to all users of
the application.
Programmers understand that they're responsible for releasing any memory that they allocate, but they're
not very good at actually doing it. In addition, functions that allocate memory as a side effect abound in
the Windows API and in the C runtime library. It's nearly impossible for a programmer to know all of the
rules. Even when the programmer follows the rules, a small memory leak in a support library can cause
big problems if called enough.
The .NET Framework solves the memory management problems by implementing a garbage collector that
can keep track of allocated memory references and release the memory when it is no longer referenced. A
large part of what makes this possible is the blazing speed of today's processors. When you're running a 2
GHz machine, it's easy to spare a few cycles for memory management. Not that the garbage collector
takes a huge number of cycles--it's incredibly efficient.
The garbage collector isn't perfect and it doesn't solve the problem of mis-managing other scarce
resources (file handles, for example), but it relieves programmers from having to worry about a huge
source of bugs that trips almost everybody up in other programming environments.
On balance, automatic memory management is a huge win in almost every situation.
Http-Post:-This is same as Http-Get but the diffrence is that in place of sending parameters onto the URL
information is send with HTTP request message with some extra information which contains Parameters
and their values.This Protocols is limited to sending name/value pairs.
SOAP:-The only diffrence is that its relies on the XML as compares to Http-Get,Http-Post.SOAP can send
not only the name/value pairs but also some complex object also as for example
datatypes,class,objects.SOAP can also uses request/reponse model as Http-Get,Http-post but it is not
limited to Request/Response it can also send types of message.Because its uses XML that is pure text so
firewalls not created so much problem because its easily converted in to HTML. .
Question: Why do some web service classes derive from System.Web.WebServices while others
do not ?
Answer: Those Web Service classes which employ objects like Application, Session, Context, Server, and
User have to derive from System.Web.WebServices. If it does not use these objects, it is not necessary to
be derived from it.
Question: What is the standard you use to wrap up a call to a Web service ?
Answer: HTTP with SOAP.
Question: Is it possible to generate the source code for an ASP.NET Web service from a WSDL ?
Answer: The Wsdl.exe tool (.NET Framework SDK) can be used to generate source code for an ASP.NET
web service with its WSDL link.
Example: wsdl /server http://api.google.com/GoogleSearch.wsdl.
Question: Can you give an example of when it would be appropriate to use a web service as
opposed to a non-serviced .NET component ?
Answer: When to Use Web Services:
(i)Communicating through a Firewall When building a distributed application with 100s/1000s of users
spread over multiple locations, there is always the problem of communicating between client and server
because of firewalls and proxy servers. Exposing your middle tier components as Web Services and
invoking the directly from a Windows UI is a very valid option.
(ii)Application Integration When integrating applications written in various languages and running on
disparate systems. Or even applications running on the same platform that have been written by separate
vendors.
(iii)Business-to-Business Integration This is an enabler for B2B intergtation which allows one to expose
vital business processes to authorized supplier and customers. An example would be exposing electronic
ordering and invoicing, allowing customers to send you purchase orders and suppliers to send you invoices
electronically.
(iv)Software Reuse This takes place at multiple levels. Code Reuse at the Source code level or binary
componet-based resuse. The limiting factor here is that you can reuse the code but not the data behind it.
Webservice overcome this limitation. A scenario could be when you are building an app that aggregates
the functionality of serveral other Applicatons. Each of these functions could be performed by individual
apps, but there is value in perhaps combining the the multiple apps to present a unifiend view in a Portal
or Intranet.