TCS
10+ Interview Questions and Answers
Q1. What is javascript and use of javascript?
JavaScript is a programming language used to create interactive web pages and web applications.
JavaScript is a client-side scripting language
It can be used for form validation, creating animations, and manipulating HTML and CSS
JavaScript can also be used on the server-side with Node.js
Popular JavaScript frameworks include React, Angular, and Vue.js
Q2. What is constructor? Without creating any object it will call or not?
A constructor is a special method in a class that is automatically called when an object of that class is created.
A constructor typically initializes the object's properties or performs any necessary setup.
It is called automatically when an object is created using the 'new' keyword.
Constructors do not get called without creating an object.
Q3. What is java, why it is useful for us?
Java is a popular programming language known for its versatility and platform independence.
Java is an object-oriented programming language used for developing a wide range of applications, from web and mobile apps to enterprise systems.
It is platform-independent, meaning that Java code can run on any device that has a Java Virtual Machine (JVM) installed.
Java is known for its security features, which help protect against viruses and other malicious attacks.
It has a large stan...read more
Q4. What is abstract class in java?
Abstract class in Java is a class that cannot be instantiated and may contain abstract methods.
Cannot be instantiated directly
May contain abstract methods that must be implemented by subclasses
Can have both abstract and non-abstract methods
Used for creating a template for other classes to extend
Q5. Explain Token generation and authentication process.
Token generation and authentication process is a security mechanism used to verify the identity of a user.
Token generation involves creating a unique token for each user upon successful login.
The token is then stored in the user's browser or device.
When the user makes subsequent requests, the token is sent along with the request.
The server then verifies the token to authenticate the user.
If the token is valid, the user is granted access to the requested resource.
Examples of t...read more
Q6. Explain any one of design patterns with examples.
One of the design patterns is the Singleton pattern.
Singleton pattern ensures that only one instance of a class is created and provides a global point of access to it.
It is useful when we need to limit the number of instances of a class to one.
Example: Database connection class, where we need only one instance of the class to connect to the database.
Another example is the Logger class, where we need only one instance to log messages throughout the application.
Q7. What is Constructor?
Constructor is a special method that is called when an object is created.
It has the same name as the class it belongs to
It can take parameters to initialize the object's properties
It can be overloaded to have multiple constructors with different parameters
Q8. What is inheritance in java?
Inheritance in Java allows a class to inherit properties and behavior from another class.
Inheritance is a mechanism in which a new class acquires the properties and behaviors of an existing class.
The class that is inherited from is called the superclass or parent class, and the class that inherits is called the subclass or child class.
Subclasses can override methods from the superclass to provide their own implementation.
Inheritance promotes code reusability and allows for cr...read more
Q9. explain logic for fibonacci series output
Fibonacci series is a sequence of numbers where each number is the sum of the two preceding ones.
Start with 0 and 1 as the first two numbers in the series
Add the previous two numbers to get the next number in the series
Repeat this process to generate the Fibonacci series
Q10. write the program to find nth day from to Today
Program to find the nth day from today
Get the current date using a date object
Add the number of days to the current date to find the nth day
Return the nth day as the output
Q11. Write logic for deletion of link list
Deletion logic for a linked list
Traverse the linked list to find the node to be deleted
Update the pointers of the previous and next nodes to skip the node to be deleted
Free the memory of the node to be deleted
Q12. Oops concepts in java
Oops concepts in Java
Object-oriented programming concepts in Java
Encapsulation, Inheritance, Polymorphism, Abstraction
Classes, Objects, Interfaces, Packages
Example: Inheritance - Child class inherits properties and methods from Parent class
Example: Polymorphism - Same method name with different implementations in different classes
More about working at TCS
Top HR Questions asked in null
Interview Process at null
Top Web Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month