TCS
50+ Interview Questions and Answers
You are given an integer ‘N’. Your task is to find all palindromic numbers from 1 to ‘N’.
Palindromic integers are those integers that read the same backward or forwards.
Note:
Order of numbers ...read more
You have been given two integers ‘N’ and ‘K’. Consider a set ‘X’ of all possible strings of ‘N’ number of digits such that all strings contain digits only in range 0 to ‘K’ inclusive.
For exam...read more
There is a person named Bob who is the mayor of a state. He wants to find the maximise number of vehicles that can be registered in his state.
A vehicle normally has a registration number like...read more
You are given three strings “A”, “B” and “C”. Your task is to check whether “C” is formed by an interleaving of A and B. C is said to be interleaving “A” and “B”, if the length of “C” is equa...read more
Given a Binary Tree of 'N' nodes, find and print a list containing the sums of all the diagonals. When calculating the sum of each diagonal, consider the diagonals from right to left.
Diagonals of t...read more
You have been given two integers ‘DAY_HOURS’ and ‘PARTS’. Where ‘DAY_HOURS’ is the number of hours in a day and a day can be divided into ‘PARTS’ equal parts. Your task is to find total instance...read more
You are given an integer ‘N’. You have to print the value of Factorial of ‘N’. The Factorial of a number ‘N’ is defined as the product of all numbers from 1 to ‘N’.
For Example:
Consider if ‘N’ = 4, th...read more
You are given an array 'ARR' of 'N' positive integers. You need to find the length of the longest switching contiguous subarray.
An array is called Switching if all the elements at eve...read more
You have given a Singly Linked List of integers, determine if it forms a cycle or not.
A cycle occurs when a node's next points back to a previous node in the list. The li...read more
You are given a positive integer ‘N’. The task is to find and return the smallest number, ‘M’, such that the multiplication of all the digits in ‘M’ is equal to...read more
You are given an array/list 'ARR' consisting of N integers, which contains elements only in the range 0 to N - 1. Some of the elements may be repeated in 'ARR'. Your task is to find all ...read more
Data structures:
What is ds. Explain types.
Tell me about sorting techniques.
What is avl tree. Traversal of tree.
Some tree algorithms like dfs,bfs.
About max and min heap.
Python...read more
You are given two linked lists representing two non-negative numbers. The digits in the linked list are stored in reverse order, i.e. starting from least significant digit (LSD) t...read more
There is a jar full of candies for sale at a mall counter. Jar has the capacity ‘N’. That is, jar can contain maximum ‘N’ candies when a jar is full. At any point in time jar can not have 0 or few...read more
Given the head node of the singly linked list, return a pointer pointing to the middle of the linked list.
If there are an odd number of elements, return the middle element if there are eve...read more
You are given an undirected graph, a source vertex, and an integer k. Check if there is any simple path(without any cycle) from source to any vertex such that its distance is greater than...read more
What is database?
Explain joins.
Explain all types of normalisation.
What is deadlock how can we over come from that.
What are transaction. Types.
Explain about locks.
What is grouping?
Gave 2 queries t...read more
What is the term given to the variable whose scope is beyond all the scopes i.e., it can be accessed by all the scopes?
a. universal variable
b. global variable
c. external variable
d. auto variab...read more
On a 26-question test, five points were deducted for each wrong answer and eight points were added for each correct answer. If all the questions were answered, how many were correct if the scor...read more
What is Cloud Computing ? What are IaaS, PaaS, and SaaS ? Do you have any experience of Azure, AWS or GCP ?
What is MongoDB and how it is better than MySQL ? What are the major differences be...read more
How would you cut a cake in 3 pieces in 3 times ?
Write a query for updating an entity in the table as primary entity.
What is the difference between drop and truncate.
Given an array with N elements, the task is to reverse all the array elements and print the reversed array.
Input Format:
The first line contains an integer N representing the size of the array...read more
Write a query to output the data of students whose name starts with A
Q25. how is multithreading implemented in JAVA
Multithreading in Java allows concurrent execution of multiple threads.
Java provides built-in support for multithreading through the java.lang.Thread class.
Threads can be created by extending the Thread class or implementing the Runnable interface.
The start() method is used to start a new thread, which calls the run() method.
Synchronization mechanisms like synchronized blocks and locks can be used to control access to shared resources.
Java also provides high-level concurrency...read more
Q26. how wil you dispaly data of two tables? explain?
Display data of two tables by joining them using a common column.
Use SQL JOIN statement to combine data from two tables based on a common column.
Choose the appropriate type of JOIN based on the relationship between the tables.
Specify the columns to be displayed in the SELECT statement.
Use aliases to differentiate between columns with the same name in both tables.
Apply any necessary filters or sorting to the result set.
Q27. what is the difference between method and block.
Method is a named block of code that can be called multiple times, while a block is a group of statements enclosed in curly braces.
A method has a name and can accept parameters, while a block does not.
A method can return a value, while a block cannot.
A method can be called from anywhere in the program, while a block is only accessible within the scope it was defined.
Example of a method: public int add(int a, int b) { return a + b; }
Example of a block: if (condition) { int x =...read more
Define OS and Process table
Q29. what is variable and types of variable.
A variable is a container that holds a value. There are different types of variables in programming.
Variables are used to store data in a program
They can be assigned different values during runtime
Types of variables include integers, floats, strings, booleans, and more
Variables can be declared with a specific data type or left untyped
Examples: int age = 25, float price = 9.99, string name = 'John Doe'
Q30. What is the use of circular linked list
Circular linked list is a linked list where the last node points back to the first node, forming a circle.
Allows for efficient traversal from the end of the list to the beginning
Useful for applications where data needs to be accessed in a circular manner, such as round-robin scheduling
Can be used to implement a circular buffer in data structures
Q31. Multithreading and servlets in Java
Multithreading and servlets are important concepts in Java for concurrent programming and web development.
Multithreading allows multiple threads to run concurrently, improving performance and responsiveness of applications.
Servlets are Java classes that handle HTTP requests and generate responses, used for web development.
Multithreading can be used in servlets to handle multiple requests simultaneously.
However, care must be taken to ensure thread safety and avoid race conditi...read more
Q32. From Java what is friend function
Friend function is not a concept in Java.
Friend function is a concept in C++ where a non-member function can access private and protected members of a class.
Java does not have the concept of friend function.
In Java, access to private and protected members of a class is restricted to the class itself and its subclasses.
Q33. What are the 4 basic principles of OOPS?
The 4 basic principles of OOPS are Abstraction, Encapsulation, Inheritance, and Polymorphism.
Abstraction: Hiding complex implementation details and showing only necessary information.
Encapsulation: Binding data and functions together and restricting access to them.
Inheritance: Creating new classes from existing ones, inheriting properties and methods.
Polymorphism: Ability of objects to take on multiple forms or behaviors.
Q34. What's class and object?
A class is a blueprint for creating objects in object-oriented programming. An object is an instance of a class.
A class defines the properties and behaviors of objects.
An object is a specific instance of a class.
Classes can be thought of as templates, while objects are the actual instances created from those templates.
Example: Class 'Car' may have properties like 'color' and 'model', while an object of class 'Car' could be 'red Ferrari'.
Q35. Difference between power pivot and powet query
Power Pivot is used for data modeling and analysis while Power Query is used for data transformation and cleaning.
Power Pivot is an Excel add-in used for creating data models and performing complex analysis.
Power Query is also an Excel add-in used for data transformation and cleaning before analysis.
Power Pivot can handle large amounts of data and create relationships between tables.
Power Query can extract data from various sources and transform it into a usable format.
Both t...read more
Q36. What is Event Emitter ?
Event Emitter is a class in Node.js that allows objects to subscribe to events and be notified when those events occur.
Event Emitter is a core module in Node.js
It allows multiple objects to listen for and respond to events
Objects can emit events using the 'emit' method
Listeners can be added using the 'on' method
Example: const EventEmitter = require('events');
Q37. Tell me about event loop?
Event loop is a mechanism that allows for asynchronous programming by handling events and callbacks.
Event loop is a single-threaded mechanism used in programming languages like JavaScript to handle asynchronous operations.
It continuously checks the call stack for any functions that need to be executed, and processes them in a non-blocking manner.
Event loop allows for efficient handling of I/O operations, timers, and callbacks without blocking the main thread.
Example: In Node....read more
Q38. How to get the latest version
To get the latest version, check the official website or app store for updates.
Check the official website or app store for updates
Look for release notes or changelogs to see what's new
Consider subscribing to the software's newsletter or social media for announcements
Q39. What is components in angular?
Components in Angular are reusable building blocks that encapsulate HTML, CSS, and TypeScript code.
Components are the basic building blocks of an Angular application
Each component consists of a TypeScript class, an HTML template, and a CSS file
Components help in organizing the application into smaller, reusable pieces
Components can communicate with each other using @Input and @Output decorators
Example: AppComponent is the root component in an Angular application
Q40. Explain the technical
Technical explanation of what?
Please provide more context or specify the topic
Without more information, it's difficult to give a meaningful answer
Q41. What's enum class?
Enum class is a strongly-typed class that defines a set of named constants.
Enum class is introduced in C++11 to provide type-safe enums.
It allows defining a set of named constants that can be used as values.
Each constant in an enum class is treated as a separate type, preventing type mismatches.
Example: enum class Color { RED, GREEN, BLUE };
Example: Color c = Color::RED;
Q42. Explain the functionality of linked list
Linked list is a data structure that stores elements in a linear order and allows dynamic memory allocation.
Consists of nodes that contain data and a pointer to the next node
Can be singly or doubly linked
Insertion and deletion can be done efficiently
Traversal is slower compared to arrays
Examples: stack, queue, hash table
Q43. what are joins in sql
Joins in SQL are used to combine rows from two or more tables based on a related column between them.
Joins are used to retrieve data from multiple tables based on a related column
Common types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN
Example: SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column
Q44. How node.js works?
Node.js is a runtime environment that allows you to run JavaScript on the server side.
Node.js uses an event-driven, non-blocking I/O model, making it lightweight and efficient.
It is built on the V8 JavaScript engine from Google Chrome.
Node.js allows you to easily build scalable network applications.
Example: Creating a simple HTTP server in Node.js - const http = require('http'); http.createServer((req, res) => { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hel...read more
Q45. Tell about dbms .
DBMS stands for Database Management System. It is a software system that allows users to define, create, maintain and control access to databases.
DBMS is used to manage large amounts of data efficiently.
It provides a way to store, retrieve and manipulate data in a structured manner.
It ensures data integrity and security by providing access control and backup and recovery mechanisms.
Examples of DBMS include MySQL, Oracle, SQL Server, and MongoDB.
Q46. Difference b/w sorting Algorithm
Sorting algorithms arrange data in a specific order.
Bubble Sort: repeatedly swap adjacent elements if they are in the wrong order
Selection Sort: find the smallest element and swap it with the first element, repeat for remaining elements
Insertion Sort: insert each element into its proper place in a sorted subarray
Merge Sort: divide the array into two halves, sort each half, and merge them together
Quick Sort: choose a pivot element, partition the array around the pivot, and rec...read more
Q47. what is oops concept?
OOPs is a programming paradigm based on the concept of objects, which can contain data and code.
OOPs stands for Object-Oriented Programming.
It focuses on creating objects that interact with each other to solve a problem.
It includes concepts like inheritance, encapsulation, polymorphism, and abstraction.
Inheritance allows a class to inherit properties and methods from another class.
Encapsulation is the practice of hiding data and methods within a class.
Polymorphism allows obje...read more
Q48. What is Dax and types
DAX stands for Data Analysis Expressions and is a formula language used in Power BI, Excel, and SQL Server Analysis Services.
DAX is used to create custom calculations and aggregations in data models.
It includes functions for filtering, grouping, and manipulating data.
There are two types of DAX expressions: calculated columns and measures.
Calculated columns are computed during data model creation and are stored in the model.
Measures are computed on the fly during query executi...read more
Q49. Why use javascript
JavaScript is a versatile programming language used for web development, allowing for dynamic and interactive website functionality.
JavaScript is the only programming language that can be executed directly in a web browser, making it essential for front-end web development.
It enables the creation of interactive elements like forms, animations, and dynamic content on websites.
JavaScript can be used for both client-side and server-side development, making it a versatile languag...read more
Q50. Why use java script
JavaScript is a versatile programming language used for creating interactive web pages and web applications.
JavaScript allows for dynamic and interactive web content.
It can be used for client-side and server-side development.
JavaScript has a large and active community, with extensive libraries and frameworks available.
It is supported by all major web browsers.
JavaScript can be used for creating games, mobile apps, and desktop applications.
Q51. What is future goal
My future goal is to become a senior software developer and eventually a tech lead, leading a team of developers to create innovative solutions.
Continue learning and improving my technical skills through courses and certifications
Gain experience in different areas of software development such as front-end, back-end, and mobile development
Work on challenging projects that push my limits and allow me to grow as a developer
Q52. What is build in jcl
Build in JCL is a job control language statement used to compile and link programs in mainframe environments.
Build statement is used to compile and link programs in JCL.
It specifies the program to be compiled and linked, as well as any necessary parameters.
Example: //BUILD EXEC PGM=IEBGENER,PARM='INPUT=SYSUT1,OUTPUT=SYSUT2'
Q53. What is build
A build is a version of a software program that is compiled and ready for testing or release.
A build is created by compiling the source code of a software program.
It includes all necessary files and dependencies for the program to run.
Builds can be categorized as debug builds for testing and release builds for distribution.
Examples: Debug build of an app with logging enabled, Release build of a website ready for deployment.
Q54. Swap numbers without temp
Swapping numbers without using a temporary variable.
Use addition and subtraction to swap values
Use XOR operator to swap values
Use multiplication and division to swap values
Q55. Types of dbs etc
There are various types of databases such as relational, NoSQL, graph, and document-oriented databases.
Relational databases store data in tables with predefined relationships between them.
NoSQL databases are non-relational and can handle unstructured data.
Graph databases store data in nodes and edges, and are useful for complex relationships.
Document-oriented databases store data in documents, similar to JSON objects.
Examples include MySQL, MongoDB, Neo4j, and Cassandra.
Q56. Q. explain threads ?
Threads are lightweight processes that enable multitasking within a single process.
Threads share the same memory space as the parent process.
Threads can communicate with each other through shared memory.
Threads can be created and managed using threading libraries in programming languages.
Examples of threading libraries include pthreads in C/C++, and threading module in Python.
Q57. Strengths and goals of mine
My strengths include problem-solving, attention to detail, and teamwork. My goal is to continuously improve my skills and contribute to the success of the company.
Strong problem-solving skills, able to analyze complex issues and find effective solutions
Attention to detail, ensuring accuracy and quality in all work
Collaborative team player, able to communicate effectively and work towards common goals
Goal-oriented mindset, always seeking to improve skills and contribute to com...read more
Q58. C vs c++ difference
C is a procedural programming language while C++ is an object-oriented programming language.
C is a procedural language, focusing on functions and procedures.
C++ is an object-oriented language, allowing for classes, objects, and inheritance.
C++ is an extension of C, adding features like classes, templates, and exception handling.
Q59. Check the output
The code will output 'Hello World!'
The code likely contains a print statement with the text 'Hello World!'
There may be a variable assignment with the value 'Hello World!'
More about working at TCS
Top HR Questions asked in null
Interview Process at null
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month