Join Regular Classroom : Visit ClassroomTech

Deloitte Overall Interview Questions + Coding Solutions – codewindow.in

Hot Topics

Deloitte Solution

Technical Round

How would you rate your Java skills?

You can rate yourself on the basis of how comfortable with Java you are. But don’t rate yourself too high or too low and rate yourself on 5.
You can say 3.5 out of 5.

What are the four pillars of Java?

The 4 pillars of JAVA are:

  • Inheritance: It is a concept of Object Oriented Programming in which a new class is created from the existing one.

  • Polymorphism: Poly means many and morph means form. A concept that enables programmers to assign a different meaning or usage to a variable, function or an object in different context.

 

Polymorphism can be of two types:

  1. Runtime Polymorphism

  2. Compile Time Polymorphism

  • Abstraction: Creating a new data type using encapsulated items that is well suited for an application.

  • Encapsulation: It is called data hiding and encapsulation is the way of packing data and function into a single unit to hide the implementation details of a class from outer world.

Suppose I am a student who has no idea of coding. How would you explain the concept of inheritance to me?

Inheritance is a concept by which a child gets access to the parent properties. For example you will get wealth of your parents but you won’t get wealth from someone else’s parent.

What is multi-threading in Java?

Multi-threading in Java refers to the execution of more than one thread simultaneously for maximum utilization of CPU.

Given an array and n value. How will you reverse the array up to n value?

Here’s an example of reversing an array up to a given n value in C:
#include<stdio.h>
 
void reverseArray(int arr[], int n)
{
    int i, temp;
    for (i = 0; i < n/2; i++)
    {
        temp = arr[i];
        arr[i] = arr[n-i-1];
        arr[n-i-1] = temp;
    }
}
 
void printArray(int arr[], int size)
{
    int i;
    for (i=0; i < size; i++)
        printf("%d ", arr[i]);
    printf("\n");
}
 
int main()
{
    int arr[] = {1, 2, 3, 4, 5, 6};
    int n = 4;
 
    printf("Original array: \n");
    printArray(arr, n);
 
    reverseArray(arr, n);
 
    printf("Reversed array up to %d: \n", n);
    printArray(arr, n);
 
    return 0;
}
/*
OUTPUT - 

Original array: 
1 2 3 4 
Reversed array up to 4: 
4 3 2 1 
*/

Write a program for maximum sum subarray.

#include<iostream> 
using namespace std;

int maxSum(int arr[],int n){
    int MAX=INT_MIN;
    int sum=0;
    
    for(int i=0;i&lt;n;i++){
        sum+=arr[i];
        MAX=max(sum,MAX);
        if(sum&lt;0){
            sum=0;
        }
    }
    return MAX;
}

int main() {
    int n;
    cout&lt;&lt;&quot;Enter the length of array:&quot;&lt;&gt;n;
    int arr[n];
    
    cout&lt;&lt;&quot;Enter the values in the array&quot;&lt;&lt;endl;
    for(int i=0;i&gt;arr[i];
    }
    
    int s=maxSum(arr,n);
    cout&lt;&lt;&quot;Maximum contiguous sum is: &quot;&lt;&lt;s;

    return 0;
}

/*
INPUT:
Enter the length of array:
8
Enter the values in the array
-2 -3 4 -1 -2 1 5 -3

OUTPUT:
Maximum contiguous sum is: 7
*/

What is normalization and what are its types?

Normalization is process to analyse the given relational schemas based on their functional dependencies and primary key to minimize data redundancy and minimize insertion, deletion and update anomalies.
Types of normalization:
  • 1NF
  • 2NF
  • 3NF
  • BCNF
  • 4NF
  • 5NF

What are ACID properties?

ACID properties provides the mechanism to make a database consistent and to ensure integrity of data.
  • Atomicity: It states that either all the operations in a transaction should be reflected in the database or none should be reflected in database. E.g. If a transaction gets any obstruction during processing then it would restart itself from the very first stop.
  • Consistency: Before a transaction start and after a transaction is completed the sum should remain same.
  • Isolation: Converting parallel schedule to serial schedule to gain consistent schedule.
  • Durability: All changes in the database should be permanent.

What is a VPN?

VPN stands for virtual private network which is used for personal or work usage. It provides a private network which makes a connection more secure while working on a public network.

What is virtual memory?

Virtual memory is a technique in operating system by which secondary memory can be addressed as it was a part of main memory.

What is abstraction?

Abstraction refers to the quality of dealing with ideas rather than events. It’s basically deals with hiding the details and showing the essential things to the user. Thus you can say that abstraction in Java is the process of hiding the implementation details from the user and revealing only the functionality to them. Abstraction can be achieved in two ways:
  • Abstract classes
  • Interfaces

What is paging?

Paging is concept in which we divide a process in equal size of pages and put it into frames of main memory.

What is function overriding?

Function overriding happens when a child class has same function as parent class.

You have a student names table and marks obtained table. Write a query to find the highest, second highest and so on marks.

Oracle
    SELECT name, MAX(salary) AS salary FROM employee WHERE salary <> (SELECT MAX(salary) FROM employee);
  • OR
Common Table Expression 
WITH T AS ( SELECT * DENSE_RANK() OVER (ORDER BY Salary Desc) AS Rnk FROM Employees) SELECT Name FROM T WHERE Rnk=n;

 Explain bubble sorting algorithm along with code.

Here’s an example of the bubble sort algorithm in C:
#include<stdio.h>
 
void swap(int *xp, int *yp)
{
    int temp = *xp;
    *xp = *yp;
    *yp = temp;
}
 
void bubbleSort(int arr[], int n)
{
   int i, j;
   for (i = 0; i < n-1; i++)      
       for (j = 0; j < n-i-1; j++) 
           if (arr[j] > arr[j+1])
              swap(&arr[j], &arr[j+1]);
}
 
void printArray(int arr[], int size)
{
    int i;
    for (i=0; i < size; i++)
        printf("%d ", arr[i]);
    printf("\n");
}
 
int main()
{
    int arr[] = {64, 34, 25, 12, 22, 11, 90};
    int n = sizeof(arr)/sizeof(arr[0]);
    bubbleSort(arr, n);
    printf("Sorted array: \n");
    printArray(arr, n);
    return 0;
}
/*
OUTPUT - 
Sorted array: 
11 12 22 25 34 64 90
*/

What is primary key and foreign key?

Primary key is a constraint in database that helps us to uniquely identify each record in the table and should not contain NULL values.
Foreign key is an attribute or a set of attributes that references to primary key of the same table or another table

What are joins in DBMS?

Joins in DBMS can be only used when you have something/ attribute common in both the tables.

What is a binary search tree?

Binary search tree is a node based tree data structure which has the following properties:
  • The nodes in the left subtree of the root contains elements whose value are lesser than the root element.
  • The nodes in the right subtree of the root contains elements whose value are greater than the root element.

Write a program for finding factorial of a number using recursion in C++.

#include<iostream>
int fact(int);

int main()
{
    int n=5;
    printf("%d",fact(n));

    return 0;
}

int fact(int n){
    if(n==1){
        return 1;
    }
    
    return n*fact(n-1);
}

/*
OUTPUT:
120
*/

Write a program to swap two variables without using a temporary variable.

#include<stdio.h> 

int main() {
    int a,b;
    printf("Enter the value of a: ");
    scanf("%d",&amp;a);
    printf("Enter the value of b: ");
    scanf("%d",&amp;b);
    a=a-b;
    b=a+b;
    a=b-a;
    
    printf("After swapping the value of a is:%d\n",a);
    printf("After swapping the value of b is:%d",b);

    return 0;
}

/*
INPUT:
Enter the value of a: 5
Enter the value of b: 4

OUTPUT:
After swapping the value of a is:4
After swapping the value of b is:5
*/

Nagarro Solved

Automata Fixing

      

We Love to Support you

Go through our study material. Your Job is awaiting.

Recent Posts
Categories