Revature Fresher Interview Questions with Answers 

This blog explains about Revature Fresher Interview Questions with Answers . It is given below :
____________________________________________________________________

1. What is Limit, Having Clause in SQL ?

A HAVING clause in SQL specifies that an SQL SELECT statement should only return rows where aggregate values meet the specified conditions. It was added to the SQL language because the WHERE keyword could not be used with aggregate functions.
The HAVING Clause enables you to specify conditions that filter which group results appear in the results.

The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause.

Syntax
The following code block shows the position of the HAVING Clause in a query.

SELECT
FROM
WHERE
GROUP BY
HAVING
ORDER BY
The HAVING clause must follow the GROUP BY clause in a query and must also precede the ORDER BY clause if used.
The SQL HAVING Clause
The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.

HAVING Syntax
SELECT column_name(s)
FROM table_name
WHERE condition
GROUP BY column_name(s)
HAVING condition
ORDER BY column_name(s);

_______________________________________________________________________________

2. What is Wrapper class in Java ?

Wrapper Classes in Java
A Wrapper class is a class whose object wraps or contains a primitive data types. When we create an object to a wrapper class, it contains a field and in this field, we can store a primitive data types. In other words, we can wrap a primitive value into a wrapper class object.

Need of Wrapper Classes

They convert primitive data types into objects. Objects are needed if we wish to modify the arguments passed into a method (because primitive types are passed by value).
The classes in java.util package handles only objects and hence wrapper classes help in this case also.
Data structures in the Collection framework, such as ArrayList and Vector, store only objects (reference types) and not primitive types.
An object is needed to support synchronization in multithreading.
public class WrapperExample1{
public static void main(String args[]){
//Converting int into Integer
int a=20;
Integer i=Integer.valueOf(a);//converting int into Integer
Integer j=a;//autoboxing, now compiler will write Integer.valueOf(a) internally

System.out.println(a+” “+i+” “+j);
}}
Output:

20 20 20
____________________________________________________________________

3. What are the advantages of html ? 

                                                      HTML

HTML refers to the HyperText Markup Language.

POINTS ABOUT HTML:
1. HTML is used to create webpages.
2. HTML used many tags to make a webpage. So it is a tag based language.
3. The tags of HTML are surrounded by angular bracket.
4. It can use wide ranges of colors,objects and layouts.
5. Very useful for beginners in web designing field.

Advantages of HTML:

 1.HTML is used to create webpages.
2. HTML used many tags to make a webpage. So it is a tag based language.
3. The tags of HTML are surrounded by angular bracket.
4. It can use wide ranges of colors,objects and layouts.
5. Very useful for beginners in web designing field.
6. First advantage it is widely used.
7. Every browser supports HTML language.
8. Easy to learn and use.
9. It is by default in every windows so you don’t need to purchase extra software.
_______________________________________________________________________________

4 . Explain about Joins in SQL ? 

The SQL Joins clause is used to combine records from two or more tables in a database. A JOIN is a means for combining fields from two tables by using values common to each.
There are different types of joins available in SQL −

INNER JOIN − returns rows when there is a match in both tables.

LEFT JOIN − returns all rows from the left table, even if there are no matches in the right table.

RIGHT JOIN − returns all rows from the right table, even if there are no matches in the left table.

FULL JOIN − returns rows when there is a match in one of the tables.

SELF JOIN − is used to join a table to itself as if the table were two tables, temporarily renaming at least one table in the SQL statement.

CARTESIAN JOIN − returns the Cartesian product of the sets of records from the two or more joined tables.
Consider the following two tables −

Table 1 − CUSTOMERS Table

+—-+———-+—–+———–+———-+
| ID | NAME | AGE | ADDRESS | SALARY |
+—-+———-+—–+———–+———-+
| 1 | Ramesh | 32 | Ahmedabad | 2000.00 |
| 2 | Khilan | 25 | Delhi | 1500.00 |
| 3 | kaushik | 23 | Kota | 2000.00 |
| 4 | Chaitali | 25 | Mumbai | 6500.00 |
| 5 | Hardik | 27 | Bhopal | 8500.00 |
| 6 | Komal | 22 | MP | 4500.00 |
| 7 | Muffy | 24 | Indore | 10000.00 |
+—-+———-+—–+———–+———-+
Table 2 − ORDERS Table

+—–+———————+————-+——–+
|OID | DATE | CUSTOMER_ID | AMOUNT |
+—–+———————+————-+——–+
| 102 | 2009-10-08 00:00:00 | 3 | 3000 |
| 100 | 2009-10-08 00:00:00 | 3 | 1500 |
| 101 | 2009-11-20 00:00:00 | 2 | 1560 |
| 103 | 2008-05-20 00:00:00 | 4 | 2060 |
+—–+———————+————-+——–+
Now, let us join these two tables in our SELECT statement as shown below.

SQL> SELECT ID, NAME, AGE, AMOUNT
FROM CUSTOMERS, ORDERS
WHERE CUSTOMERS.ID = ORDERS.CUSTOMER_ID;
This would produce the following result.

+—-+———-+—–+——–+
| ID | NAME | AGE | AMOUNT |
+—-+———-+—–+——–+
| 3 | kaushik | 23 | 3000 |
| 3 | kaushik | 23 | 1500 |
| 2 | Khilan | 25 | 1560 |
| 4 | Chaitali | 25 | 2060 |
+—-+———-+—–+——–+
Here, it is noticeable that the join is performed in the WHERE clause. Several operators can be used to join tables, such as =, <, >, <>, <=, >=, !=, BETWEEN, LIKE, and NOT; they can all be used to join tables. However, the most common operator is the equal to symbol.
_______________________________________________________________________________
5 . What is Constructor in Java ?

A constructor in Java is a block of code similar to a method that’s called when an instance of an object is created.

Constructors in Java
Constructors are used to initialize the object’s state. Like methods, a constructor also contains collection of statements(i.e. instructions) that are executed at time of Object creation.

When is a Constructor called ?
Each time an object is created using new() keyword at least one constructor (it could be default constructor) is invoked to assign initial values to the data members of the same class.

Constructor is invoked at the time of object or instance creation. For Example:

class Geek
{
…….

// A Constructor
new Geek() {}

…….
}

// We can create an object of above class
// using below statement. This statement
// calls above constructor.
Geek obj = new Geek();
Rules for writing Constructor:

Constructor(s) of a class must has same name as the class name in which it resides.
A constructor in Java can not be abstract, final, static and Synchronized.
Access modifiers can be used in constructor declaration to control its access i.e which other class can call the constructor.
How constructors are different from methods in Java?

Constructor(s) must have the same name as the class within which it defined while it is not necessary for the method in java.
Constructor(s) do not any return type while method(s) have the return type or void if does not return any value.
Constructor is called only once at the time of Object creation while method(s) can be called any numbers of time.
_______________________________________________________________________________
  6. What do you mean by Interface in Java ? 
Interface
An interface in java is a blueprint of a class. It has static constants and abstract methods.

The interface in Java is a mechanism to achieve abstraction. There can be only abstract methods in the Java interface, not method body. It is used to achieve abstraction and multiple inheritance in Java.

In other words, you can say that interfaces can have abstract methods and variables. It cannot have a method body.

Java Interface also represents the IS-A relationship.

It cannot be instantiated just like the abstract class.

Since Java 8, we can have default and static methods in an interface.

Since Java 9, we can have private methods in an interface.

Why use Java interface?
There are mainly three reasons to use interface. They are given below.

It is used to achieve abstraction.
By interface, we can support the functionality of multiple inheritance.
It can be used to achieve loose coupling.
Syntax:
interface <interface_name>{

// declare constant fields
// declare methods that abstract
// by default.
}
_______________________________________________________________________________

REFERENCES :

http://www.maharashtraspider.com/resources/5197-Advantage-Disadvantage-HTML.aspx

https://www.geeksforgeeks.org/wrapper-classes-java/

https://www.javatpoint.com/wrapper-class-in-java

https://www.javatpoint.com/interface-in-java

https://www.geeksforgeeks.org/constructors-in-java/

https://www.tutorialspoint.com/sql/sql-using-joins.htm

_______________________________________________________________________________