Hot Topics
Hexaware Solution
Technical Round
- Question 1
Java multi-threading.
- Answer
Multi-threading in Java refers to the execution of more than one thread simultaneously for maximum utilization of CPU.
- Question 2
What are Java 9 features?
- Answer
Features of Java 9 are:
Interface Private Methods
Platform Module System
Try-with Resources
The Java Shell (REPL)
Control Panel
Stream API Improvement
New version-String Scheme
- Question 3
Explain project you have worked on during graduation.
- Answer
Tell about the topic of graduation project as well as explain it totally.
- Question 4
What is polymorphism in OOPS concept describe it with an example?
- Answer
Polymorphism is briefly described as “one interface, many implementation”. Polymorphism is a characteristic of being able to assign a different meaning or usage to something in different contexts specifically, to allow an entity such as a variable, a function, or an object to have more than one form. There are two types of polymorphism:
Compile time polymorphism
Run time polymorphism
- Question 5
They asked me to input a string and then give as output the number of occurrence of each letter present in the string.
- Answer
Here’s an example of counting the number of occurrences of each letter in a given string in C:
#include<stdio.h>
#include<string.h>
#define MAX_CHAR 256
void printFrequency(char *str)
{
int count[MAX_CHAR] = {0};
int i;
int n = strlen(str);
for (i = 0; i < n; i++)
count[str[i]]++;
for (i = 0; i < MAX_CHAR; i++)
if (count[i] != 0)
printf("%c occurs %d times in the given string.\n", i, count[i]);
}
int main()
{
char str[100];
printf("Enter a string: ");
scanf("%s", str);
printFrequency(str);
return 0;
}
/*
OUTPUT -
Enter a string: 56464
4 occurs 2 times in the given string.
5 occurs 1 times in the given string.
6 occurs 2 times in the given string.
*/
- Question 6
What are the different methods for Sequential Supervised Learning?
- Answer
Different methods for Sequential Supervised Learning are:
The sliding window method
Recurrent sliding window
Hidden Markov Models and Related Methods
Conditional Random Fields
Graph Transformer Networks
- Question 7
Why would you say cloud computing is faster?
- Answer
Cloud computing is faster because:
Better Network Performance
Uptime guarantees
Automatic performance upgrades
Faster product development and deployment
Automatic scaling and load-balancing
Standardization
- Question 8
What is the program logic for 1 to 10 sum?
- Answer
#include<stdio.h>
int main()
{
int i, sum = 0;
for (i = 1; i <= 10; i++)
{
sum = sum + i;
printf("%d ",i);
}
printf("\n %d", sum);
}
/*
OUTPUT:
1 2 3 4 5 6 7 8 9 10
55
*/
- Question 9
Can you solve any hard math with easy equation and can you implement it in the computer?
- Answer
Yes
- Question 10
How would you sort the keys in a Hash map?
- Answer
To sort the keys in a Hash map we can use following two methods:
By using Tree Map
By using Linked Hash Map
- Question 11
Features of object oriented programming.
- Answer
Important features of OOPs 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.
Method Overriding: In place of inheritance if the parent class and child class both have the same method signature then child class method overrides the parent class method.
Method Overloading: If a class has more than one method with the same method name with variety of parameter list then method will be overloaded.
Object: Object is the reality of a class.
Class: Class is a blue print of similar type of objects.
Constructor: Constructor is a special member function that is automatically invoked at the time of object creation and does not have any return type.
- Question 12
Explain Abstract class?
- Answer
Abstract class in Java is special kind of class which is declared with the abstract keyword which cannot be used to create objects. It can contain both abstract and non-abstract methods.
- Question 13
State difference between Package and Interface.
- Answer
Package | Interface |
1. It is created using the “package” keyword. | It is created using the “interface” keyword. |
2. It is a collection or group of classes and/or interfaces together. | It is a collection off abstract method and constants. |
3. It can be imported. | It can be extended by another interface and also implemented by a class. |
- Question 14
Does Java support multiple inheritances or not?
- Answer
If a child class inherits the property from multiple classes in known as multiple inheritance. Java does not allow to extend multiple classes.
The problem with multiple inheritance is that if multiple parent classes have the same method name, then at runtime it becomes difficult for the compiler to decide which method to execute from the child class.
Therefore, Java does not support multiple inheritance. This problem is often referred to as diamond problem.
But the concept of multiple inheritance can be achieved through interfaces
- Question 15
Explain inheritance.
- Answer
Inheritance is a mechanism in which an object acquires properties from its parent object.
- Question 16
What types of instance variables are there?
- Answer
Types of instance variables are:
boolean
byte
short
int
double
float
long
char
- Question 17
What do near, far & huge pointer means?
- Answer
Near Pointer | Far Pointer | Huge Pointer |
Near pointer is used to store address of any variable whose maximum size is 16-bits i.e. we can only access 64kb of data at a time. | Far pointer is a 32 bits size pointer which can also access information stored outside the computer’s memory from the current segment. | Huge pointer is similar to that of far pointer but it has some advantages such as the part of the sector in which they are stored or located cannot be changed or modified. |
- Question 18
What do you mean by recursion function?
- Answer
Recursion function is a self-calling function with a terminating condition.