KEMBAR78
JAVA - Nov and Dec Questions | PDF | Java (Programming Language) | Class (Computer Programming)
0% found this document useful (0 votes)
27 views9 pages

JAVA - Nov and Dec Questions

Uploaded by

Gokul Bonntha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views9 pages

JAVA - Nov and Dec Questions

Uploaded by

Gokul Bonntha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

JAVA Questions:

Java Program
Q) what are the solid principla in java ?
Q) Overring & overloading in java ?
method hiding ?
Q) abstraction, encapsulation , inheritance ?
Q) Why to write equals and hashcode in java ?
Q) Internal working of hashmap
Q) what is marker interface in java can you give some examples of marker interfaces in
java ? Clonnable
Q) Can we extends multiple classes ?
Q) what is exception? what is checked and unchecked exception in java
Q) code for Factory

Collections
What is Collection in java and what are different collections have you used.
What is Generics in java ?
Q1 ) Brief me about current project architecture and role you are handling ?
SpringBoot:
Q) What is difference between singleton and prototype bean ?
Q)What is spring boot and what is spring boot dependency management ?
Q) Advantage of Yaml file than using properties file ? if both present then who will get
preference first?
1) Can we override or replace embedded tomcat server in springboot ?
2 ) How to disable specific auto-configuration class in springboot ?
a- > @EnableAutoConfiguration(exclude={ABC.class})
spring.autoconfiguration.exclude property
2) How to use a property defiened in application properties file into your java class ?
-- ? @value("${custom.value}")
3) What is difference between @RestController and @Controller annotation ?
4) Profiles in spring Boot are you aware ? How to define different profiles ?
-- ? spring.profiles.active=dev
application_dev.properties

5) Spring Actuator ?
SpringBoot:

@SpringBootApplication
@Configuration
@ComponentScan
@EnableAutoConfiguration
Request Responses
@GetMapping
@RequestMapping
@RequestParam
Component Types
@Component
@Service
@Repository
@Controller
@RestController
Testing
@SpringBootTest
@MockBean
@Validated
Misc
@Bean
@ConditionalOnJav
6) Writes some sample RestController in spring boot with CRUD operations ? sudo code
7) What is Spring Boot Starter Dependencies ?
Special Dependencies that aggregates commonly used dependencies for
particular feature .

8)@Qualifier Annotation in spring Boot ?


Shows how to differentiate beans of same type with @Qualifier
@Component
@Qualifier("Student")
9) Write a Java 8 Program to find the duplicate characters in a string.
10) Explain spring IOC. Loose coupling & dependency injection

10) Write a Java Program to generate Output "aabbbcccc" with the input "a2b3c4"

11) Write a Java Program to check if a number is Armstrong number or not.


Using Java 8. Q: You are given an array routes representing bus routes where routes[i]
is a bus route that the ith bus repeats forever. For example, if routes[0] = [1, 5, 7], this
means that the 0th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ...
forever. You will start at the bus stop source (You are not on any bus initially), and you
want to go to the bus stop target. You can travel between bus stops by buses only.
Return the least number of buses you must take to travel from source to target. Return
-1 if it is not possible. Input: routes = [[1,2,7],[3,6,7]], source = 1, target = 6
12) Data structures (LL working and finding element)
Find the middle of a given linked list - GeeksforGeeks

Microservices:
1. Advantages & Disadvantages
2. Architecture
3. Saga design pattern
4. Circuit breaker
5. Communication between microservices
6. If any microservices fails which is dependent then what will be the output of the
microservices
AWS:
7. S3
8. SNS
9. Lambda
10. Cloud formation template
11. Spring cloud feature
12. EC2 instance configuration
13. Kafka
14. What is DDD (Domain Driven Design)?
What is two-factor authentication?

Design Pattern:
1. Singleton
2. Factory
3. Abstract Factory
JAVA 8 Fundamentals
1. What concepts of JAVA 8 you have used in your project?
2. Can you give me one example on functional interface with syntax?
3. Real time example where we can have only one abstract method couple of
default methods.
4. What is the purpose of default methods?
5. It has just 3 properties Name, price and Manufacturer name and the input value
is list of products. I want you to filter this list where name starts with “B” and the
price is >100 rs by using stream.
6. JAVA 8 function, predicates
7. Can we retrieve only product names from the list? Write the code.
8. Take a string “abababababa” and input string is “ba”. Find number of
occurrences of input in the text string.
9. Concept of serializable? When you don’t user serializable then what kind of
exception you face.
10. What is concurrent HashMap?
11. How to make list as synchronized.
12. What is thread safe and what is synchronized? What do you mean
synchronization?
13. In java collection which are all thread safe?
14. Bulk of string object example 1000 name in list, which object you prefer to sort
the list?
15. Spring boot version? Spring boot features used in your project.
16. Have you worked on Netflix eureka server or circuit breaker?
17. Components involved in the Microservices architecture and how the request and
response flow will be differentiated in the monolithic application and
microservices architecture, so what are the advantages and disadvantages.
18. Request comes from UI- what are all components the request will travel through
and get the response.
19. Sort list of objects based on amount in descending order using streams.
20. Get the first policy details object for user name "veerendra" from multiple
policies list using streams.
21. Explain Listener and publisher creation in ActiveMQ.
22. Deadlock in multithreading.
23. Display selects box values in descending order.
24. Pagination
25. How to clone object and diff between Shallow and Deep clone
26. Q What is encapsulation
27. Q Write a program to sum of three array elements will be 29 [12,3, 5, 1, 6, 9, 13,
12, 15]
28. Q what is hash code and equal method?
29. Q what is volatile keyword?
30. Q Explain HTTP methods for RESTful services?
31. Q Write a program for prime number?
32. Q What is Exception and ow we can handle?
33. Q What is customized exception and how we can create?
34. Q what is difference between wait() and sleep()?
35. Q Create rest end points which will get all list of ids?
36. Q When to user @QueryParam and PathParam?
37. Q Write a program to find prime number?
38. Q What is abstraction and data hiding?
39. Q What is difference between POST and PUT method?
40. Q What is thread and multithreading ?
Databse:

Q1 : second highest Salary


A : SELECT Salary FROM (SELECT Salary FROM Employee ORDER BY salary DESC LIMIT 2) AS
Emp ORDER BY salary LIMIT 1
Q2: what is primary key and unique key ?
Q3: What is inner join and outer join? Write SQL query

Hello Gauri

Please prepare on below and attached questions, I will schedule your customer interview either Monday
to Tuesday.

a) Java coding exercise

Q1 Given a list of integers, find out all the even numbers exist in the list using Stream functions?

import java.util.*;
import java.util.stream.*;
public class JavaHungry {
public static void main(String args[]) {
List<Integer> myList = Arrays.asList(10,15,8,49,25,98,32);
myList.stream()
.filter(n -> n%2 == 0)
.forEach(System.out::println);
}
}
Output:
10, 8, 98, 32
-----
Q2 How to find duplicate elements in a given integers list in java using Stream functions?

import java.util.*;
import java.util.stream.*;
public class JavaHungry {
public static void main(String args[]) {
List<Integer> myList = Arrays.asList(10,15,8,49,25,98,98,32,15);
Set<Integer> set = new HashSet();
myList.stream()
.filter(n -> !set.add(n))
.forEach(System.out::println);
}
}

Output:
98, 15

Q3 Java Program to remove Vowels from the String – String is “Website”


import java.util.*;
public class Main
{
public static void main (String[]args){
ArrayList<Character> arr = new ArrayList<Character>(Arrays.asList('a','e','i','o','u','A','E','I','O','U'));
System.out.println("Java program to remove Vowel from String");
Scanner sc = new Scanner (System.in);
System.out.println ("Please enter a String");
String str = sc.nextLine();
StringBuffer strBuffer = new StringBuffer();
for(int i = 0; i < str.length(); i++){
if(!arr.contains(str.charAt(i))) {
strBuffer.append(str.charAt(i));
}
}
System.out.println("After removing Vowel from String");
System.out.println(strBuffer);
}
}
Q4 Write a program to Reverse ArrayList in Java
ArrayList Before Reverse :
[Apple, Amazon, Facebook, Google, IBM, Tesla]
ArrayList After Reverse :
[Tesla, IBM, Google, Facebook, Amazon, Apple]

import java.util.*;
public class ReverseArrayList
{
public static void main(String[] args)
{
//Creating an ArrayList object
ArrayList<String> arrlist = new ArrayList<String>();

//Adding elements to ArrayList object


arrlist.add("Apple");
arrlist.add("Amazon");
arrlist.add("Facebook");
arrlist.add("Google");
arrlist.add("IBM");
arrlist.add("Tesla");

//Displaying ArrayList Before Reverse


System.out.println("Before Reverse ArrayList:");
System.out.println(arrlist);

/*Reversing the list using


Collections.reverse() method*/
Collections.reverse(arrlist);

//Displaying list after reverse


System.out.println("After Reverse ArrayList:");
System.out.println(arrlist);
}
}

Q5. Write a Java program to check if a vowel is present in a string.


public class StringContainsVowels {

public static void main(String[] args) {


System.out.println(stringContainsVowels("Hello")); // true
System.out.println(stringContainsVowels("TV")); // false
}

public static boolean stringContainsVowels(String input) {


return input.toLowerCase().matches(".*[aeiou].*");
}
}

How can you use the Stream API in Java 8?


What are parallel streams in Java 8 ?
What is the purpose of the Predicate interface in Java 8?
What is the purpose of the Function interface in Java 8?
What is the purpose of the BiFunction interface in Java 8?
What are the benefits of using the new Date and Time API in Java 8?
What is the difference between flatMap() and map() functions?

b) Core Java

OOPs Concepts in Java

What is Encapsulation in Java ?


How to achieve Encapsulation in Java ?
Encapsulation in Java Example - write a code

What is Abstraction in Java ?


How do we achieve Abstraction in Java ?

Two Ways to Shape Polymorphism in Java:-

Compile Time Polymorphism in Java Example - write a code


Rules for Overloading

Runtime Polymorphism in Java Example - write a code


Rules for Overriding

Collections

Sort ArrayList in Java


ConcurrentHashMap in Java

c) Design Pattern

Creational Design Patterns


Structural Design Patterns
Behavioral Design Patterns
How to Create Singleton Class in Java ?
public class Singleton {

private static Singleton instance;

private Singleton() {}

public static Singleton getInstance() {


if (instance == null) {
instance = new Singleton();
}
return instance;
}

Spring Boot:

Q: How can you consume RESTful web services in a Spring Boot application?
In a Spring Boot application, you can consume RESTful web services using RestTemplate or WebClient.
Fetching All Student Records:
ResponseEntity<Student[]> studentsReponse =
restTemplate.getForEntity(″http://localhost:8080/students″,Student[].class);
List<Student> students = Arrays.asList(studentsReponse.getBody());
students.forEach(x -> System.out.println(x));

Q. What are the Key Components of Spring Boot?


Q. What are the differences between Spring and Spring Boot?
Q. What is the purpose of the @SpringBootApplication annotation?
Q. What are Spring Boot starters ?
Q. Provide some examples of commonly used Spring Boot Starters
Q. What is the default embedded server used by Spring Boot?
Q. How do you configure properties in a Spring Boot Application?
Q. What is Spring Boot Auto-configuration, and how does it work?
Q. Explain Spring IoC, / Loose coupling & dependency injection
Q. Data structures (Linked list working and finding element)
Q. Write RestAPI endpoint?
Microservices:

Q. What are the key principles of Microservices architecture?


Q. How do Microservices differ from monolithic architecture?
Q. How do Microservices communicate with each other?
Q. What is the role of API gateways in Microservices?
Q. What are some common Microservices patterns?
Q. What are the primary components of a Microservices architecture?

SQL:

Q1. Write a SQL Query to have the list of employees who’s salary is greater than average salary.
SELECT employee_name
FROM employees
WHERE salary > (SELECT AVG(salary) FROM employees);

Q2. Wirte SQL Query to delete all the employees from department “IT Operations”
DELETE FROM employees
WHERE department_id = (SELECT department_id FROM departments WHERE department_name = ' IT
Operations ');

Q3. Display the name of the department along with the average salary obtained by the employees
working in that department.
SELECT DEPARTMENT_NAME,AVG(SALARY) AS
AVERAGE_SALARY FROM COMPANY GROUP BY DEPARTMENT_NAME;

Q4. Write SQL Query to display customer name whose order total is greater than 1000.
SELECT customer_name
FROM customers
WHERE customer_id IN (SELECT customer_id FROM orders WHERE order_total > 1000);

Q5. What is primary key and unique key ?


Q6. What is inner join and outer join? Write SQL query

You might also like