TCS
1000+ K21 Consulting Interview Questions and Answers
Q101. How to install os on server
To install an OS on a server, you need to boot from the installation media and follow the on-screen instructions.
Insert the installation media (such as a USB drive or DVD) into the server
Boot the server from the installation media
Follow the on-screen instructions to select the OS version, partition the disk, and complete the installation process
Q102. Types of joins?
Types of joins in SQL include inner join, left join, right join, and full outer join.
Inner join returns only the matching rows from both tables.
Left join returns all rows from the left table and the matching rows from the right table.
Right join returns all rows from the right table and the matching rows from the left table.
Full outer join returns all rows from both tables, including unmatched rows.
Q103. file handle in c?
A file handle in C is a pointer that represents a file stream, allowing operations like reading and writing.
A file handle is typically obtained by opening a file using functions like fopen()
File handles are used to perform operations like reading, writing, and closing files
They can be passed as arguments to functions like fread(), fwrite(), and fclose()
File handles can be used to check for errors during file operations
Q104. what is module.exports
module.exports is a special object in Node.js that allows you to export functions, objects, or primitive values from a module.
Used to export functions, objects, or primitive values from a module
Can be assigned directly to a function, object, or value to be exported
Commonly used in Node.js to create reusable modules
Q105. 1. Find if a number belongs to a Fibonacci series
Check if a number belongs to Fibonacci series
Check if the given number is a perfect square
If yes, check if 5*n^2 + 4 or 5*n^2 - 4 is a perfect square
If yes, then the number belongs to Fibonacci series
Q106. Minimum Count of Balls in a Bag Problem Statement
You are given an integer array ARR
of size N
, where ARR[i]
represents the number of balls in the i-th
bag. Additionally, you have an integer M
, which indicates ...read more
Longest Switching Subarray Problem Statement
You are provided with an array 'ARR' consisting of 'N' positive integers. Your task is to determine the length of the longest contiguous subarray that is switching.
Q108. Factorial Calculation Problem
Given an integer N
, determine the factorial value of N
. The factorial of a number N
is the product of all positive integers from 1 to N
.
Input:
First line of input: An integer 'T',...read more
Q109. What is abstraction in Java?
Abstraction in Java is the concept of hiding the implementation details and showing only the necessary features of an object.
Abstraction allows you to define the structure of an object without specifying the implementation details.
Abstract classes and interfaces are used to achieve abstraction in Java.
Abstract classes can have both abstract and concrete methods, while interfaces can only have abstract methods.
Example: abstract class Animal { abstract void makeSound(); }
Exampl...read more
Q110. 3.Write a program to find number is prime or not
A program to determine if a given number is prime or not.
Iterate from 2 to the square root of the number and check if it divides the number evenly
If any number divides the given number evenly, it is not prime
If no number divides the given number evenly, it is prime
Q111. Smallest Number with Given Digit Product
Given a positive integer 'N', find and return the smallest number 'M', such that the product of all the digits in 'M' is equal to 'N'. If such an 'M' is not possible or ...read more
Q112. Write a query to join two db tables
Query to join two database tables
Use the JOIN keyword in SQL to combine rows from two tables based on a related column
Specify the columns to be joined on using the ON keyword
Common types of joins include INNER JOIN, LEFT JOIN, and RIGHT JOIN
Q113. diff b/w protractor and selenium
Protractor is a testing framework specifically for Angular applications, while Selenium is a general-purpose testing tool for web applications.
Protractor is built on top of WebDriverJS and is designed to test Angular applications.
Selenium is a standalone testing tool that supports multiple programming languages and browsers.
Protractor has built-in support for Angular-specific locator strategies like ng-model, ng-binding, etc.
Selenium requires additional setup and configuratio...read more
Q114. Difference between ArrayList and LinkedList
ArrayList is implemented using a dynamic array while LinkedList is implemented using a doubly linked list.
ArrayList provides fast random access but slow insertion and deletion. LinkedList provides fast insertion and deletion but slow random access.
ArrayList uses more memory as it needs to allocate space for the entire array. LinkedList uses less memory as it only needs to store the elements and references.
Example: ArrayList is suitable for scenarios where random access is fre...read more
Q115. Loot Houses Problem Statement
A thief is planning to steal from several houses along a street. Each house has a certain amount of money stashed. However, the thief cannot loot two adjacent houses. Determine the...read more
Q116. Find Duplicates in an Array
Given an array ARR
of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.
Return the duplicate elements in any order. If n...read more
Q117. Add Two Numbers Represented as Linked Lists
Given two linked lists representing two non-negative integers, where the digits are stored in reverse order (i.e., starting from the least significant digit to the mo...read more
Q118. Jar of Candies Problem Statement
You are given a jar containing candies with a maximum capacity of 'N'. The jar cannot have less than 1 candy at any point. Given 'K', the number of candies a customer wants, det...read more
Q119. Middle of a Linked List
You are given the head node of a singly linked list. Your task is to return a pointer pointing to the middle of the linked list.
If there is an odd number of elements, return the middle ...read more
Q120. Stack using Two Queues Problem Statement
Develop a Stack Data Structure to store integer values using two Queues internally.
Your stack implementation should provide these public functions:
Explanation:
1. Cons...read more
Q121. Explain the concepts of OOPs
OOPs stands for Object-Oriented Programming concepts which include encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation: Bundling data and methods that operate on the data into a single unit (object).
Inheritance: Ability of a class to inherit properties and behavior from another class.
Polymorphism: Ability to present the same interface for different data types.
Abstraction: Hiding the complex implementation details and showing only the necessary features of ...read more
Q122. Explain about clouds and IoT
Clouds and IoT are interconnected technologies that work together to enable data storage, processing, and communication for Internet-connected devices.
Cloud computing provides the infrastructure and resources needed for IoT devices to store and process data.
IoT devices collect and transmit data to the cloud for storage and analysis.
Cloud platforms offer scalability and flexibility for IoT applications, allowing for efficient data management and processing.
Examples include usi...read more
Q123. Distance Greater Than K Problem Statement
You are provided an undirected graph, a source vertex, and an integer k
. Determine if there is any simple path (without any cycle) from the source vertex to any other v...read more
Q124. Find depth of a tree, write pseudocode.
Calculate the depth of a tree using pseudocode.
Traverse the tree recursively and keep track of the depth at each level
Return the maximum depth found
Pseudocode: function findDepth(node) { if node is null, return 0; return 1 + max(findDepth(node.left), findDepth(node.right)); }
Q125. Why string is immutable
String is immutable in Java to ensure data integrity and security.
Immutable strings prevent accidental changes to data
String pooling reduces memory usage by reusing common strings
Security - sensitive information cannot be modified once set
Q126. Heap Sort Problem Statement
Your task is to sort an array of integers in non-decreasing order using the Heap Sort algorithm.
Input:
The first line contains an integer 'T' denoting the number of test cases.
Each...read more
Q127. functon of the MODEM
A modem is a device that modulates and demodulates signals to enable communication between devices over a network.
Modulates digital signals into analog signals for transmission over telephone lines
Demodulates analog signals back into digital signals for use by the receiving device
Can be used for dial-up internet connections or to connect to a local area network (LAN)
Examples include cable modems, DSL modems, and wireless modems
Q128. Yogesh And Primes Problem Statement
Yogesh, a bright student interested in Machine Learning research, must pass a test set by Professor Peter. To do so, Yogesh must correctly answer Q questions where each quest...read more
Q129. DSA - design binary search tree
Design a binary search tree (BST) to efficiently store and retrieve data in a sorted manner.
Start with a root node and insert new nodes based on their values compared to existing nodes.
Left child nodes should have values less than their parent node, while right child nodes should have values greater.
Implement functions for insertion, deletion, and searching in the BST.
Balancing the tree can improve performance by ensuring it remains relatively balanced.
Example: Inserting valu...read more
Q130. What are stored procedures
Stored procedures are precompiled SQL queries stored in a database for reuse.
Stored procedures are used to perform a specific task or set of tasks in a database.
They can accept input parameters and return results.
Stored procedures can improve performance by reducing network traffic and optimizing query execution.
Examples include procedures for inserting, updating, or deleting data in a database.
Q131. Explain Opps concept and described each
Object-oriented programming (OOP) is a programming paradigm that uses objects to represent and manipulate data.
OOP is based on the concept of classes and objects.
Encapsulation is the process of hiding the internal details of an object and providing access only through methods.
Inheritance allows classes to inherit properties and methods from other classes.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
Abstraction is the process...read more
Q132. Print dictionary in python?
Use Python's print function to display a dictionary.
Use the print function with the dictionary as the argument.
The dictionary will be displayed in key-value pairs.
You can also use a loop to print each key-value pair individually.
Q133. Write program for Fibonacci series
Program to generate Fibonacci series
Declare variables for first two numbers in series
Loop through desired number of iterations
Calculate next number in series by adding previous two
Print or store each number in series
Q134. JUMP GAME 1-D DP ON ARRAYS
Using dynamic programming to solve the jump game problem on arrays.
Create a DP array to store if it is possible to reach each index from the start.
Iterate through the array and update the DP array based on the maximum reachable index.
Return true if the last index is reachable, false otherwise.
Q135. What is super keyword
Super keyword is used to refer to the parent class constructor or method.
Used in inheritance to call parent class constructor
Used to access parent class variables and methods
Can be used with 'this' keyword to call overloaded constructor
Q136. Array sorting use different approach
Array sorting can be done using different algorithms like bubble sort, merge sort, quick sort, etc.
Bubble sort compares adjacent elements and swaps them if they are in the wrong order.
Merge sort divides the array into two halves, sorts them separately, and then merges them.
Quick sort picks a pivot element and partitions the array around the pivot.
Example: Sorting an array of strings alphabetically using merge sort.
Q137. #include int main() { int any = ' ' * 10; printf("%d", any); return 0; } What is the output?
The program outputs 320, which is the ASCII value of space multiplied by 10.
The variable 'any' is assigned the value of ' ' (space) multiplied by 10, which is 320 in ASCII.
The printf statement outputs the value of 'any', which is 320.
The #include statement is not relevant to the output of the program.
Q138. What are functions
Functions are blocks of code that perform a specific task and can be called multiple times within a program.
Functions help in organizing code by breaking it into smaller, manageable parts.
They improve code reusability by allowing the same block of code to be used in multiple places.
Functions can take input parameters and return output values.
Examples: summing two numbers, finding the maximum value in an array, printing a message to the console.
Q139. what is a class
A class is a blueprint for creating objects in object-oriented programming.
A class defines the properties and behaviors of objects.
Objects are instances of a class.
Classes can inherit properties and behaviors from other classes.
Encapsulation, inheritance, and polymorphism are key concepts in class-based programming.
Q140. what is a process
A process is a series of actions or steps taken to achieve a particular goal or outcome.
A process typically has a defined beginning and end.
It involves a sequence of tasks or activities that are interconnected.
Processes can be linear or iterative, depending on the nature of the goal.
Examples include software development process, manufacturing process, and decision-making process.
Q141. Explain more about cloud computing
Cloud computing is the delivery of computing services over the internet, including storage, servers, databases, networking, software, and more.
Cloud computing allows users to access and use resources on-demand without the need for physical infrastructure.
It offers scalability, flexibility, cost-effectiveness, and the ability to access resources from anywhere with an internet connection.
Examples of cloud computing services include Amazon Web Services (AWS), Microsoft Azure, Go...read more
Q142. Explain solid principles an detail
The SOLID principles are a set of design principles that help in creating maintainable and scalable software systems.
S - Single Responsibility Principle: A class should have only one reason to change.
O - Open-Closed Principle: Software entities should be open for extension but closed for modification.
L - Liskov Substitution Principle: Subtypes must be substitutable for their base types.
I - Interface Segregation Principle: Clients should not be forced to depend on interfaces t...read more
Q143. diff between C++ and Python
C++ is a statically typed language with high performance, while Python is dynamically typed with simpler syntax.
C++ is statically typed, while Python is dynamically typed
C++ is compiled, while Python is interpreted
C++ is better for performance-critical applications, while Python is better for rapid development
C++ requires explicit memory management, while Python has automatic memory management
C++ is used for system programming, game development, etc., while Python is used for...read more
Q144. diff types polymorphism.
Polymorphism in programming refers to the ability of a single function or method to operate on different types of data.
Types of polymorphism include compile-time polymorphism (function overloading) and runtime polymorphism (function overriding)
Compile-time polymorphism is achieved through method overloading, where multiple methods have the same name but different parameters
Runtime polymorphism is achieved through method overriding, where a subclass provides a specific impleme...read more
Q145. Explain inheritance in detail
Inheritance is a concept in object-oriented programming where a class inherits attributes and methods from another class.
Inheritance allows a class to inherit properties and behavior from another class, known as the parent class or base class.
The class that inherits from the parent class is called the child class or derived class.
Child classes can add new attributes or methods, or override existing ones from the parent class.
Inheritance promotes code reusability and helps in ...read more
Q146. Difference between oop and pop
OOP stands for Object-Oriented Programming, while POP stands for Procedural-Oriented Programming.
OOP focuses on objects and classes, allowing for encapsulation, inheritance, and polymorphism.
POP focuses on procedures and functions, with a top-down approach to programming.
OOP promotes code reusability and modularity, while POP can lead to spaghetti code.
Examples of OOP languages include Java and C++, while examples of POP languages include C and Pascal.
Q147. Projects done and explanation
I have worked on multiple projects including network infrastructure setup, cloud migration, and software development.
Setup network infrastructure for a small business using Cisco routers and switches
Migrated on-premise servers to AWS cloud using EC2 instances and S3 storage
Developed a web application using Python and Django framework for a client
Implemented disaster recovery plan for a financial institution using VMware Site Recovery Manager
Designed and deployed a VoIP phone ...read more
Q148. What is the heap
The heap is a region of a computer's memory used for dynamic memory allocation.
The heap is managed by the operating system and is separate from the stack.
Memory allocated on the heap must be explicitly deallocated to prevent memory leaks.
Common functions for heap memory management include malloc, calloc, realloc, and free.
Q149. HEIGHT OF BINARY TREE
The height of a binary tree is the number of edges on the longest path from the root node to a leaf node.
Height of an empty tree is 0.
Height of a tree with only one node is 1.
Height of a binary tree can be calculated recursively by finding the height of the left and right subtrees and adding 1 to the maximum of the two heights.
Q150. Binary Palindrome Check
Given an integer N
, determine whether its binary representation is a palindrome.
Input:
The first line contains an integer 'T' representing the number of test cases.
The next 'T' lines e...read more
Q151. Pair Sum Problem Statement
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.
Note:
Each pa...read more
Q152. explain types of oops concepts
Object-oriented programming concepts include inheritance, encapsulation, polymorphism, and abstraction.
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.
Polymorphism: Ability to present the same interface for different data types.
Abstraction: Hiding the complex implementation details and showing only the necessary features.
Q153. 4. Design url shortner
A URL shortener is a tool that takes a long URL and creates a shorter, more manageable link.
Generate a unique short code for each long URL
Store the short code and long URL in a database
Redirect users to the long URL when they visit the short URL
Track clicks and provide analytics for each short URL
Q154. Difference between jdk and jvm
JDK is a development kit that includes JVM, while JVM is a virtual machine that executes Java code.
JDK stands for Java Development Kit and includes tools for developing and compiling Java programs
JVM stands for Java Virtual Machine and is responsible for executing Java code
JDK includes JVM, along with other tools such as javac, jar, and javadoc
JVM is platform-dependent, while JDK is platform-independent
JDK is required for developing Java applications, while JVM is required fo...read more
Q155. 2.Difference between c and c++
C is a procedural programming language while C++ is a combination of procedural and object-oriented programming language.
C is a procedural programming language while C++ is a combination of procedural and object-oriented programming language.
C does not support classes and objects while C++ does.
C does not have function overloading and namespaces like C++.
C does not have exception handling like C++.
C does not have references like C++.
Q156. action class describe
Action class in Java is used to encapsulate the request processing logic in a separate class.
Action class is a part of the Apache Struts framework in Java.
It is responsible for handling the user's request and generating the response.
Action class contains the execute() method which is invoked by the framework to process the request.
It helps in separating the business logic from the presentation logic.
Example: public class LoginAction extends Action { }
Q157. Working of Linked list
A linked list is a data structure that consists of a sequence of nodes, where each node contains a reference to the next node.
Linked list is a dynamic data structure.
Each node in a linked list contains two parts: data and a reference to the next node.
The last node in a linked list points to null.
Insertion and deletion operations are efficient in a linked list compared to an array.
Traversal in a linked list starts from the head node and follows the next references until the en...read more
Q158. What are the uses of OOPS?
OOPS is used for creating modular, reusable and maintainable code.
Encapsulation: Hiding implementation details and exposing only necessary information.
Inheritance: Reusing code and creating a hierarchy of classes.
Polymorphism: Using a single interface to represent multiple types of objects.
Abstraction: Simplifying complex systems by breaking them down into smaller, more manageable parts.
Examples: Java, C++, Python, Ruby, etc.
Q159. Kth Element in a BST
Finding the Kth element in a Binary Search Tree (BST)
Inorder traversal of BST gives elements in sorted order
Use recursive or iterative approach to find Kth element
Keep track of count of nodes visited to find Kth element
Q161. Assume, you are the product manager and you need to sell a product, how will you approach and tell me the steps for doing so ?
As a product manager, I would approach selling a product by identifying the target audience, creating a unique value proposition, and utilizing various marketing channels.
Identify the target audience and their needs
Create a unique value proposition that addresses those needs
Utilize various marketing channels such as social media, email marketing, and advertising to reach the target audience
Provide product demos or trials to potential customers
Collect feedback and make necessa...read more
Q162. Given N gold wires, each wire has a length associated with it. At a time, only two adjacent small wires are assembled at the end of a large wire and the cost of forming is the sum of their length. Find the mini...
read moreGiven N gold wires with lengths, find minimum cost to assemble all wires into a single wire.
Only two adjacent small wires can be assembled at a time
Cost of forming is the sum of their length
Use dynamic programming to find minimum cost
Example: N=4, lengths=[2,3,4,5], minimum cost=29
Q163. Compute the nearest larger number by interchanging its digits updated.Given 2 numbers a and b find the smallest number greater than b by interchanging the digits of a and if not possible print -1.
Compute the nearest larger number by interchanging its digits.
Given two numbers a and b
Find the smallest number greater than b by interchanging the digits of a
If not possible, print -1
Q164. What is an Agile Model?
Agile Model is an iterative approach to software development that emphasizes flexibility and customer satisfaction.
Agile Model involves continuous collaboration between cross-functional teams and customers
It prioritizes working software over comprehensive documentation
It allows for changes and adjustments to be made throughout the development process
Examples of Agile methodologies include Scrum, Kanban, and Extreme Programming (XP)
Q165. Reverse Array Elements
Given an array containing 'N' elements, the task is to reverse the order of all array elements and display the reversed array.
Explanation:
The elements of the given array need to be rear...read more
Q166. hashmap working
HashMap is a data structure that stores key-value pairs and allows for fast retrieval of values based on keys.
HashMap uses hashing to store and retrieve key-value pairs efficiently.
Keys in a HashMap must be unique, but values can be duplicated.
HashMap allows for null keys and null values.
Example: HashMap
map = new HashMap<>(); map.put("apple", 5); int value = map.get("apple");
Q167. Minimum Number of Platforms Needed Problem Statement
You are given the arrival and departure times of N trains at a railway station for a particular day. Your task is to determine the minimum number of platform...read more
Q168. What is linklist ? Write a code to insert a node at the beginning of list ?
A linked list is a data structure that consists of a sequence of nodes, where each node contains a reference to the next node.
A linked list is a dynamic data structure that can grow or shrink as needed.
Each node in a linked list contains two parts: data and a reference to the next node.
To insert a node at the beginning of a linked list, we create a new node, set its data, and update the reference of the new node to point to the current head of the list.
Q169. What is the difference between c and c++?
C++ is an extension of C with object-oriented programming features.
C++ supports classes and objects while C does not.
C++ has better support for polymorphism and inheritance.
C++ has a standard template library (STL) while C does not.
C++ is more complex and has more features than C.
C++ is often used for developing large-scale software projects.
C is often used for system programming and embedded systems.
Q170. What set in java and what is difference between hash set and map
Set is a collection interface in Java. HashSet and HashMap are two different implementations of Set.
Set is an interface that extends Collection interface.
HashSet is an implementation of Set that uses a hash table to store elements.
HashMap is an implementation of Map that uses a hash table to store key-value pairs.
HashSet does not allow duplicate elements while HashMap allows duplicate values but not duplicate keys.
HashSet uses only one object to store elements while HashMap u...read more
Q171. Write a program to swap two numbers without using third variable
Program to swap two numbers without using third variable
Use the XOR operation to swap the numbers
Assign the first number to the second number using XOR
Assign the second number to the first number using XOR
Q172. What are local variable and global variables? and their default values and program
Local variables are declared within a specific function or block, while global variables are declared outside of any function or block.
Local variables have a limited scope and are only accessible within the function or block where they are declared.
Global variables can be accessed from anywhere in the program.
Local variables are created when a function is called and destroyed when the function ends.
Global variables are created when the program starts and exist until the progr...read more
Q173. What is arraylist ? Advantage over generic arrays ?
ArrayList is a dynamic array that can grow or shrink in size. It provides advantages like dynamic resizing and built-in methods.
ArrayList is a resizable array implementation of the List interface in Java.
It can store elements of any type, including objects and primitives.
Advantages over generic arrays include dynamic resizing, automatic memory management, and built-in methods like add(), remove(), etc.
Example: ArrayList
names = new ArrayList (); names.add("John"); names.add("Ja...read more
Q174. Did you participate in any program offered by tcs like codevita etc..?
Yes, I have participated in TCS CodeVita.
I participated in TCS CodeVita in 2020 and 2021.
I was able to solve several coding problems during the competition.
Participating in CodeVita helped me improve my coding skills and problem-solving abilities.
Q176. What is a Waterfall Model?
Waterfall Model is a linear sequential approach to software development.
It follows a sequential process where each phase must be completed before moving to the next.
It is a rigid model and changes cannot be made once a phase is completed.
It is suitable for projects with well-defined requirements and a stable scope.
Examples of industries that use this model are construction and manufacturing.
Phases include requirements gathering, design, implementation, testing, deployment, an...read more
Q177. Allocate Books Problem Statement
Given an array of integers arr
, where arr[i]
represents the number of pages in the i-th
book, and an integer m
representing the number of students, allocate all the books in suc...read more
Q178. What is asymptotic notation ?
Asymptotic notation is a way to describe the performance of an algorithm by analyzing its behavior as the input size approaches infinity.
Asymptotic notation is used to analyze the efficiency and scalability of algorithms.
It provides a way to compare algorithms based on their growth rates.
Commonly used asymptotic notations include Big O, Big Omega, and Big Theta.
Big O notation represents the upper bound or worst-case scenario of an algorithm's time complexity.
For example, an a...read more
Q179. 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
Q180. What is the difference between unions and joins? What is the difference between primary and unique keys?
Unions and joins are used to combine data from multiple tables. Primary keys are unique identifiers for a table, while unique keys ensure uniqueness of a column.
Unions combine data from two or more tables into a single result set, while joins combine data from two or more tables based on a common column.
Primary keys are used to uniquely identify each row in a table and cannot contain null values. Unique keys ensure that a column has unique values, but can contain null values....read more
Q181. Will you sign the service bonds?
Yes, I am willing to sign the service bonds.
I understand the importance of service bonds in ensuring job security and commitment to the company.
I am willing to commit to the terms and conditions of the bond.
I believe in the company's vision and goals and am excited to contribute to its growth.
I have signed service bonds in the past and have fulfilled my obligations.
I am open to discussing the terms of the bond before signing.
Q182. Write a program to find a number that is palindrome or not ?
Program to check if a number is palindrome or not.
Convert the number to a string
Reverse the string
Compare the reversed string with the original string
If they are equal, the number is a palindrome
Q183. What are the advantage and disadvantages of an array over Linked List?
Arrays offer constant time access and efficient memory usage, but have fixed size. Linked lists have dynamic size but slower access.
Arrays provide constant time access to elements using index
Arrays have efficient memory usage as they store elements in contiguous memory locations
Arrays have a fixed size and cannot be easily resized
Linked lists have dynamic size and can grow or shrink as needed
Linked lists allow efficient insertion and deletion of elements
Linked lists require e...read more
Q184. What is join (Database) ?inner join ,outer join ?
Join is a database operation that combines rows from two or more tables based on a related column between them.
Inner join returns only the matching rows from both tables.
Outer join returns all the rows from one table and the matching rows from the other table.
There are different types of outer joins: left outer join, right outer join, and full outer join.
Joining tables can be done using the JOIN keyword in SQL.
Example: SELECT * FROM table1 INNER JOIN table2 ON table1.column =...read more
Q185. Basic print function of python and OOPS concept explanation
Python's print function and OOPS concept explanation
The print() function is used to display output on the console
It can take multiple arguments separated by commas
OOPS stands for Object-Oriented Programming System
It is a programming paradigm based on the concept of objects
Objects have properties (attributes) and methods (functions)
Encapsulation, inheritance, and polymorphism are key OOPS concepts
Q186. What is the use of python programming language on real problem ?
Python is a versatile programming language used for solving real-world problems in various fields.
Python is used for web development, data analysis, machine learning, and artificial intelligence.
It is used in scientific computing, finance, and gaming industries.
Python is used for automation, scripting, and building desktop applications.
It is also used for creating chatbots, web crawlers, and data visualization tools.
Python's simplicity, readability, and vast libraries make it...read more
Q187. You have done a lot of courses in coursera and NPTEL. What is the use of it?
Courses in Coursera and NPTEL provide knowledge and skills in various fields.
Courses in Coursera and NPTEL offer a wide range of topics to learn from.
They provide access to high-quality education from top universities and institutions.
The courses help in developing new skills and enhancing existing ones.
They can be useful for career advancement and personal growth.
For example, a course in data science can help in analyzing and interpreting data for business decisions.
Similarl...read more
Q188. What is sap co and personal account and nominal account and that financial statement tedious and GST in explain and for this P2P cycle and asset accounting
SAP CO is a module for controlling and managing costs in an organization. Personal and nominal accounts are used in financial accounting. GST is a tax system. P2P cycle is a procurement process. Asset accounting is for managing fixed assets.
SAP CO is used for cost controlling and management
Personal accounts are used for individuals and nominal accounts are used for expenses and revenues
GST is a tax system used in India and other countries
P2P cycle is a procurement process fro...read more
Q189. What is the difference between Delete and Truncate commands?
Delete command removes rows from a table, while Truncate command removes all rows from a table.
Delete command is a DML (Data Manipulation Language) command, while Truncate command is a DDL (Data Definition Language) command.
Delete command can be rolled back, while Truncate command cannot be rolled back.
Delete command fires triggers, while Truncate command does not fire triggers.
Delete command is slower as it maintains logs, while Truncate command is faster as it does not main...read more
Q190. 2. What is an array? How to define an array? how to assign value to an array index?
An array is a collection of similar data types. It can be defined and values can be assigned to its indices.
Arrays can be defined using square brackets [] and specifying the size or leaving it empty for dynamic sizing.
Values can be assigned to array indices using the assignment operator = and specifying the index number.
Example: int arr[5]; arr[0] = 1; arr[1] = 2; arr[2] = 3; arr[3] = 4; arr[4] = 5;
Arrays can also be initialized during declaration like int arr[] = {1, 2, 3, 4...read more
Q191. Which programming languages are you comfortable in?
I am comfortable in multiple programming languages including Java, Python, and C++.
Proficient in Java with experience in developing web applications using Spring framework
Skilled in Python with experience in data analysis and machine learning using libraries like NumPy and Pandas
Familiar with C++ and its object-oriented programming concepts
Also comfortable in languages like JavaScript and SQL
Q192. What is difference between truncate, drop and delete?
Truncate, drop, and delete are SQL commands used to remove data from a table, but they differ in their functionality.
Truncate is a DDL command that removes all rows from a table, but keeps the structure intact.
Drop is a DDL command that removes an entire table, including its structure and data.
Delete is a DML command that removes specific rows from a table based on a condition.
Truncate is faster than delete as it doesn't generate any transaction logs.
Drop is irreversible and ...read more
Q193. What is static variable in C? with program
A static variable in C is a variable that retains its value between function calls.
Static variables are declared using the 'static' keyword.
They are initialized only once, at the start of the program.
Their value persists even after the function call ends.
Static variables have a default initial value of 0.
They are useful for maintaining state across function calls.
Q194. Given a maximum of 100 digit numbers as input, find the difference between the sum of odd and even position digits
Find the difference between the sum of odd and even position digits in a maximum of 100 digit number.
Iterate through the digits of the number and add the digits at odd positions to a variable for odd position digits and even positions to a variable for even position digits.
Calculate the difference between the two variables.
Return the difference.
Example: For the number 123456, the sum of digits at odd positions is 1+3+5=9 and the sum of digits at even positions is 2+4+6=12. Th...read more
Q195. 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.
Q196. Write a sql query to find all records whose base branch city is kolkata and haven't been allocated to projects
SQL query to find records with base branch city Kolkata and not allocated to projects
Use SELECT statement to retrieve data from table
Use WHERE clause to filter records with base branch city Kolkata
Use LEFT JOIN to join table with project allocation table
Use IS NULL condition to filter records not allocated to projects
Q197. Given an array Arr[] of N integers and a positive integer K. The task is to cycally rotate the array clockwise by K.
Cyclically rotate an array of N integers clockwise by K.
Create a temporary array of size K and copy the last K elements of the original array into it.
Shift the remaining elements of the original array K positions to the right.
Copy the elements from the temporary array to the beginning of the original array.
Time complexity: O(N)
Space complexity: O(K)
Q198. write a program for swapping 2 numbers without the 3rd variable.
Swapping 2 numbers without a third variable in a program.
Use arithmetic operations to swap the values of the variables.
Add the values of both variables and store the result in one variable.
Subtract the value of the second variable from the sum and store the result in the second variable.
Subtract the value of the first variable from the sum and store the result in the first variable.
Q199. What is call by value and call by reference?
Call by value and call by reference are two ways of passing arguments to a function.
Call by value passes a copy of the argument's value to the function.
Call by reference passes a reference to the argument's memory location to the function.
Call by value is used for simple data types like int, float, etc.
Call by reference is used for complex data types like arrays, structures, etc.
Q200. Write a program for palindromes of a number.
Program to check if a number is a palindrome or not.
Convert the number to a string
Reverse the string
Compare the original string with the reversed string
If they are equal, the number is a palindrome
More about working at TCS
Top HR Questions asked in K21 Consulting
Interview Process at K21 Consulting
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month