MVI Technology Fresher Interview Questions with Answers

This blog explains about  MVI Technology Fresher Interview Questions with Answers and is given below :

1. What is final ?

Final Keyword In Java
The final keyword in java is used to restrict the user. The java final keyword can
be used in many context. Final can be:

The final keyword can be applied with the variables, a final variable that have no
value it is called blank final variable or uninitialized final variable. It can be
initialized in the constructor only.

2. What is static

Java static keyword
The static keyword in Java is used for memory management mainly. We can apply java
static keyword with variables, methods, blocks and nested class. The static keyword
belongs to the class than an instance of the class.

The static can be:

Variable (also known as a class variable)
Method (also known as a class method)
Nested class
Static in Java

3. .equals and == equals Explain?

Difference between == and .equals() method in Java
In general both equals() and “==” operator in Java are used to compare objects to
check equality but here are some of the differences between the two:

Main difference between .equals() method and == operator is that one is method and
other is operator.
We can use == operators for reference comparison (address comparison) and .equals()
method for content comparison. In simple words, == checks if both objects point to
the same memory location whereas .equals() evaluates to the comparison of values in
the objects.
If a class does not override the equals method, then by default it uses equals
(Object o) method of the closest parent class that has overridden this method. See
this for detail
Coding Example:

// Java program to understand
// the concept of == operator
public class Test {
public static void main(String[] args)
String s1 = new String(“HELLO”);
String s2 = new String(“HELLO”);
System.out.println(s1 == s2);


4.Jdbc connection?

Java Database Connectivity with MySQL
To connect Java application with the MySQL database, we need to follow 5 following

In this example we are using MySql as the database. So we need to know following
informations for the mysql database:

Driver class: The driver class for the mysql database is com.mysql.jdbc.Driver.
Connection URL: The connection URL for the mysql database is
jdbc:mysql://localhost:3306/sonoo where jdbc is the API, mysql is the database,
localhost is the server name on which mysql is running, we may also use IP address,
3306 is the port number and sonoo is the database name. We may use any database, in
such case, we need to replace the sonoo with our database name.
Username: The default username for the mysql database is root.
Password: It is the password given by the user at the time of installing the mysql
database. In this example, we are going to use root as the password.

5.Primary key, unique key, foreign key,

Primary Key
Primary key cannot have a NULL value.
Each table can have only one primary key.
By default, Primary key is clustered index, and the data in database table is
physically organized in the sequence of clustered index.
Primary key can be related to another tables as a Foreign Key.
We can generate ID automatically with the help of Auto Increment field. Primary key
supports Auto Increment value.
We can define Primary key constraint on temporary table and table variable.
We can’t delete primary key value from the parent table which is used as a foreign
key in child table. To delete we first need to delete that primary key value from
the child table.

Unique Key
Unique Constraint may have a NULL value.
Each table can have more than one Unique Constraint.
By default, Unique key is a unique non-clustered index.
Unique Constraint can not be related with another table’s as a Foreign Key.

Foreign Key
Foreign key is a field in the table that is Primary key in another table.
Foreign key can accept multiple null value.
Foreign key do not automatically create an index, clustered or non-clustered. You
can manually create an index on foreign key.
We can have more than one foreign key in a table.
Foreign keys do not automatically create an index, clustered or non-clustered. You
must manually create an index on foreign keys.
Having a null foreign key is usually a bad idea instead of NULL referred to as
“orphan record”.
We can’t define foreign key constraint on temporary table or table variable.
We can delete the foreign key value from the child table even though that refers to
the primary key of the parent table.


Collections in Java
Java Collection Framework
Hierarchy of Collection Framework
Collection interface
Iterator interface
The Collection in Java is a framework that provides an architecture to store and
manipulate the group of objects.

Java Collections can achieve all the operations that you perform on a data such as
searching, sorting, insertion, manipulation, and deletion.

Java Collection means a single unit of objects. Java Collection framework provides
many interfaces (Set, List, Queue, Deque) and classes (ArrayList, Vector,
LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet).

7.Write a Java Program for 
1.words count, first and last to find vowels or not

Program to count vowels, consonants, digits and spaces
public class Count {

public static void main(String[] args) {
String line = “This website is aw3som3.”;
int vowels = 0, consonants = 0, digits = 0, spaces = 0;

line = line.toLowerCase();
for(int i = 0; i < line.length(); ++i)
char ch = line.charAt(i);
if(ch == ‘a’ || ch == ‘e’ || ch == ‘i’
|| ch == ‘o’ || ch == ‘u’) {
else if((ch >= ‘a’&& ch <= ‘z’)) {
else if( ch >= ‘0’ && ch <= ‘9’)
else if (ch ==’ ‘)

System.out.println(“Vowels: ” + vowels);
System.out.println(“Consonants: ” + consonants);
System.out.println(“Digits: ” + digits);
System.out.println(“White spaces: ” + spaces);
When you run the program, the output will be:

Vowels: 6
Consonants: 11
Digits: 3
White spaces: 3

2.duplicate not allowed but insertion order must be preserved.

Most of the Java Collections can be extended for tweaking.

Subclass LinkedHashSet, overriding the add method.

class TweakedHashSet<T> extends LinkedHashSet<T> {

public boolean add(T e) {
// Get rid of old one.
boolean wasThere = remove(e);
// Add it.
// Contract is “true if this set did not already contain the specified
return !wasThere;