Capgemini Java interview questions

Capgemini Java interview questions
Download Capgemini Java interview questions PDF

Below are the list of Best Capgemini Java interview questions and Answers

The major features of Java are listed below: –

  • Object-oriented: – Java language is based on object-oriented programming. In this, the class and the methods describe the state and behavior of an object. The programming is done by relating a problem with the real world object.
  • Portable: – the conversion of java program into Java bytecodes take place. This helps in running the program in any environment or platform without any dependency.
  • Platform independent: – java ensures “write once run anywhere” as its programs can be run on multiple platforms like- Windows, Mac, Sun Solaris, Linux, etc.
  • Robust: – java’s strong memory due to no pointer allocations, make it robust. The memory leaks are prohibited with the help of automatic garbage collection in java.
  • Interpreted: – the java code is converted into bytecodes by the java compiler which is then interpreted and executed by the Java interpreter or a just-in-time compiler (JIT).

In SQL, normalization of data is a process through with data is organized in tables used for the reduction of redundancy and dependency of data. It divides large tables into smaller ones using some set of rules.

Types of normalization:

  • 1NF: The rules of 1NF are that each table must contain a single value and records are required to be unique.
  • 2NF: The rules of 2NF are that the table must be in 1NF and must possess a single-column primary key.
  • 3NF: The rules of 3NF are that the table must be in 2NF and must not have any transitive functional dependencies.
  • BCNF: The rules of the Boyce Codd Normal form is that it must be in 3 NF and must not have more than one candidate key.

Difference between Class and object In JAVA:

  • Class - A class is like a blueprint. It is the class with the help of which objects are created. The class holds together data and methods in one single unit. And the class needs to be declared only a single time.
  • Object - This is an instance of the class. It is with the help of an object that data and methods that exist within a class can be used. Objects can be called upon several times as and when required.

Inversion of control is a design pattern that is used for decoupling components and layers of a system. Inversion of control(IOC) is implemented through injecting dependencies into a component when it is constructed.

Spring MVC is a framework of Java used for developing web applications. It follows the design pattern of Model-View-Controller. A spring MVC gives an optimum solution to use the spring framework along with MVC. To do so, it takes the help of the DispatcherServlet that receives the incoming request and then implements it to a suitable resource including controllers, views, and models. Spring MVC has a number of advantages such as rapid development and ease of testing.

Design patterns can be explained as a general repeatable solution to a problem that is occurring commonly in large numbers during the designing of the software. Design patterns are not considered as a finished design and cannot be directly converted into code. It can be defined as a description or a template that depicts how to solve a problem that is occurring in different situations. It speeds up the development process.

In SQL, a cursor can be defined as a tool used widely to define a particular set of results. This result can be a set of data rows. A cursor is basically used to solve complex logic and works on a row by row manner.

Index, on the other hand, has the main function of retrieving data from tables much quicker. Indexes are created by users on columns that may be accessed frequently. This enables the user to get information quickly from the table and can be created on a single column or even a group.

JVM stands for Java Virtual Machine. JVM can be explained as an engine that is used by the Java Development Kit to provide a runtime environment to run java code or its applications. The main function of JVM is that it is used for converting Java bytecode into machine language. It is an integral part of the Java Runtime Environment. It works on “Write once, run anywhere” principle and manages the program memory.

A number that is divisible by 1 or itself is a Prime Number. 2, 3, 5, 7, 11, 13, 17 are examples of some Prime numbers.

Please Note: 0 and 1 are not a prime number.

Below is a simple Prime number Program in Java to check a number is Prime or Not.

import java.util.Scanner;
public class PrimeExample {
 public static void main(String args[]) {
  int i, m = 0, flag = 0;
  Scanner scan = new Scanner(System.in);
  System.out.print("Enter any number: ");
  // This method reads the number provided using keyboard
  int num = scan.nextInt();
  // Closing Scanner after the use
  scan.close();
  m = num / 2;
  if (num == 0 || num == 1) {
   System.out.println(num + " is not prime number");
  } else {
   for (i = 2; i <= m; i++) {
    if (num % i == 0) {
     System.out.println(num + " is not prime number");
     flag = 1;
     break;
    }
   }
   if (flag == 0) {
    System.out.println(num + " is prime number");
   }
  } //end of else
 }
}

Structs is a framework in Java. The use of this framework is for the development of the Java enterprise edition purpose. It is an open-source framework. This is a very reliable and efficient working framework. In order to introduce the MVC which is known as the model view controller, it makes use of the Java servlet API and also it extends its functions for more results. It later became one of the best frameworks that were designed in the Apache project.

Mutable classes are the classes that are being prepared can change its internal state anytime without any issue. Also, it can change the state even after it has been already developed. The classes here are not the ones that are actually mutable. But the object that consists inside it, they are actually the mutated ones. Until we can prevent it from any change after it has been developed. It also depends strongly on the language that is being used.