ASP.NET WEB.CONFIG RELATED INTERVIEW QUESTIONS FOR EXPERIENCED PART 2


ASP.NET WEB.CONFIG RELATED INTERVIEW QUESTIONS FOR EXPERIENCED PART 2



16. How can you configure session state mode in the web.config file?

Session state mode can be configured in the web.config file by setting the mode attribute in the <sessionState> section to specify whether session data should be stored in-process, in a SQL Server database, or in a State Server.

17. What is the purpose of the <roleManager> section in the web.config file?

The <roleManager> section in the web.config file is used to configure role-based security settings for the web application, such as defining roles, mapping roles to users, and specifying role providers.

18. How can you configure custom HTTP headers for static files in the web.config file?

Custom HTTP headers for static files can be configured in the web.config file by using the <staticContent> section with options to set custom headers, MIME types, and cache control directives for specific file types.

19. How can you configure URL authorization rules in the web.config file?

URL authorization rules can be configured in the web.config file by using the <authorization> section with options to allow or deny access to specific URLs or directories based on user roles or users.

20. What is the purpose of the <httpCookies> section in the web.config file?

The <httpCookies> section in the web.config file is used to configure settings for HTTP cookies, such as setting cookie domain, path, expiration, and secure attributes for managing cookie behavior.

21. How can you configure custom error handling for specific HTTP status codes in the web.config file?

Custom error handling for specific HTTP status codes can be configured in the web.config file by setting the <httpErrors> section with options to redirect users to custom error pages based on different status codes.

22. How can you configure request filtering rules in the web.config file?

Request filtering rules can be configured in the web.config file by using the <requestFiltering> section with options to allow or deny specific HTTP requests based on criteria such as file extensions or request headers.

23. What is the purpose of the <customHeaders> section in the web.config file?

The <customHeaders> section in the web.config file is used to define custom HTTP headers that should be added to HTTP responses for controlling caching behavior, security policies, or other custom requirements.

24. How can you configure compression settings for static and dynamic content in the web.config file?

Compression settings for using < with options compression specific content types and.

.-origin in can be configured in the web.config file by using the <httpProtocol> section with options to add custom headers for handling CORS requests, such as setting Access-Control-Allow-Origin and Access-Control-Allow-Methods.

26. What is the purpose of the <modules> section in the web.config file?

The <modules> section in the web.config file is used to configure HTTP modules that can intercept and process requests at various stages of the request processing pipeline, such as authentication, logging, or URL rewriting.

27. How can you configure custom error logging in the web.config file?

Custom error logging can be configured in the web.config file by setting the <healthMonitoring> section with options to log errors, warnings, and other events to a specified log provider, such as the Windows Event Log or a custom log file.

28. How can you configure session state encryption in the web.config file?

Session state encryption can be configured in the web.config file by setting the <sessionState> section with options to enable encryption for session data, using the cookieProtection attribute with values such as All, None, or Encryption.

29. How can you configure custom HTTP handlers for specific file types in the web.config file?

Custom HTTP handlers for specific file types can be configured in the web.config file by using the <httpHandlers> section with options to map file extensions to custom handler classes for processing requests for those file types.

30. How can you configure custom output caching profiles in the web.config file?

Custom output caching profiles can be configured in the web.config file by setting the <caching> section with options to define named caching profiles with specific duration, location, and dependencies for caching output of specific pages or resources.

ASP.NET WEB.CONFIG RELATED INTERVIEW QUESTIONS FOR EXPERIENCED PART 1

ASP.NET WEB.CONFIG RELATED INTERVIEW QUESTIONS FOR EXPERIENCED PART 1



1. What is the purpose of the web.config file in ASP.NET?

The web.config file in ASP.NET is used to store configuration settings for a web application, such as connection strings, authentication settings, and custom application settings.

2. How can you secure sensitive information in the web.config file?

Sensitive information in the web.config file can be secured by using the <appSettings> section with encryption or by storing sensitive data in a separate configuration file with restricted access.

3. What is the difference between <appSettings> and <connectionStrings> in the web.config file?

The <appSettings> section is used to store key-value pairs of custom application settings, while the <connectionStrings> section is used to store database connection strings.

4. How can you handle errors in the web.config file?

Errors in an ASP.NET application can be handled by configuring the <customErrors> section in the web.config file to redirect users to a custom error page or display detailed error messages.

5. What is the purpose of the <authentication> section in the web.config file?

The <authentication> section in the web.config file is used to configure authentication settings for the web application, such as forms authentication, Windows authentication, or Passport authentication.

6. How can you enable debugging in the web.config file?

Debugging can be enabled in the web.config file by setting the <compilation debug="true"> attribute in the <system.web> section to allow debugging information to be displayed in the browser.

7. What is the role of the <httpHandlers> and <httpModules> sections in the web.config file?

The <httpHandlers> section is used to define custom HTTP handlers for processing specific types of requests, while the <httpModules> section is used to define custom HTTP modules for intercepting and processing requests.

8. How can you configure session state in the web.config file?

Session state can be configured in the web.config file by setting the <sessionState> section with options such as in-process, SQL Server, or State Server mode, and specifying session timeout values.

9. What is the purpose of the <globalization> section in the web.config file?

The <globalization> section in the web.config file is used to configure globalization settings for the web application, such as specifying the default culture and UI culture for the application.

10. How can you restrict access to specific directories in the web.config file?

Access to specific directories can be restricted in the web.config file by using the <authorization> section to define access rules based on user roles or deny access to certain users.

11. How can you configure custom error pages in the web.config file?

Custom error pages can be configured in the web.config file by setting the <customErrors> section with options to redirect users to specific error pages based on different HTTP status codes.

12. What is the purpose of the <compilation> section in the web.config file?

The <compilation> section in the web.config file is used to configure compilation settings for the web application, such as specifying debug mode, target framework version, and batch compilation.

13. How can you configure URL rewriting in the web.config file?

URL rewriting can be configured in the web.config file by using the <rewrite> section with rules to redirect or rewrite URLs based on specific patterns or conditions.

14. How can you configure caching settings in the web.config file?

Caching settings can be configured in the web.config file by setting the <caching> section with options to enable output caching, fragment caching, or data caching for improved performance.

15. How can you set custom HTTP headers in the web.config file?

Custom HTTP headers can be set in the web.config file by using the <httpProtocol> section with options to add custom headers, set cache control directives, or configure content compression.

Top SQL server Interview questions with answers

1. What is SQL Server?

SQL Server is a relational database management system developed by Microsoft. It is used to store and retrieve data as requested by other software applications.

2. What are the different editions of SQL Server?

The different editions of SQL Server include Enterprise, Standard, Express, and Developer editions.

3. What is a clustered index in SQL Server?

A clustered index in SQL Server determines the physical order of data in a table. It sorts and stores the rows in the table based on the key values.

4. What is a non-clustered index in SQL Server?

A non-clustered index in SQL Server does not affect the physical order of data in a table. It is stored separately from the table and contains pointers to the actual data.

5. What is a primary key in SQL Server?

A primary key in SQL Server is a unique identifier for each row in a table. It ensures that each row is uniquely identified and helps enforce data integrity.

6. What is a foreign key in SQL Server?

A foreign key in SQL Server is a field or a combination of fields that establishes a link between two tables. It enforces referential integrity between the two tables.

7. What is normalization in SQL Server?

Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity. It involves breaking down tables into smaller, more manageable entities.

8. What is denormalization in SQL Server?

Denormalization is the process of adding redundant data to a database to improve query performance. It involves combining tables or adding duplicate data to eliminate the need for joins.

9. What is a stored procedure in SQL Server?

A stored procedure in SQL Server is a precompiled set of SQL statements that can be executed as a single unit. It is stored in the database and can be called by other applications.

10. What is a trigger in SQL Server?

A trigger in SQL Server is a special type of stored procedure that is automatically executed in response to certain events, such as insert, update, or delete operations on a table.

11. What is the difference between CHAR and VARCHAR data types in SQL Server?

CHAR is a fixed-length data type that stores a specific number of characters, while VARCHAR is a variable-length data type that stores up to a maximum number of characters.

12. What is the difference between UNION and UNION ALL in SQL Server?

UNION combines the results of two or more SELECT statements and removes duplicate rows, while UNION ALL combines the results of two or more SELECT statements without removing duplicate rows.

13. What is the difference between DELETE and TRUNCATE in SQL Server?

DELETE removes individual rows from a table based on a condition, while TRUNCATE removes all rows from a table without logging individual row deletions.

14. What is the difference between INNER JOIN and OUTER JOIN in SQL Server?

INNER JOIN returns rows when there is at least one match in both tables, while OUTER JOIN returns all rows from one table and only matching rows from the other table.

15. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

16. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

17. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

18. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

19. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

20. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

21. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

22. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

23. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

24. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

25. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

26. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

27. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

28. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

29. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

30. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

31. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

32. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

33. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

34. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

35. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

36. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

37. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

38. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

39. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

40. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

41. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

42. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

43. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

44. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

45. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

46. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

47. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

48. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

49. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

50. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

51. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

52. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

53. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

54. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

55. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

56. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

57. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

58. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

59. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

60. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

61. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

62. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

63. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

64. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

65. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

66. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

67. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

68. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

69. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

70. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

71. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

72. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

73. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

74. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

75. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

76. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

77. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

78. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

79. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

80. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

81. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately from the table.

82. What is the difference between a primary key and a unique key in SQL Server?

A primary key is a unique identifier for each row in a table and cannot contain NULL values, while a unique key enforces uniqueness but allows NULL values.

83. What is the difference between a view and a table in SQL Server?

A view is a virtual table that is based on the result set of a SELECT statement, while a table is a physical storage structure that contains data.

84. What is the difference between a function and a stored procedure in SQL Server?

A function returns a value and can be used in SELECT statements, while a stored procedure does not return a value and can perform multiple operations.

85. What is the difference between a subquery and a join in SQL Server?

A subquery is a query nested within another query, while a join is used to combine rows from two or more tables based on a related column between them.

86. What is the difference between a scalar function and a table-valued function in SQL Server?

A scalar function returns a single value, while a table-valued function returns a table as a result set.

87. What is the difference between a clustered and non-clustered index in SQL Server?

A clustered index determines the physical order of data in a table, while a non-clustered index does not affect the physical order of data and is stored separately f

Delete In SQL Server

What is Delete Statement in SQL Server?

Delete :-

Delete statement is used for Delets row in a table.

Syntax:-

Delete from Table_name 
Where some_column = some_value

Example:-

Delete from Student
where StudentId ='2'


Note :-
If we cannot used "where" clause in delete statement then it can delete all the records from table.

SQL SELECT Statment

What is SELECT Query ?


SELECT:-
The SELECT statement is probably the most used statement n SQL command.

Syntax:-

Select * from Table_name

Example:-

Select * from Student

Case:-  If we want to show only few column then we write this query.

Syntax:-

Select  columnname1,columnname2,columnname3 from table_name

Example:-

Select StudentId,StudentName,RollNumber From Student

Order by keyword in SQl SERVER

What Is Order By Keyword in SQl SERVER ? How To use?


Order by :-
 
-The Order by keyword is used to sort the result according to user choice ascending order or descending order.
-By default order by show ascending order  result.

Syntax:-

Select  * from Table_name
order by columnname ASC/DESC

CASE:
1) By Ascending Order:- The following SQL statement selects all Student from the "student" table, sorted ASCENDING by the "Name" column:

Example:-

Select * from Student
Order by Name ASC

2)By Descending Order:- The following SQL statement selects all Student from the "student" table, sorted DESCENDING by the "Name" column

Example:

Select * from Student
Order by Name DESC

3)Show Some Column:- The following SQL statement selects some column from the "student" table, sorted ASCENDING by the "Name" column:

Example:-

Select Name, City From Student 
Order by Name ASC

4)Order by Mutiple Column:- The following SQL statement selects all Student from the "student" table, sorted ASCENDING by the "Name" column and DESCENDING by the "City" Column:

Example:-

Select * From Student 
Order by Name ASC , City DESC


List of 90 Sql Server Interview Question and Answer

List of 90 SQL Server Interview Questions and Answers





Q #1) What is SQL?


Answer: Structured Query Language SQL is a database tool that is used to create and access the database to support software applications.


Q #2) What are tables in SQL?


Answer: The table is a collection of records and information in a single view.


Q #3) What are the different types of statements supported by SQL?


Answer:


statements supported by SQL


There are 3 types of SQL statements:


a) DDL (Data Definition Language): It is used to define the database structure such as tables. It includes three statements such as CREATE, ALTER, and DROP.


Some of the DDL Commands are listed below:


CREATE: It is used for creating the table.


CREATE TABLE table_name

column_name1 data_type(size),

column_name2 data_type(size),

column_name3 data_type(size),

ALTER: The ALTER table is used for modifying the existing table object in the database.


ALTER TABLE table_name

 ADD column_name datatype

OR


ALTER TABLE table_name

DROP COLUMN column_name


b) DML (Data Manipulation Language): These statements are used to manipulate the data in records. Commonly used DML statements are INSERT, UPDATE, and DELETE.


The SELECT statement is used as a partial DML statement, used to select all or relevant records in the table.


c) DCL (Data Control Language): These statements are used to set privileges such as GRANT and REVOKE database access permission to the specific user.


Q #4) How do we use the DISTINCT statement? What is its use?


Answer: The DISTINCT statement is used with the SELECT statement. If the record contains duplicate values then the DISTINCT statement is used to select different values among duplicate records.


Syntax:


SELECT DISTINCT column_name(s)

 FROM table_name;


Q #5) What are different Clauses used in SQL?


Answer:


Clauses used in SQL


WHERE Clause: This clause is used to define the condition, extract and display only those records which fulfill the given condition.


Syntax:


SELECT column_name(s)

 FROM table_name

 WHERE condition;


GROUP BY Clause: It is used with a SELECT statement to group the result of the executed query using the value specified in it. It matches the value with the column name in tables and groups the end result accordingly.


Syntax:


SELECT column_name(s)

 FROM table_name

 GROUP BY column_name;


HAVING clause: This clause is used in association with the GROUP BY clause. It is applied to each group of results or the entire result as a single group. It is much similar to the WHERE clause but the only difference is you cannot use it without the GROUP BY clause


Syntax:


SELECT column_name(s)

 FROM table_name

 GROUP BY column_name

 HAVING condition;


ORDER BY clause: This clause is used to define the order of the query output either in ascending (ASC) or descending (DESC). Ascending (ASC) is set as the default one but descending (DESC) is set explicitly.


Syntax:


SELECT column_name(s)

 FROM table_name

 WHERE condition

 ORDER BY column_name ASC|DESC;


USING clause: USING clause comes in use while working with SQL JOIN. It is used to check equality based on columns when tables are joined. It can be used instead of the ON clause in JOIN.


Syntax:


SELECT column_name(s)

 FROM table_name

 JOIN table_name

 USING (column_name);