Coder Baba
2.42K subscribers
1.01K photos
23 videos
722 files
723 links
Everything about programming for beginners.
1 and only official telegram channel of CODERBABA India.

Content:
.NET Developer,
Programming (ASP. NET, VB. NET, C#, SQL Server),
& Projects
follow me https://linktr.ee/coderbaba
*Programming
*Coding
*Note
Download Telegram
Understanding the File Structure of Bootstrap 👆👆👆👆
1. What is the sequence of execution of the ASP.NET page life cycle?
The simple way is to remember SILVER.

S (It is not counted)
I (Init)
L (Load)
V (Validate)
E (Event)
R (Render)
2. What is the difference between a Hash Table and a Dictionary?
The main differences are listed below.

Dictionary:

Returns an error if the key does not exist
No boxing and unboxing
Faster than a Hash table

Hashtable:

Returns NULL even if the key does not exist
Requires boxing and unboxing
Slower than a Dictionary
What are the state management techniques used in .NET?
Client-side:

Hidden Field
View State
Cookies
Control State
Query Strings
Server-side

Session

In Proc mode
State Server mode
SQL Server mode
Custom mode

Application.
How to add a button dynamically to a grid view?
Button myButton = newButton();
myButton.Text = "Hai";
myGrid.Controls.Add(myButton);
How to find a control inside a GridView?
——————————————————-
Button btnTest = (Button) myGrid.Rows[0].Cells[1].Controls[1].FindControl("myButton ");
How to remove a constraint from a table in SQL Server?

ALTER TABLE MyTab DROP CONSTRAINT myConstraint
What is the difference between Java and JavaScript?
Answer

Java and JavaScript are both object-oriented programming languages, but JavaScript is an object-oriented scripting language. They are completely different programming languages with a small number of similarities. JavaScript is mainly used in Web pages. JavaScript follows almost all Java expression syntax and naming conventions. This is the main reason for calling it JavaScript. Unlike Java, JavaScript does not bother about the methods, variables, and classes. Java is much more complex than JavaScript. Let us compare Java and JavaScript in detail.

In Java, the source code is first converted into an intermediate code known as the byte. This byte code is non-readable by humans and is independent of any machine. Afterward, this byte code is interpreted by the interpreter (Java Virtual Machine). Since JavaScript is a scripting language, it is only interpreted. This is why making changes in a Java program are more complex than in a JavaScript program.
Java needs the Java Development Kit. JavaScript mainly requires a text editor.
Java is a strongly typed language. On the other hand, JavaScript is a loosely typed language.
JavaScript is a front-end language in a Web environment, whereas Java is a back-end language.
JavaScript is considered a part of the HTML file, so it is visible in the source file. Java applets are not a part of the HTML file, so they are not visible in the source file.
Java is very complex to learn due to its rules and restrictions, whereas JavaScript is easier to learn than Java.
The User Interface of JavaScript is developed in HTML and very easily understood. In contrast, the User Interface of Java is developed in AWT or Swing, which is very complex to understand.
The client side is more secure in Java compared to JavaScript.
Routines are known as methods and functions in Java and JavaScript.
Java supports Polymorphism, but JavaScript does not support Polymorphism.
Java uses classes and objects to make its code reusable easily, but this service is not available in JavaScript.
Advantages of JavaScript
Choose short and meaningful but readable variable names.
Avoid global variables whenever possible.
Use one global object to encapsulate any global variables you need.
Always use var to declare your variables.
Suppose you are using any loop like for each or while with the multiple statements, don’t forget to use starting curly braces and ending curly braces. Avoid starting and ending the curly braces if you are writing with a single statement.
Try to use the comments, if necessary, which will help you/others to understand better in later days.
Indent your code, so it’s readable.
Use curly braces to define the blocks of the code.
Comment your code.
Always end your statement with a semicolon.
Always write the statements in one line because if you split the statement into multiple lines, for each line, the compiler places a semicolon at the end of a line, which is wrong. Thus, you have to be more careful while writing.
If possible, try using Typescript/ JavaScript++ instead of JavaScript because it checks syntaxes at the compile time and supports OOPS features.
Maintains two kinds of JavaScript files, which are- a.Minimized files for production b.JavaScript file for development.
Be aware of an automatic semi-colon insertion that happens.
Use for each rather than for loop.
Maintain JavaScript files lightweight. Use a different JavaScript file. This can be possible for each functionality.
Declare the variables outside loops.
Reduce DOM operations.
e aware of the duplicate members (member field, member function).
Always place the script file reference at the end of the body tag.
Always separate JavaScript code from the HTML file.
Always use === comparison.
Always try to avoid Eval() because it decreases performance.
Always try to use {} instead of Object() because Object() decreases the performance.
If possible, use shorthand notations.
Use the Switch case instead of too many if-else blocks.
Use anonymous functions instead of naming the functions, if possible.
Cache your selectors in the variables for further use.
Do not mix CSS properties with JavaScript / JQuery. Instead, we can use CSS classes in JavaScript / JQuery.
Before writing any condition with the DOM element, first, check whether the DOM element is defined or not.
What is the difference between “Stored Procedure” and “Function”?
1. A procedure can have both input and output parameters, but a function can only have input parameters.
2. Inside a procedure we can use DML (INSERT/UPDATE/DELETE) statements. But inside a function we can't use DML statements.
3. We can't utilize a Stored Procedure in a Select statement. But we can use a function in a Select statement.
4. We can use a Try-Catch Block in a Stored Procedure but inside a function we can't use a Try-Catch block.
5. We can use transaction management in a procedure but we can't in a function.
6. We can't join a Stored Procedure but we can join functions.
7. Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section. But we can use a function anywhere.
8. A procedure can return 0 or n values (max 1024). But a function can return only 1 value that is mandatory.
9. A procedure can't be called from a function but we can call a function from a procedure.
What is difference between “Clustered Index” and “Non Clustered Index”?
1. A Clustered Index physically stores the data of the table in the order of the keys values and the data is resorted every time whenever a new value is inserted or a value is updated in the column on which it is defined, whereas a non-clustered index creates a separate list of key values (or creates a table of pointers) that points towards the location of the data in the data pages.
2. A Clustered Index requires no separate storage than the table storage. It forces the rows to be stored sorted on the index key whereas a non-clustered index requires separate storage than the table storage to store the index information.
3. A table with a Clustered Index is called a Clustered Table. Its rows are stored in a B-Tree structure sorted whereas a table without any clustered indexes is called a non-clustered table. Its rows are stored in a heap structure unsorted.
4. The default index is created as part of the primary key column as a Clustered Index.
5. In a Clustered Index, the leaf node contains the actual data whereas in a non-clustered index, the leaf node contains the pointer to the data rows of the table.
6. A Clustered Index always has an Index Id of 1 whereas non-clustered indexes have Index Ids > 1.
7. A Table can have only 1 Clustered Index whereas prior to SQL Server 2008 only 249 non-clustered indexes can be created. With SQL Server 2008 and above 999 non-clustered indexes can be created.
8. A Primary Key constraint creates a Clustered Index by default whereas A Unique Key constraint creates a non-clustered index by default.
What is the difference between the “DELETE” and “TRUNCATE” commands?
1. The DELETE command is used to remove rows from a table based on a WHERE condition whereas TRUNCATE removes all rows from a table.
2. So we can use a where clause with DELETE to filter and delete specific records whereas we cannot use a Where clause with TRUNCATE.
3. DELETE is executed using a row lock, each row in the table is locked for deletion whereas TRUNCATE is executed using a table lock and the entire table is locked for removal of all records.
4. DELETE is a DML command whereas TRUNCATE is a DDL command.
5. DELETE retains the identity of the column value whereas in TRUNCATE, the Identify column is reset to its seed value if the table contains any identity column.
6. To use Delete you need DELETE permission on the table whereas to use Truncate on a table you need at least ALTER permission on the table.
7. DELETE uses more transaction space than the TRUNCATE statement whereas Truncate uses less transaction space than DELETE statement.
8. DELETE can be used with indexed views whereas TRUNCATE cannot be used with indexed views.
9. The DELETE statement removes rows one at a time and records an entry in the transaction log for each deleted row whereas TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction log.
10. Delete activates a trigger because the operation is logged individually whereas TRUNCATE TABLE can't activate a trigger because the operation does not log individual row deletions.
What is the difference between the “WHERE” clause and the “HAVING” clause?

1. WHERE clause can be used with a Select, Update and Delete Statement Clause but the HAVING clause can be used only with a Select statement.
2. We can't use an aggregate function in the WHERE clause unless it is in a sub-query contained in a HAVING clause whereas we can use an aggregate function in the HAVING clause. We can use a column name in the HAVING clause but the column must be contained in the group by clause.
3. WHERE is used before the GROUP BY clause whereas a HAVING clause is used to impose a condition on the GROUP Function and is used after the GROUP BY clause in the query.
4. A WHERE clause applies to each and every row whereas a HAVING clause applies to summarized rows (summarized with GROUP BY).
5. In the WHERE clause the data that is fetched from memory depending on a condition whereas in HAVING the completed data is first fetched and then separated depending on the condition.
What is the difference between “Primary Key” and “Unique Key”?
1. We can have only one Primary Key in a table whereas we can have more than one Unique Key in a table.
2. The Primary Key cannot have a NULL value whereas a Unique Key may have only one null value.
3. By default, a Primary Key is a Clustered Index whereas by default, a Unique Key is a unique non-clustered index.
4. A Primary Key supports an Auto Increment value whereas a Unique Key doesn't support an Auto Increment value.
What is the difference between a “Local Temporary Table” and “Global Temporary Table”?

1. A Local Temporary Table is created by giving it a prefix of # whereas a Global Temporary Table is created by giving it a prefix of ##.
2. A Local Temporary Table cannot be shared among multiple users whereas a Global Temporary Table can be shared among multiple users.
3. A Local Temporary Table is only available to the current DB connection for the current user and are cleared when the connection is closed whereas a Global Temporary Table is available to any connection once created. They are cleared when the last connection is closed.
SQL Interview Questions Everyone Should Know

Questions are categorized into 20 groups based on their similarity as following:

1-Get duplicate records
2-Delete duplicate records
3-Get 1 to 100 Numbers
4-Get second highest salary
5-Get N'th highest salary
6-Alternative for TOP clause
7-Get Between and Greater than records
8-Get N last records
9-Department wise records
10-Create and copied table/data from another table
11-Get odd/even id records
12-Get max and min salaries
13-Get records with the same salary
14-Get 50% records
15-Get manager name for employees
16-Get employee name starting/ending with
17-Use of like
18-Group concept
19-Date related concept
20-Some random related and other concepts
Interview Question: “Where do you see yourself in 5 years?”

Interviewers ask this question not to reject you immediately but to understand:
Your career ambitions
Your fit with the company culture
Your drive and self-awareness
Your decision making


Here’s how you can respond ⬇️

💡Sample answer:
In 5 years, I see myself in a leadership role within this company, managing a team, and driving key initiatives. I'm passionate about the work we do here, and my goal is to become an expert in my field, known for delivering exceptional results. What excites me the most is the growth potential within this organization. I've seen several employees advance to influential positions, and I'm eager to follow in their footsteps. With my dedication, your mentorship, and the shared values of this company, I am confident in my ability to contribute to its ongoing success.
👍1