Hot Topics
Mindtree Solution
Technical Round
- Question 1
How many programming languages do you know?
- Answer
Tell about the programming languages you know.
- Question 2
What is the difference between call by value and call by reference in C?
- Answer
Call By Value | Call By Reference |
1. When a copy of a value is passed to the function, then the original value is not modified. | When a copy of value is passed to the function, then the original value is modified. |
2. Actual arguments and formal arguments are created in separated memory locations. | Actual arguments and formal arguments are created is same memory location. |
3. In this case, actual argument remain safe as they cannot be modified. | In this case, actual arguments are not reliable, as they are modified. |
4. The copied of the actual arguments are passed to the formal arguments. | The address of actual arguments are passed to their respective formal arguments |
- Question 3
What is recursion in C?
- Answer
Recursion is a self-calling function with a terminating condition.
- Question 4
How can you restrict inheritance?
- Answer
You can restrict inheritance using the “final” keyword while creating a class.
- Question 5
What is the use of “this” keyword in Java?
- Answer
this keyword is used to carry the reference of the calling object.
- Question 6
What is the final variable?
- Answer
When the final keyword is used with a variable then its value can’t be changed once assigned. In case no value has been assigned to the final variable then using only the class constructor a value can be assigned to it.
- Question 7
What is the main purpose of an OS? What are the different types of OS?
- Answer
OS is used to perform various tasks like data input, processing operations and accessing output.
Various operating systems are Linux, Windows, MacOS,etc.
- Question 8
What are 4 pillars of Java?
- Answer
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:
Runtime Polymorphism
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.
- Question 9
What is Inner Join and Outer Join and their uses?
- Answer
Inner Join is a SQL operation which is used to return combination of two or more tables having at least one common attribute.
Outer Join is a SQL operation which is used to return combined tuples form a specified table even if the condition is false.
- Question 10
Calculate the address of a random element present in a 2D array, given base address as BA?
#include<stdio.h>
int main(){
int arr[100][100],i,j,n,cal;
int BA=1000;
scanf("%d",&n);
for(i=0; i<n; i++){
for(j=0;j<n;j++){
scanf("%d",&arr[i][j]);
}
}
for(i=0; i<n; i++){
printf("\n");
for(j=0;j<n;j++){
printf("%d" ,arr[i][j]);
}
}
printf(""\nEnter row and col no of index:"");
scanf("%d %d",&i,j);
cal=BA+sizeof(arr[i][j])*i*j;
printf("\nbase address of arr[%d][%d]:%d ",i,j,cal);
return 0;
}
/*
input:
3
3 6 8
6 9 1
45 64 89
Enter row and col no of index:
1 2
output:
3 6 8
6 9 1
45 64 89
base address of arr[1][2]:1008
*/
- Question 11
What are the advantages and disadvantages of views in databases?
- Answer
Advantages of views in databases:
We can see the required columns of the table we need without storing data is physical location.
In view we can’t update, delete and insert data.
Disadvantages of views in databases:
View becomes irrelevant when a table is dropped.
It is a bit slow as a query is requesting data from view.
- Question 12
How do you pass data from one JSP to another JSP?
- Answer
Passing data from one JSP to another JSP can be done in three ways:
using request attributes: Set the value to send in request attribute with a name of your choice as request.setAttribute(“send”, “valueToSend”) and retrieve it on another jsp using request.getAttribute(“send”);
using session attributes Similar to above but using session object instead of request.
using application attributes same as 1 and 2 above but using application object in place of request and session.
- Question 13
In Java, is there any alternative to inheritance?
- Answer
In Java delegation can be used alternative to inheritance in which we can use an object of another class as an instance variable i.e. we are just passing a duty off to another class.
- Question 14
What is destructor?
- Answer
Destructor is a method which is automatically called when an object is no longer needed. It can be also called as a garbage collector.
- Question 15
What is the difference between arrays and structures?
- Answer
Array | Structure |
1. Array is a linear data structure which contains homogenous data types. | Structure is the collection of elements of heterogeneous data types. |
2. Array elements are stored in contiguous memory location. | Structure elements may or may not be stored in contiguous memory location. |
3. Array elements can be accessed by their index number. | Structure elements are accessed using dot operator after their name. |
4. Array is of non-primitive datatype. | Structure is user defined datatype. |
- Question 16
How can you check whether the given Binary tree is a Binary Search Tree or not?
- Answer
Binary tree is a tree data structure in which each node contains 2 child nodes.
Binary Search Tree is a tree data structure in which each node contains 2 child nodes but the left sub tree of a node only contains element lesser than the actual node and right subtree contains element which are greater than the actual node.
- Question 17
What is _init_?
- Answer
_init_ works as a constructor that is used to initialize an object’s state.
- Question 18
What are constraints?
- Answer
Constraints are a set of rules that is enforced on the columns of a table.
- Question 19
What is tree traversal?
- Answer
Tree traversal is the way in which we can traverse through all the nodes of the tree. There are different kind of tree traversal such as:
In order traversal
Pre order traversal
Post order traversal
Level order traversal
- Question 20
What do you mean by Pre-order, In-order, Post-order traversal?
- Answer
Pre-order: In pre-order traversal we first visit the root then traverse the left subtree and finally we traverse the right subtree.
In-order: In in-order traversal we first traverse the left sub-tree then visit the root and finally traverse the right subtree.
Post-order: In post-order traversal we first traverse the left subtree then we traverse the right subtree and then we visit the root.
- Question 21
Differentiate between the equals() method and ==.
- Answer
equals() | == |
It is a method. | It is an operator. |
It is used to compare the content. | It is used for address comparison. |