Posts

Showing posts from November, 2020

JDBC connection code / Java Database Connection

Image
 
Image
 

Reverse a String in Java

Image
Using In-built reverse() method of StringBuilder Class: String Class does not have in-built reverse method.  

How do you test a software or a feature without any requirement?

 1. Exploratory Testing: In this type of testing the Test design and execution happen simultaneously. The tester can explore different paths in the application and note down those test cases. 2. Error Guessing: Based on previous experience with similar software or feature, the tester can draw out some test cases and execute them. 3. Ad-Hoc testing: This is the most simple type of testing. This is an unplanned test. There are different types of Ad-Hoc testing:  - Monkey testing: Here you test to break the software by clicking anywhere on the screen. - Pair testing: Here 2 testers are assigned the same module for testing. They can share their ideas on the feature and draw out some test cases and also execute them together. - Buddy Testing: Here a Developer and a Tester are assigned one Module and they try to understand the working of that module. 4. Catch the Developers and QA Team members: Talk to the Devs and QAs who have worked previously on that piece of software. 5. Explore other ar

Github Tutorials

Image
Tutorial 01: Github is a distributed source code version system. - It stores revisions to a project History in just one directory. - One can rewind to any revision they want to - Work on new features without messing up the main code base (by using branching) - Makes it easier to collaborate with other developers. (Each person has it's own copy of the project on their local machines.) Tutorial 02: Configuring Git for the first time: 1. To Check git version: cmd: git --version 2. Configure user: cmd: git config --global user.name krunalkadu git config --global user.email krunalkadu.01@gmail.com 3. To check the username with which you are currently logged in: git config user.name 4. To list files in a directory: cmd: ls 5. Create a file: cmd: touch index.html 6. Delete a file: rm index.html Commits are like Savepoints. One can later rewind to a previous savepoint/commit When you are done changes to a file and you want to commit it later, you can move it to staging and then commit it l

Program to find greatest of 3 numbers

  public class JavaExample { public static void main ( String [] args ) { int num1 = 10 , num2 = 20 , num3 = 7 ; if ( num1 >= num2 && num1 >= num3 ) System . out . println ( num1 + " is the largest Number" ); else if ( num2 >= num1 && num2 >= num3 ) System . out . println ( num2 + " is the largest Number" ); else System . out . println ( num3 + " is the largest Number" ); } }

Java Set

 Source: https://www.programiz.com/java-programming/set

Java Queue

 Source: https://www.programiz.com/java-programming/queue

Java Map

Refer following source:  https://www.programiz.com/java-programming/map

List in Java

Image
 Source: https://facingissuesonit.com/2019/10/15/java-collection-framework-hierarchy/ Java List interface is a member of the Java Collections Framework. List allows you to add duplicate elements. List allows you to have ‘null’ elements. List interface got many default methods in Java 8, for example replaceAll, sort and spliterator. List indexes start from 0, just like arrays. Java List Methods Some of the useful Java List methods are; int size() : to get the number of elements in the list. boolean isEmpty() : to check if list is empty or not. boolean contains(Object o) : Returns true if this list contains the specified element. Iterator<E> iterator() : Returns an iterator over the elements in this list in proper sequence. Object[] toArray() : Returns an array containing all of the elements in this list in proper sequence boolean add(E e) : Appends the specified element to the end of thi

Java Collections Hierarchy

Image
 

Code Coverage

  Code coverage is a measurement of how many lines/blocks/arcs of your code are executed while the automated tests are running. Code coverage is collected by using a specialized tool to instrument the binaries to add tracing calls and run a full set of automated tests against the instrumented product. A good tool will give you not only the percentage of the code that is executed, but also will allow you to drill into the data and see exactly which lines of code were executed during a particular test.

Statement, Branch and Condition(Path) Coverage

 https://sqa.stackexchange.com/questions/20226/how-do-we-calculate-statement-coverage-branch-coverage-path-coverage-and-cond

Six Very Important SQL Queries

 1. Select The Employee from Employee table with the highest salary  SELECT Employee_Name FROM Employees  WHERE SALARY = (SELECT MAX(Salary) FROM Employees); 2. Select All employees with same salary in Employee table: Here, we use SELF JOIN: SELECT * FROM Employee A, Employee B WHERE A.Emp_ID <> B.Emp_ID  AND A.Salary=B.Salary 3. SELECT the second Highest Salary from Employee table: 4. SELECT range of Employee based on ID: SELECT * FROM Employees  WHERE Emp_ID BETWEEN 1000 and 2000; 5. SELECT Employee_name, Highest Salary and Department: SELECT EMP.Emp_Name, DEPT.Department_Name, EMP.Salary FROM Employees EMP INNER JOIN Department DEPT  ON EMP.EMP_ID=DEPT.EMP_ID WHERE EMP.Salary IN (SELECT MAX(Salary) from Employees) 6. SELECT Highest Salary, Employee Name and DepartmentName from each department: SELECT DEPT.Department_Name, EMP.Emp_Name, MAX(EMP.Salary) FROM  Employees EMP INNER JOIN Department DEPT ON EMP.EmpId=DEPT.EmpID GROUP BY DEPT.Department_Name, EMP.Emp_Name;

DDL, DQL, DML, DCL and TCL Statements in SQL

Image
 All statements in SQL are divided into 5 different categories: DDL, DQL, DML, DCL and TCL