What is LinkedList and an example in Java?

What is LinkedList and an example in Java?

LinkedList is a linear collections of data elements.

     // Declaring LinkedList

       LinkedList<String> abclinked = new LinkedList<String>();

 

 

       abclinked.add(“a”);

       abclinked.add(“b”);

       abclinked.add(“c”);

   

system.out.println(“the linked list is ” + abclinked )

 

 

Linked Lists are Dynamic size and this feature certainly has an endge over Array. insertion and deletion also possible for Linked Lists which may not be done on Array which is already defined.

 

 

The downside of Linked Lists is that the extra memory space for a pointer is required with each element of the list. Also accessing elements are sequential manner starting from the first node is difficult.

How to reverse an array in java – Please click here

What is Thanksgiving?

What is Thanksgiving?

Thanksgiving is a national holiday of USA, Canada etc. In USA, it is celebrated on 4th Thursday of November. This day is to give thanks for the blessing of the harvest. Modern Thanksgiving has been changed a lot. Everyone are curious about the Thanksgiving deals 🙂 and it has been well celebrated as a holiday. Most of the organization gives holidays on 4th Thursday & Friday of November making it a long weekend. One can look for Thanksgiving recipes, deals, restaurants to make the holidays more enjoyable.

What is DevOps?

What is DevOps?

DevOps is the latest Development Methodology where Dev team and Operations team are collaborated for better productivity , Improving the time to market of the product releases etc.

DevOps uses lots of tool like Git for Version controlling , Jenkins for Integrating multiple DevOps tools, helps on better communications between Developers, Testers, Operations team etc. Selenium is another tool used as part of DevOps which is a test automation and Jenkins controls and manages Selenium execution.

Puppet is another DevOps tool used for configuration management. Configuration script will be stored in puppet server and puppet agents on various VMs or target machines will be communicating puppet master. There are build management tools like Maven will be part of DevOps. Nagios is another DevOps tool which monitors systems, servers, infrastructures to make sure the deployed applications are running on production servers without any issues.

For testing specific requirements, Jenkins will help to send notification to Tester when a build is available for testing. Jenkins will trigger the selenium scripts and after execution, the results will be send out to target users including developers, management teams etc.

 

How to use JMeter for login authentication?

How to use JMeter for login authentication?

Regular Expression Extractor is used to handle this situation. Following steps may be used,

  1. First find out the GET request where the authentication required & POST request that posts the credential to login
  2. The response from the GET request should have tokens which needs to be be extracted and sent as a parameter in the POST request.
  3. Add a Regular Expression Extractor to store these tokens and include the tokens as parameter in the POST request

What is polymorphism in java with example

What is polymorphism in java with example

polymorphism means one object can take multiple forms. lets explain this using a method poly() in java class.

steps:

  1. create a package polymorphismPkg in eclipse
  2. create a class polymorphismClass  in eclipse
  3. now write below code in the class polymorphismClass  

package polymorphismPkg;

public class polymorphismClass {

public static void main(String[] args) {

polymorphismClass obj1 = new polymorphismClass();

obj1.poly(1, 2);
obj1.poly(1, 2, 3);
obj1.poly(1, 22.11);

}

public static void poly(int a, int b)

{
System.out.println(“this is first method for polymorphism”);
}

public static void poly(int n, int b, int c)

{
System.out.println(“this is like first method but number of argument is different in signature “);

}

public static void poly(int n, double b)

{
System.out.println(“this is like first method but argument order is different in the signature “);

}

}

 

 

 

What is Inheritance in Java with example

What is Inheritance in Java with example

One class in Java can get the methods and properties from other class – this helps reducing the coding efforts , increase code reusability and maintainability.

e.g. 

public class classB extends classB {

}

in the above Java code, classB class gets the methods and properties from classA class.

steps,

  1. create a meaningful project and a package in eclipse
  2. create 2 classes classA and classB under the package (Codes are below)

Code for classA class as below:

package inheritancePkg;

public class classA {

public void A()

{

System.out.println(“this is from father class”);
}

}

 

Code for classB class as below:

package inheritancePkg;

public class classB extends classA // extends classA is inheritance from classA class to classB

// so we are able to write obj1.add() from father.

{
public static void main(String[] args)
{

classB obj1 = new classB();
obj1.A();
obj1.B();

}

public void B()

{
System.out.println(“this is from son class “);

}

}

 

Top 5 sql interview questions and answers

Top 5 sql interview questions and answers

What is DDL, DML, DCL, TCL in SQL ?

DDL refers to Data Definition language. DDL is used to create/modify the structure of Database. e.g. CREATE, ALTER, DROP statement..

DML refers to Data Manipulation language. DML is used to retrieve, modify, delete, insert and update data in database. e.g. SELECT, UPDATE, INSERT statement

DCL refers to Data Control Language. DCL is used to create roles, permissions, and control access to database. e.g. GRANT, REVOKE statement.

TCL refers to Transactional Control Language. TCL is used to manage different transactions occurring within a database. e.g COMMIT, ROLLBACK statement

What is the difference between UNION vs UNION ALL?

          UNION and UNION ALL are used for merging two tables which has similar structure.

the difference between UNION and UNION ALL is that the UNION removes the duplicates while merging tables but UNION ALL do not and retain all duplicates.

UNION is slower in performance  as it has additional task of removing duplicates which causes more time in  execution.

What is the difference between query and subquery?

A Query is a code written to fetch information from the database where as subquery is a query within another query.  Basically subquery is an inner query. SubQuery is designed to executed first. The result of subquery is passed on to the main query which then process using the subquery output.

What is a stored procedure?

Stored Procedure is a function having several SQL statements. Stored procedure can be executed to process all SQL statements in it.

What is the difference between WHERE clause and HAVING clause?

Both WHERE and HAVING are used for filtering out records based conditions. WHERE clause can only be applied for static non-aggregated column whereas HAVING for aggregated columns.
SELECT * FROM Cricketbat WHERE batlenght > 2 feet
SELECT COUNT(Cricketbat)
FROM Bat
GROUP BY Team
HAVING COUNT(Cricketbat) > 2 feet;

What is DELETE and TRUNCATE commands?

DELETE command is used to remove selected rows from a table. A WHERE clause can be used to specify the rows to be deleted

 

What is difference between select and select distinct

Top 5 Salesforce Interview questions

Top 5 Salesforce Interview questions

1. What is object in salesforce?

Objects are database tables used to store specific data. There are two types of objects. 1. Standard objects 2. Custom objects.

2. What are different types of relationship in salesforce?

There are two different types of relationship in salesforce.
1. Master detail relationship
2. Lookup relationship

3. What is a trigger in salesforce ?

A Trigger is a code that is executed before or after a record is inserted or updated.

4. How many reports can be added to salesforce dashboard ?

20

5. What is validation rule ?

While creating or modifying a record, based on certain conditions validation rule helps to display error message.

6. What are escalation rules in sales force?

Escalation rules can be created on sales force case object and based on priority escalation emails can be sent.

Top 20 sql interview questions and answers

Top 20 sql interview questions and answers

What is DDL, DML, DCL, TCL in SQL ?

DDL refers to Data Definition language. DDL is used to create/modify the structure of Database. e.g. CREATE, ALTER, DROP statement..

DML refers to Data Manipulation language. DML is used to retrieve, modify, delete, insert and update data in database. e.g. SELECT, UPDATE, INSERT statement

DCL refers to Data Control Language. DCL is used to create roles, permissions, and control access to database. e.g. GRANT, REVOKE statement.
TCL refers to Transactional Control Language. TCL is used to manage different transactions occurring within a database. e.g COMMIT, ROLLBACK statement

What is the difference between UNION vs UNION ALL?

          UNION and UNION ALL are used for merging two tables which has similar structure.

the difference between UNION and UNION ALL is that the UNION removes the duplicates while merging tables but UNION ALL do not and retain all duplicates.

UNION is slower in performance  as it has additional task of removing duplicates which causes more time in  execution.

What is the difference between query and subquery?

A Query is a code written to fetch information from the database where as subquery is a query within another query.  Basically subquery is an inner query. SubQuery is designed to executed first. The result of subquery is passed on to the main query which then process using the subquery output.

What is a stored procedure?

Stored Procedure is a function having several SQL statements. Stored procedure can be executed to process all SQL statements in it.

What is the difference between WHERE clause and HAVING clause?

Both WHERE and HAVING are used for filtering out records based conditions. WHERE clause can only be applied for static non-aggregated column whereas HAVING for aggregated columns.
SELECT * FROM Cricketbat WHERE batlenght > 2 feet
SELECT COUNT(Cricketbat)
FROM Bat
GROUP BY Team
HAVING COUNT(Cricketbat) > 2 feet;

What is DELETE and TRUNCATE commands?

DELETE command is used to remove selected rows from a table. A WHERE clause can be used to specify the rows to be deleted

What is TRUNCATE commands?

TRUNCATE is used for removing all rows from the table. Truncate operation cannot be reversed but but delete can be reversed/rollback.

What is Log Caches of SQL Server?

Log cache is a memory pool allocated to read/write the log pages. A group of cache pages are available in each log cache.

What is Inner join?

Inner join is used for returning rows when there is at least one match of rows between the tables used in the inner join query.

What is Full Join?

Full join is used for returning all the rows from the left side table and all the rows from the right side table.

What is Right Join?

Right join return all rows of Right hand side table and matched rows in left hand table. Non matched rows will show null values for left had side.
Simply, it returns all the rows from the right hand side table even though there are no matches in the left hand side table.

What is Left Join?

Left join return all rows of Left hand side table and matched rows in right hand table. Non matched rows will show null values for right hand side.

What are the SQL MAX() and MIN() Functions?

The MAX() function returns the largest value in the selected column.

The MIN() function returns the smallest value in the selected column.

SELECT MAX(Weight) AS LargestWeight

FROM CricketBats;

SELECT MIN(Weight) AS SmallestWeight

FROM CricketBats;

What are the SQL AVG(), COUNT() and SUM() Functions

The SQL AVG() function returns the average value in a numeric values column.

e.g.

SELECT AVG(Weight)

FROM Cricketbats;

The SQL COUNT() function returns the number of rows count that matches with a specified criteria.

SELECT COUNT(ProductID)

FROM Cricketbats;

The SQL SUM() function returns the total sum of a numeric values in a specific column.

e.g

SELECT SUM(Weight)

FROM Cricketbats;

What is SQL UPDATE Statement?

The SQL UPDATE statement is used for modifying the existing records in the selected table.

e.g as below:

UPDATE Users

SET UserContactName=’First name Last name’, City=’City1′

WHERE UserID=1;

What is SQL ORDER BY Keyword?

The purpose of ORDER BY keyword is to sort the results in ascending or descending order.

example for ascending order

SELECT * FROM Users

ORDER BY State ASC;

or

SELECT * FROM Users

ORDER BY State;

example for descending order

SELECT * FROM Users

ORDER BY State DESC;

What is a NULL Value in SQL?

NULL values can not be compared using operators =, <, or <> so we will need to use the “IS NULL” or “IS NOT NULL” operators instead.

SELECT UserName, UserContactName, Address FROM Persons

WHERE Address IS NULL;

SELECT UserName, UserContactName, Address FROM Persons

WHERE Address IS NOT NULL;

What is SQL INSERT INTO Statement?

The INSERT INTO statement is used for inserting new records to a table.

e.g.

INSERT INTO Users (UserName, UserContactName, UserAddress, City, ZipCode, State, Country)

VALUES (‘Test1′,’Firstname last name’,’address 1, 2,3 ‘,’City namer’,’99999′,’Statename’,’Countryname’);

What is SQL INSERT INTO SELECT Statement?

The SQL INSERT INTO SELECT statement is used for copying data from one table and then to insert to someother table.

e.g. as below:

INSERT INTO Users (UserName, UserCity, Country)

SELECT VendorName, VendorCity, Country FROM Vendors;

What is the SQL DELETE Statement?

The SQL DELETE statement is used for deleting the existing records in the selected table.

e.g as below:

DELETE FROM Users

WHERE UserName=’Firstname1 Lastname1′;

What is AND, OR and NOT Operators in SQL?

AND, OR, and NOT operators are combined with the WHERE clause to get the desired filtered results.

e.g

SELECT * FROM Users

WHERE State =’illinois’ AND City=’Chicago’;

SELECT * FROM Users

WHERE City=’Chicago’ OR City=’New York’;

SELECT * FROM Users

WHERE NOT State =’Chicago’;

What is SQL WHERE Clause?

SQL WHERE clause is used to filter records and its added as below

e.g.

SELECT States FROM Users where Usersgroup = ‘1’;

What is the SQL SELECT TOP Clause ?

The SELECT TOP clause is used to specify the number of records to return.

e.g as below:

SELECT TOP 100 * FROM Users;