NEWS & UPDATES >> BCA BCSP064 Synopsis & Project Work Started for DEC 2017, IGNOU MCA MCSP060 Synopsis Work Started for DEC 2017, CONTACT 4 IGNOU Mini Project
Showing posts with label .NET-SQLServer. Show all posts
Showing posts with label .NET-SQLServer. Show all posts

IGNOU BCA MCA Students - VIVA Question Answer for SQL Server Part II

IGNOU BCA MCA Students - VIVA Question Answer for SQL Server

SQL Server with .Net Selected Question Answer - PART II

Ques9) What are different Types of Join?
Ans ) 1) Cross Join A cross join that does not have a WHERE clause produces the Cartesian product of the tables involved in the join. The size of a Cartesian product result set is the number of rows in the first table multiplied by the number of rows in the second table. The common example is when company wants to combine each product with a pricing table to analyze each product at each price.

2)Inner Join A join that displays only the rows that have a match in both joined tables is known as inner Join. This is the default type of join in the Query and View Designer.

3)Outer Join A join that includes rows even if they do not have related rows in the joined table is an Outer Join. You can create three different outer join to specify the unmatched rows to be included:
  1. Left Outer Join: In Left Outer Join all rows in the first-named table i.e. "left" table, which appears leftmost in the JOIN clause are included. Unmatched rows in the right table do not appear.
  2. Right Outer Join: In Right Outer Join all rows in the second-named table i.e. "right" table, which appears rightmost in the JOIN clause are included. Unmatched rows in the left table are not included.
  3. Full Outer Join: In Full Outer Join all rows in all joined tables are included, whether they are matched or not.
  4.  Self Join This is a particular case when one table joins to itself, with one or two aliases to avoid confusion. A self join can be of any type, as long as the joined tables are the same. A self join is rather unique in that it involves a relationship with only one table. The common example is when company has a hierarchal reporting structure whereby one member of staff reports to another. Self Join can be Outer Join or Inner Join.

Ques 10)Differentiate between a Local and a Global temporary table?
Ans)- A local temporary table exists only for the duration of a connection or, if defined inside a compound statement, for the duration of the compound statement.

- Global temporary tables (created with a double “##”) are visible to all sessions.
- Global temporary tables are dropped when the session that created it ends, and all other sessions have stopped referencing it.

Ques 11)Explain different types of Locks in SQL Server.
Ans)- There are 3 kinds of locks in SQL Server

i.) Shared locks - they are used for operations which do not allow any change or update of data. For e.g. SELECT.

ii.) Update locks - they are used when SQL Server wants to modify a page. The update page lock is then promoted to an exclusive page lock before actually making the changes.

iii.) Exclusive locks - they are used for the data modification operations. For e.g. UPDATE, INSERT, or DELETE.

IGNOU BCA MCA Students - VIVA Question Answer for SQL Server Part I


IGNOU BCA MCA Students - VIVA Question Answer for SQL Server

SQL Server with .Net Selected Question Answer - PART I

Ques 1) What are the difference between clustered and a non-clustered index?
Ans) A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages.
A non clustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a non clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

Ques 2) What's the difference between a primary key and a unique key?
Ans)  Both primary key and unique key enforces uniqueness of the column on which they are defined. But by default primary key creates a clustered index on the column, where are unique creates a non- clustered index by default. Another major difference is that, primary key doesn't allow NULLs, but unique key allows one NULL only.

Ques 3) What is SQL Server Agent?
Ans)  SQL Server agent plays an important role in the day-to-day tasks of a database administrator (DBA). It is often overlooked as one of the main tools for SQL Server management. Its purpose is to ease the implementation of tasks for the DBA, with its full- function scheduling engine, which allows you to schedule your own jobs and scripts.


Ques 4) What are differences between function and stored procedure?
Ans:
1) Function returns only one value but procedure returns one or more than one value.
2) Function can be utilized in select statements but that is not possible in procedure.
3) Procedure can have an input and output parameters but function has
Ques 5) How to find out which index is defined on table?
Ans: sp_helpindex tablename

Ques 6) What are the advantages of using Stored Procedures?
Ans - They help in reducing the network traffic and latency which in turn boosts application performance.
- They help in promoting code reuse.
- They provide better security to data.
- It is possible to encapsulate the logic using stored procedures. This allows to change stored procedure code without affecting clients.
- It is possible to reuse stored procedure execution plans, which are cached in SQL Server's memory. This reduces server overhead.

Ques 7) What do you mean by ACID?
Ans - ACID (Atomicity Consistency Isolation Durability) is a quality sought after in a reliable database. Here's the relevance of each quality:
- Atomicity is an all-or-none proposition.
- Consistency - it guarantees that your database is never left by a transaction in a half-finished state.
- Isolation - it keeps transactions separated from each other until they’re finished.
- Durability - it ensures that the database keeps a track of pending changes in a way that the server can recover from an abnormal termination.


Ques8) What is Trigger? What is Nested Trigger?
Ans) A trigger is a SQL procedure that initiates an action when an event (INSERT, DELETE or UPDATE) occurs. Triggers are stored in and managed by the DBMS. Triggers are used to maintain the referential integrity of data by changing the data in a systematic fashion. A trigger cannot be called or executed; DBMS automatically fires the trigger as a result of a data modification to the associated table. Triggers can be viewed as similar to stored procedures in that both consist of procedural logic that is stored at the database level. Stored procedures, however, are not event-drive and are not attached to a specific table as triggers are. Stored procedures are explicitly executed by invoking a CALL to the procedure while triggers are implicitly executed. In addition, triggers can also execute stored procedures.

Nested Trigger
A trigger can also contain INSERT, UPDATE and DELETE logic within itself, so when the trigger is fired because of data modification it can also cause another data modification, thereby firing another trigger. A trigger that contains data modification logic within itself is called a nested trigger.

IGNOU BCA MCA Students - VIVA Question Answer for .NET Part VI

IGNOU BCA MCA Students - VIVA Question Answer for .NET 

.NET with C# Selected Question Answer - PART VI

Ques12) What is the difference between authentication and authorization?
Ans)   Authentication verifies the identity of a user and authorization is a process where you can check whether or not the identity has access rights to the system. In other words, you can say that authentication is a procedure of getting some credentials from the users and verify the user's identity against those credentials. Authorization is a procedure of granting access of particular resources to an authenticated user. You should note that authentication always takes place before authorization.

Ques13) Which ASP.NET objects encapsulate the state of the client and the browser?
Ans)   The Session object encapsulates the state of the client and browser.

Ques14)  How can you register a custom server control to a Web page?
Ans)   You can register a custom server control to a Web page using the @Register directive.

Ques15) What is ViewState?
Ans)   The ViewState is a feature used by ASP.NET Web page to store the value of a page and its controls just before posting the page. Once the page is posted, the first task by the page processing is to restore the ViewState to get the values of the controls.

Ques16)  Differentiate between client-side and server-side validations in Web pages.
Ans)   Client-side validations take place at the client end with the help of JavaScript and VBScript before the Web page is sent to the server. On the other hand, server-side validations take place at the server end.

Ques17)  What are difference between GET and POST Methods?
Ans:
GET Method (): 

1) Data is appended to the URL.
2) Data is not secret.
3) It is a single call system
4) Maximum data that can be sent is 256.
5) Data transmission is faster
6) this is the default method for many browsers

POST Method (): 


1) Data is not appended to the URL.
2) Data is Secret
3) it is a two call system.
4) There is no Limit on the amount of data. That is characters any amount of data can be sent.
5) Data transmission is comparatively slow.
6) No default and should be explicitly specified.

Ques18)  What are the different levels of State management in ASP.NET?
Ans:
State management is the process by which you maintain state and page information over multiple requests for the same or different pages.


There are 2 types State Management:

1. Client – Side State Management

This stores information on the client's computer by embedding the information into a Web page, a uniform resource locator (url), or a cookie. The techniques available to store the state information at the client end are listed down below:

a. View State – Asp.Net uses View State to track the values in the Controls. You can add custom values to the view state. It is used by the Asp.net page framework to automatically save the values of the page and of each control just prior to rendering to the page. When the page is posted, one of the first tasks performed by page processing is to restore view state.

b. Control State – If you create a custom control that requires view state to work properly, you should use control state to ensure other developers don’t break your control by disabling view state.

c. Hidden fields – Like view state, hidden fields store data in an HTML form without displaying it in the user's browser. The data is available only when the form is processed.

d. Cookies – Cookies store a value in the user's browser that the browser sends with every page request to the same server. Cookies are the best way to store state data that must be available for multiple Web pages on a web site.

e. Query Strings - Query strings store values in the URL that are visible to the user. Use query strings when you want a user to be able to e-mail or instant message state data with a URL.

2
. Server – Side State Management
a. Application State - Application State information is available to all pages, regardless of which user requests a page.

b. Session State – Session State information is available to all pages opened by a user during a single visit.

Both application state and session state information is lost when the application restarts. To persist user data between application restarts, you can store it using profile properties.



Ques19)  How many web.config files are there in 1 project?

Ans: There might be multiple web.config files for a single project depending on the hierarchy of folders inside the root folder of the project, so for each folder we can use one web.config file

IGNOU BCA MCA Students - VIVA Question Answer for .NET Part V

IGNOU BCA MCA Students - VIVA Question Answer for .NET 

.NET with C# Selected Question Answer - PART V

Ques 5) What is the lifespan for items stored in ViewState?
Ans)   The items stored in ViewState live until the lifetime of the current page expires including the postbacks to the same page.

Ques 6) What are the advantages of the code-behind feature?
Ans)   The code-behind feature of ASP.NET offers a number of advantages:
  • Makes code easy to understand and debug by separating application logic from HTML tags
  • Provides the isolation of effort between graphic designers and software engineers
  • Removes the problems of browser incompatibility by providing code files to exist on the Web server and supporting Web pages to be compiled on demand.
Ques 7) What is AutoPostBack?
Ans)   If you want a control to postback automatically when an event is raised, you need to set the AutoPostBack property of the control to True.
Ques 8) What is the function of the ViewState property?
Ans)   The ASP.NET 4.0 introduced a new property called ViewStateMode for the Control class. Now you can enable the view state to an individual control even if the view state for an ASP.NET page is disabled.
Ques9) What is Query String? What are its advantages and limitations?
Ans)   The Query String helps in sending the page information to the server.

The Query String has the following advantages:
  • Every browser works with Query Strings.
  • It does not require server resources and so does not exert any kind of burden on the server.

The following are the limitations of Query String:
  • Information must be within the limit because URL does not support many characters.
  • Information is clearly visible to the user, which leads to security threats.



Ques10) What is actually returned from server to the browser when a browser requests an .aspx file and the file is displayed?
Ans)   When a browser requests an .aspx file then the server returns a response, which is rendered into a HTML string.

Ques11) Which two new properties are added in ASP.NET 4.0 Page class?
Ans)   The two new properties added in the Page class are   MetaKeyword and MetaDescription.

IGNOU BCA MCA Students - VIVA Question Answer for .NET Part IV

IGNOU BCA MCA Students - VIVA Question Answer for .NET 

.NET with C# Selected Question Answer - PART IV

Ques 1) What is ASP.NET?
Ans)   ASP.NET is a specification developed by Microsoft to create dynamic Web applications, Web sites, and Web services. It is a part of .NET Framework. You can create ASP.NET applications in most of the .NET compatible languages, such as Visual Basic, C#, and J#. The ASP.NET compiles the Web pages and provides much better performance than scripting languages, such as VBScript. The Web Forms support to create powerful forms-based Web pages. You can use ASP.NET Web server controls to create interactive Web applications. With the help of Web server controls, you can easily create a Web application.

Ques 2) What is the basic difference between ASP and ASP.NET?
Ans)   The basic difference between ASP and ASP.NET is that ASP is interpreted; whereas, ASP.NET is compiled. This implies that since ASP uses VBScript; therefore, when an ASP page is executed, it is interpreted. On the other hand, ASP.NET uses .NET languages, such as C# and VB.NET, which are compiled to Microsoft Intermediate Language (MSIL).

Ques 3) In which event are the controls fully loaded?
Ans)   Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event.

Ques 4) How can we identify that the Page is Post Back?
Ans)   Page object has an "IsPostBack" property, which can be checked to know that is the page posted back.
IsPostBack
Postback is actually sending all the information from client to web server, then web server process all those contents and returns back to the client. Most of the time ASP control will cause a post back (e. g. buttonclick) but some don't unless you tell them to do In certain events ( Listbox Index Changed,RadioButton Checked etc..) in an ASP.NET page upon which a PostBack might be needed.
IsPostBack is a property of the Asp.Net page that tells whether or not the page is on its initial load or if a user has perform a button on your web page that has caused the page to post back to itself. The value of the Page.IsPostBack property will be set to true when the page is executing after a postback, and false otherwise. We can check the value of this property based on the value and we can populate the controls on the page.
Is Postback is normally used on page _load event to detect if the web page is getting generated due to postback requested by a control on the page or if the page is getting loaded for the first time.
C# Source Code

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        // generate form;
    }
    else
    {
        //process submitted data;
    }
}

IGNOU BCA MCA Students - VIVA Question Answer for .NET Part III

IGNOU BCA MCA Students - VIVA Question Answer for .NET 

.NET Selected Question Answer - PART III

15. Which are Access Modifiers available in C#?
All types and type members have an accessibility level, which controls whether they can be used from other code in your assembly or other assemblies.

You can use the following access modifiers to specify the accessibility of a type or member when you declare it:
public: The type or member can be accessed by any other code in the same assembly or another assembly that references it.
private: The type or member can be accessed only by code in the same class or struct.
protected: The type or member can be accessed only by code in the same class or struct, or in a class that is derived from that class.
internal: The type or member can be accessed by any code in the same assembly, but not from another assembly.

16. Data Types in C#?
bool, byte , char, decimal , double, float, int, long, sbyte , short, uint, ulong, ushort.

More question coming soon.. we are updating our list of ques and answer... :)
keep wait and watch for few days.

17. Database connection with sql server and asp.net c#
Using ASP.NET 4 C# AND SQL server,
I have a connection string in web.config to myDatabase named "myCS". I have a database named myDB. I have a table named myTable with a primary key named myPK
What are the NECESSARY lines of code behind (minimal code) to create a SQL connection, then select from myTable where myPK=="simpleText"
it will probably include:
sqlconnection conn = new sqlconnection(??? myCS)
string SQLcommand = select * from myDB.myTable where myPK==myTestString;
sqlCommand command = new SqlCommand(SQL,conn);

conn.Open();

booleanFlag = ????

conn.Close();
conn.Dispose();
then
If ( theAnswer  != NULL )  // or (if flag)
{
Response.Redirect("Page1.aspx");
}
else
{
Response.Redirect("Page2.aspx");
}



DB Connection code just write if they ask
using (SqlConnection con = new SqlConnection("SomeConnectionString"))
{
  var cmd = new SqlCommand("select from myTable where myPK==N'"+ simpleText+ "'",con);
  cmd.Connection.Open();
  var sqlReader = cmd.ExecuteReader();
  while(sqlReader.Read())
  {
    //Fill some data like : string result = sqlReader("SomeFieldName");
  }
  sqlReader.Close();
  cmd.Connection.Close();
  cmd.Dispose();
}