Wipro
30+ NSK Interview Questions and Answers
Q1. Tell me some keywords to make a thread safe program in java ?
Keywords for thread safe program in Java
Synchronization using synchronized keyword
Using volatile keyword for shared variables
Using atomic classes for thread safe operations
Using thread safe collections like ConcurrentHashMap
Using locks and semaphores for synchronization
Avoiding shared mutable state
Using immutable objects
Using thread local variables
Q2. How to start spring boot application even though a class having error
To start Spring Boot app with class error, disable strict classpath checking.
Add 'spring.main.lazy-initialization=true' to application.properties.
Disable strict classpath checking by adding 'spring.main.allow-bean-definition-overriding=true'.
Use 'spring.main.banner-mode=off' to disable banner.
Use 'spring.main.web-environment=false' to disable web environment.
Use 'spring.main.headless=true' to enable headless mode.
Q3. What is the difference between JDK, JRE, and JVM?
JDK is a development kit, JRE is a runtime environment, and JVM is a virtual machine for running Java programs.
JDK (Java Development Kit) is a software development kit used for developing Java applications. It includes JRE, compiler, debugger, and other tools.
JRE (Java Runtime Environment) is a software package that provides the libraries, Java Virtual Machine (JVM), and other components necessary for running Java applications.
JVM (Java Virtual Machine) is an abstract machine...read more
Q4. What do you understand by Java virtual machine?
Java virtual machine (JVM) is a virtual machine that enables a computer to run Java programs.
JVM is an abstract machine that provides a runtime environment for Java bytecode to be executed.
It is responsible for converting Java bytecode into machine code that can be understood by the computer's operating system.
JVM is platform-independent, allowing Java programs to run on any device or operating system that has a JVM implementation.
It manages memory, handles garbage collection...read more
Q5. When you will received class modification exception.
Class modification exception occurs when a class is modified after it has been loaded by the JVM.
This exception is thrown when a class is modified and then reloaded by the JVM.
It can occur when a class is modified during runtime or when a new version of a class is loaded.
This exception can be avoided by using a class loader that isolates the classes from each other.
An example of this exception is when a method is added to a class and then the class is reloaded by the JVM.
Q6. what is the use of RequestBody Annatotion in spring
RequestBody annotation is used to bind the HTTP request body to a method parameter in Spring.
Used in Spring MVC to handle POST requests
Used to map the request body to a Java object
Can be used with other annotations like @PostMapping
Can be used to validate the request body using @Valid annotation
Q7. Who is the father of java ?
James Gosling is considered the father of Java programming language.
James Gosling, a Canadian computer scientist, is credited with creating the Java programming language in the early 1990s.
He developed Java while working at Sun Microsystems, now owned by Oracle.
Java was officially released by Sun Microsystems in 1995 and has since become one of the most popular programming languages in the world.
Q8. What is JIT compiler?
JIT compiler stands for Just-In-Time compiler, which compiles Java bytecode into native machine code at runtime for improved performance.
JIT compiler is part of the Java Virtual Machine (JVM) and helps in optimizing the performance of Java applications.
It compiles Java bytecode into native machine code on-the-fly, right before executing it.
JIT compiler identifies hot spots in the code (frequently executed portions) and optimizes them for better performance.
Examples of JIT com...read more
Q9. How to create method over riding and how to use in Java application.
Method overriding in Java allows a subclass to provide a specific implementation of a method that is already provided by its superclass.
Create a subclass that extends a superclass with a method to be overridden
Define a method in the subclass with the same signature as the superclass method
Use the @Override annotation to indicate that the method is intended to override a superclass method
Call the superclass method using the super keyword within the overridden method
Q10. How to make a class immutable SOLID principles factory designer pattern
To make a class immutable, use final keyword, private fields, no setters, and defensive copying.
Use final keyword to make class unextendable
Use private fields to prevent direct access
No setters to prevent modification
Defensive copying to prevent modification of mutable objects
SOLID principles and factory design pattern can be used to create immutable objects
Example: String class in Java is immutable
Q11. Where branch in Wipro BPS?
Wipro BPS has multiple branches across India and globally.
Wipro BPS has branches in major cities like Bangalore, Chennai, Mumbai, Pune, Hyderabad, etc.
They also have branches in countries like the USA, UK, Australia, etc.
The exact branch location for a Java Developer role may depend on the project and client requirements.
Q12. Why use in java to Javascript
Java and JavaScript are two different programming languages with different use cases.
Java is used for building server-side applications, Android apps, and enterprise software.
JavaScript is used for building interactive web applications and front-end development.
Java is a compiled language while JavaScript is an interpreted language.
Java is statically typed while JavaScript is dynamically typed.
Java code runs on the Java Virtual Machine (JVM) while JavaScript code runs on web ...read more
Q13. Method over ridingi s a wrapper class to mainclass.. is easily understand the topic.
Method overriding is a way to provide a specific implementation of a method in a subclass that is already provided by its superclass.
Method overriding allows a subclass to provide a specific implementation of a method that is already defined in its superclass.
The method in the subclass must have the same name, return type, and parameters as the method in the superclass to override it.
Method overriding is used to achieve runtime polymorphism in Java.
Example: class Animal { voi...read more
Q14. what is javascript and c++ and why its imp
JavaScript and C++ are programming languages used for web development and system programming respectively.
JavaScript is a scripting language used for front-end web development.
C++ is a high-level programming language used for system programming and software development.
JavaScript is essential for creating interactive web pages and dynamic content.
C++ is important for developing high-performance applications and operating systems.
Q15. Explain Jdk, jre?
JDK stands for Java Development Kit, which is a software development kit used for developing Java applications. JRE stands for Java Runtime Environment, which is required to run Java applications.
JDK includes JRE along with development tools such as compiler, debugger, etc.
JRE includes JVM (Java Virtual Machine) and libraries necessary for running Java applications.
Developers use JDK to write, compile, and debug Java programs, while end-users only need JRE to run Java applica...read more
Q16. Difference between final finalise and finally keywords
final, finalize, and finally are keywords in Java with different purposes.
final is used to declare a constant value that cannot be modified
finalize is a method used for garbage collection
finally is a block used in exception handling to ensure a piece of code is always executed
Q17. Write program to find second largest number in unsorted array
Program to find the second largest number in an unsorted array
Iterate through the array and keep track of the largest and second largest numbers
Initialize the largest and second largest variables with the first two elements of the array
Compare each element with the largest and second largest variables and update them if necessary
Return the second largest number
Q18. what is difference between spring and spring boot.
Spring is a framework for building Java applications, while Spring Boot is a tool that simplifies the setup and configuration of Spring applications.
Spring is a comprehensive framework that provides support for various functionalities like dependency injection, aspect-oriented programming, and more.
Spring Boot is an opinionated tool that aims to simplify the setup and configuration of Spring applications by providing defaults and auto-configuration.
Spring Boot includes embedd...read more
Q19. spring boot annotations and difference between @Component and @Bean
Spring Boot annotations @Component and @Bean have different purposes. @Component is used for auto-detection and instantiation of beans, while @Bean is used to explicitly define a bean.
Use @Component to automatically detect and instantiate beans based on classpath scanning.
Use @Bean to explicitly define a bean in a configuration class.
@Component is a generic stereotype annotation while @Bean is a method-level annotation.
@Component is used for classes, while @Bean is used for m...read more
Q20. Types of joins in sql
Types of joins in SQL
Inner join: returns only the matching rows from both tables
Left join: returns all rows from the left table and matching rows from the right table
Right join: returns all rows from the right table and matching rows from the left table
Full outer join: returns all rows from both tables
Cross join: returns the Cartesian product of both tables
Q21. what is platform independence language
Platform independence language refers to a programming language that can run on any platform without needing to be recompiled.
Java is a platform independence language because it uses the Java Virtual Machine (JVM) to run on any platform.
Platform independence allows Java programs to be written once and run anywhere, saving time and effort for developers.
Other examples of platform independence languages include Python and Ruby.
Q22. what is java and why its imp
Java is a high-level programming language known for its portability, security, and versatility.
Java is platform-independent, meaning it can run on any device with a Java Virtual Machine (JVM).
It is object-oriented, allowing for modular and reusable code.
Java is widely used in web development, mobile applications, enterprise software, and more.
Its strong security features make it a popular choice for building secure applications.
Java has a large standard library and active com...read more
Q23. Annoatation of Spring REST
Spring REST annotations are used to simplify the development of RESTful web services in Spring framework.
Annotations like @RestController, @RequestMapping, @GetMapping, @PostMapping, @PutMapping, @DeleteMapping are commonly used in Spring REST.
These annotations help in mapping HTTP requests to specific handler methods, defining request mappings, and handling request parameters.
For example, @GetMapping("/users") will map a GET request to /users endpoint to a specific method in...read more
Q24. complete Spring MVC Flow .
Spring MVC Flow involves DispatcherServlet, HandlerMapping, Controller, Model, ViewResolver, and View.
Client sends a request to DispatcherServlet.
DispatcherServlet consults HandlerMapping to determine the appropriate Controller.
Controller processes the request, interacts with Model, and returns a logical view name.
DispatcherServlet consults ViewResolver to map the logical view name to an actual View.
View renders the response and sends it back to the client.
Q25. Difference between primary and unique key
Primary key uniquely identifies each record in a table, while unique key ensures that all values in a column are different.
Primary key does not allow NULL values, while unique key allows one NULL value.
A table can have only one primary key, but multiple unique keys.
Primary key is automatically indexed, while unique key is not.
Example: Primary key for a table of students could be student_id, while unique key could be email.
Q26. Internal Working of HashMap
Internal working of HashMap
HashMap is a data structure that stores key-value pairs
It uses hashing to store and retrieve values
The hash code of the key is used to find the index of the value in the array
If there is a collision, the values are stored in a linked list at that index
The load factor determines when the HashMap should resize
The default load factor is 0.75
HashMap is not thread-safe, use ConcurrentHashMap for thread safety
Q27. Explain oops with real word scenerios
Object-oriented programming (OOP) is a programming paradigm that uses objects to represent real-world entities and their interactions.
OOP allows for modular and reusable code.
Encapsulation hides the internal details of an object.
Inheritance allows for the creation of subclasses with shared characteristics.
Polymorphism enables objects to take on multiple forms.
Abstraction simplifies complex systems by focusing on essential details.
Q28. Explain importance of static in java
Static is important in Java for creating class-level variables and methods that can be accessed without creating an instance of the class.
Static variables are shared among all instances of a class
Static methods can be called without creating an object of the class
Static blocks are used for initializing static variables
Static keyword is used for creating nested classes
Static import is used to import static members of a class
Q29. Operaters in sql and languages
Operators in SQL and programming languages are used to perform various operations on data.
SQL operators include arithmetic, comparison, logical, and bitwise operators.
Programming language operators include arithmetic, assignment, comparison, logical, and bitwise operators.
Examples of SQL operators are +, -, *, /, =, <>, >, <, AND, OR, NOT, &, |, ^.
Examples of programming language operators are +, -, *, /, =, ==, !=, >, <, &&, ||, !, &, |, ^, +=, -=, *=, /=.
Q30. Oops concepts in Java
Oops concepts in Java
Object-oriented programming
Encapsulation
Inheritance
Polymorphism
Abstraction
Class
Object
Interface
Constructor
Method Overloading
Method Overriding
Q31. Pillars of OOPS.
Pillars of OOPS are Inheritance, Encapsulation, Abstraction, and Polymorphism.
Inheritance: Allows a class to inherit properties and behavior from another class.
Encapsulation: Bundling data and methods that operate on the data into a single unit.
Abstraction: Hiding the complex implementation details and showing only the necessary features.
Polymorphism: Ability of a method to do different things based on the object it is acting upon.
Q32. Exception Vs Error
Exceptions are events that can be handled programmatically, while errors are typically unrecoverable issues.
Exceptions are checked at compile time, while errors are unchecked.
Exceptions are subclasses of Throwable, while errors are subclasses of Error.
Examples of exceptions include NullPointerException, ArrayIndexOutOfBoundsException, while examples of errors include OutOfMemoryError, StackOverflowError.
Q33. Structure of JVM
JVM is the virtual machine that runs Java bytecode, providing platform independence.
JVM stands for Java Virtual Machine
It is responsible for interpreting Java bytecode and executing it on the underlying hardware
JVM has components like Class Loader, Bytecode Verifier, Interpreter, Just-In-Time Compiler, and Garbage Collector
Q34. How Spring container works
Spring container is responsible for managing the lifecycle of Spring beans and their dependencies.
Spring container creates and manages the objects (beans) defined in the Spring configuration file.
It injects dependencies, handles transactions, and manages the lifecycle of beans.
There are two types of Spring containers: BeanFactory and ApplicationContext.
ApplicationContext is preferred over BeanFactory as it provides more features like event handling, internationalization, etc.
Q35. What is HTML full form
HTML stands for Hypertext Markup Language.
HTML is the standard markup language for creating web pages.
It is used to structure content on the internet using a system of tags.
Examples of HTML tags include <p> for paragraphs, <h1> for headings, and <a> for links.
Q36. What are Threads?
Threads are lightweight processes within a program that can run concurrently, allowing for multitasking and improved performance.
Threads allow multiple tasks to be executed simultaneously within a single program
Threads share the same memory space, allowing for efficient communication and data sharing
Examples include a web server handling multiple client requests concurrently, or a video game running animations and user input processing simultaneously
Q37. Explain Serialisation in java
Serialisation in Java is the process of converting an object into a byte stream for storage or transmission.
Serialisation allows objects to be saved and restored later.
It is used in Java to enable objects to be sent over a network or stored in a file.
The Serializable interface is implemented by classes to make them serializable.
The ObjectOutputStream class is used to write objects to a stream.
The ObjectInputStream class is used to read objects from a stream.
Q38. Int is integer or string
Int is an abbreviation for integer, which is a numerical data type in programming.
Int is not a string, it is a data type used to represent whole numbers.
In Java, int is a primitive data type and is declared using the keyword 'int'.
Examples of int variables: int age = 25; int quantity = 10;
Q39. New functionalities in Java 8
Java 8 introduced new features like lambda expressions, streams, functional interfaces, and default methods.
Lambda expressions allow you to write code in a more concise and readable way.
Streams provide a way to work with sequences of elements and perform operations like filter, map, reduce, etc.
Functional interfaces are interfaces with a single abstract method, which can be implemented using lambda expressions.
Default methods allow interfaces to have method implementations, r...read more
Top HR Questions asked in NSK
Interview Process at NSK
Top Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month