TCS
200+ Marks & Spencer Interview Questions and Answers
Q1. #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.
Q2. 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
Q3. Difference between Structure and Union in C programming language, What is OOPs and it’s features ?
Structure and Union are data structures in C. OOPs is Object Oriented Programming paradigm with features like inheritance, polymorphism, encapsulation, and abstraction.
Structure is a collection of variables of different data types under a single name. Union is similar but all variables share the same memory location.
OOPs is a programming paradigm that focuses on objects and their interactions. It features inheritance, where a class can inherit properties and methods from anot...read more
Q4. 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
Q5. 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
Q6. Write a program to print addition of two numbers such that if no number is input by the user then the program should use the "break" syntax of python and end.
Program to print addition of two numbers with break syntax if no input.
Use input() function to take user input
Use try-except block to handle errors
Use while loop to keep taking input until break is entered
Q7. 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
Q8. Principles of oops and explain agile methodologies and explain uses of stack and basic web development questions
Answering questions on OOPs principles, agile methodologies, stack uses, and basic web development.
OOPs principles include encapsulation, inheritance, and polymorphism
Agile methodologies involve iterative and incremental development
Stack is a data structure that follows LIFO principle
Basic web development questions may include HTML, CSS, and JavaScript
HTML is used for creating the structure of a web page
CSS is used for styling the web page
JavaScript is used for adding interac...read more
Q9. What is the logic for sorting the numbers in C programming?
Sorting numbers in C programming involves using various algorithms to arrange them in ascending or descending order.
Common sorting algorithms include bubble sort, insertion sort, selection sort, merge sort, and quicksort.
The choice of algorithm depends on the size of the data set and the efficiency required.
Sorting can be done using loops and conditional statements in C programming.
The sorted array can be printed using a for loop.
Sorting can also be done using library functio...read more
Q10. Can you work in any location? What if we assign you in the Sahara desert with 55 degree Celsius temperature?
Yes, I am willing to work in any location including the Sahara desert with 55 degree Celsius temperature.
I am adaptable and can work in any environment.
I am willing to face challenges and overcome them.
I will take necessary precautions to ensure my safety and health.
I will follow company guidelines and procedures.
Examples: I have worked in remote locations with extreme weather conditions before and have experience in handling such situations.
Q11. Is Java a method based programming language or a function based programming language?
Java is a method based programming language.
Java is a method based programming language because it relies on methods (functions) to perform actions.
In Java, functions are defined within classes and are called using objects or class names.
Example: public void printMessage() { System.out.println("Hello, World!"); }
Q12. Which programming language are you most comfortable in?
I am most comfortable in Java.
I have experience in developing Java applications for both desktop and web environments.
I am familiar with Java frameworks such as Spring and Hibernate.
I have also worked with Java-based tools like Maven and Jenkins.
I am comfortable with object-oriented programming concepts and design patterns in Java.
For example, I have developed a web application using Spring MVC and Hibernate for database connectivity.
Q13. What is polymorphism in java and its types?
Polymorphism is the ability of an object to take on many forms. In Java, it is achieved through method overloading and overriding.
Polymorphism allows objects to be treated as if they are of multiple types.
Method overloading is a type of polymorphism where multiple methods have the same name but different parameters.
Method overriding is a type of polymorphism where a subclass provides its own implementation of a method that is already defined in its superclass.
Polymorphism is ...read more
Q14. Lists are mutable objects whereas as Tuples are immutable. --Mutable objects - Allow you to change the value/data in place without affecting the objects identity. --Immutable objects - In contrast to the Mutabl...
read moreLists can be modified after creation, while tuples cannot be changed once created.
Lists use square brackets [] while tuples use parentheses ()
Example: list_example = [1, 2, 3], tuple_example = (4, 5, 6)
Lists are more flexible but tuples are faster and consume less memory
Q15. Write a program to check whether the given number is palindrom.
Program to check if a number is a palindrome
Convert the number to a string
Reverse the string
Compare the original string with the reversed string
If they are the same, the number is a palindrome
Q16. What are the difference between Local variable and Global Variable?
Local variables are declared inside a function and have a limited scope, while global variables are declared outside a function and can be accessed from anywhere in the program.
Local variables are only accessible within the function they are declared in.
Global variables can be accessed from any part of the program.
Local variables are created when a function is called and destroyed when the function returns.
Global variables are created when the program starts and destroyed whe...read more
Q17. What is the difference between list and tuples
Lists are mutable while tuples are immutable in Python.
Lists use square brackets [] while tuples use parentheses ().
Elements in a list can be added, removed, or modified while tuples cannot be modified.
Lists are used for collections of homogeneous items while tuples are used for heterogeneous items.
Lists are slower than tuples in terms of performance.
Example of a list: [1, 2, 3] and example of a tuple: (1, 'apple', True).
Q18. What is the difference between method overloading and method overriding?
Method overloading is having multiple methods with the same name but different parameters. Method overriding is having a method in a subclass with the same name and parameters as a method in its superclass.
Method overloading is a compile-time polymorphism while method overriding is a runtime polymorphism.
Method overloading is used to provide different ways of calling the same method with different parameters.
Method overriding is used to provide a specific implementation of a ...read more
Q19. what is thread and its lifecycle?
A thread is a lightweight process that can run concurrently with other threads in a program.
Threads share the same memory space as the parent process.
Threads can communicate with each other through shared memory.
Thread lifecycle includes creation, running, waiting, and termination.
Threads can be created using the Thread class in Java or pthread_create() function in C.
Examples of multithreaded programs include web servers and video games.
Q20. Why you choose python to learn instead of other languages?
Python is easy to learn, versatile, and has a large community support.
Python has a simple syntax and is easy to read and write.
It has a wide range of applications, from web development to data analysis and machine learning.
Python has a large community of developers who contribute to its libraries and frameworks.
Python is versatile and can be used for both small and large projects.
Python is an interpreted language, which means it can be run on any platform without the need for...read more
Q21. Given two linked list of numbers. Add them to form a new linked list example 1->2->3+4->5->6=5->7->9
Add two linked lists of numbers to form a new linked list.
Traverse both linked lists simultaneously and add the corresponding nodes.
If one list is shorter than the other, pad it with zeros.
If the sum of two nodes is greater than 9, carry over the 1 to the next node.
Create a new linked list with the sum of nodes.
Return the head of the new linked list.
Q22. What are four pillars of OOP? Explain with examples
The four pillars of OOP are Abstraction, Encapsulation, Inheritance, and Polymorphism.
Abstraction: Hiding implementation details and showing only necessary information. Example: A car dashboard shows only necessary information like speed, fuel level, etc.
Encapsulation: Binding data and functions that manipulate the data together. Example: A class in OOP encapsulates data and functions that operate on that data.
Inheritance: Creating new classes from existing ones, inheriting t...read more
Q23. What is the difference is between procedural and object oriented programming
Procedural programming focuses on procedures or functions while object oriented programming focuses on objects and their interactions.
Procedural programming is based on the concept of procedures or functions that perform specific tasks.
Object oriented programming is based on the concept of objects that have properties and methods.
Procedural programming is more suited for small programs while object oriented programming is better for larger programs.
In procedural programming, ...read more
Q24. What is the python code to shutdown a laptop?
The python code to shutdown a laptop is 'os.system('shutdown /s /t 1')'
Import the os module
Use the os.system() function
Pass the command 'shutdown /s /t 1' as an argument
The '/s' flag is used to shutdown the computer
The '/t 1' flag is used to set a timer of 1 second before shutdown
Q25. Print the adress of a pointer, adress of a variable and value in variable?
Printing the address of a pointer, address of a variable and value in variable.
To print the address of a pointer, use the '&' operator before the pointer variable name.
To print the address of a variable, use the '&' operator before the variable name.
To print the value in a variable, simply use the variable name.
Q26. (1) Write a code to print if number is prime or not prime (2) Explain logic behind code (3) What are joins
Code to check if a number is prime or not and explanation of logic behind it.
A prime number is only divisible by 1 and itself.
Loop through all numbers from 2 to n-1 and check if n is divisible by any of them.
If n is divisible by any number, it is not prime.
If n is not divisible by any number, it is prime.
Q27. What are the 4 pillars of C++ ?
The 4 pillars of C++ are encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation: Bundling data and methods that operate on the data into a single unit (class).
Inheritance: Creating new classes from existing classes, inheriting their attributes and methods.
Polymorphism: Ability to present the same interface for different data types.
Abstraction: Hiding complex implementation details and showing only the necessary features.
Q28. Tell me about yourself,dbms,sql,python oops
I am a tech enthusiast with knowledge in DBMS, SQL, Python and OOPs concepts.
Proficient in DBMS concepts and SQL queries
Skilled in Python programming and OOPs concepts
Experience in designing and implementing databases
Familiarity with data structures and algorithms
Ability to work in a team and adapt to new technologies
Q29. What is sdlc? What is white box testing how it usefull
SDLC stands for Software Development Life Cycle. White box testing is a testing technique that involves testing the internal structure of the software.
SDLC is a process followed by software development teams to design, develop, test, and deploy software.
It consists of several phases such as planning, analysis, design, implementation, testing, and maintenance.
White box testing is a testing technique that involves testing the internal structure of the software, including code, ...read more
Q30. What is the use of Having and Where in SQL query?
HAVING and WHERE are used in SQL queries to filter data based on certain conditions.
WHERE is used to filter data based on a specific condition in the WHERE clause.
HAVING is used to filter data based on a specific condition in the GROUP BY clause.
WHERE is used before GROUP BY, while HAVING is used after GROUP BY.
WHERE is used with single-row functions, while HAVING is used with group functions.
Example: SELECT name, SUM(sales) FROM sales_table WHERE sales > 1000 GROUP BY name H...read more
Q31. Which one of them is immutable (list or tuple)?
Tuple is immutable.
Tuple cannot be modified once created.
List can be modified by adding, removing or changing elements.
Q32. What is break, continue and pass in Python?
break, continue and pass are control statements in Python used to alter the flow of loops and conditional statements.
break is used to terminate a loop prematurely
continue is used to skip the current iteration and move to the next one
pass is used as a placeholder when a statement is required syntactically but no action is needed
Q33. How can you delete nth element from a linked list?
To delete nth element from a linked list, we need to traverse to the (n-1)th node and change its next pointer to (n+1)th node.
Traverse to (n-1)th node
Change its next pointer to (n+1)th node
Free the memory of nth node
Q34. Which is better Hard Work or Smart Work
Both hard work and smart work are important, but a combination of both is the key to success.
Hard work is necessary to achieve goals and develop skills.
Smart work helps in optimizing time and resources.
A combination of both can lead to efficient and effective results.
For example, a student who studies hard but also uses effective study techniques like summarizing and practicing questions is likely to perform better than a student who only studies hard without any strategy.
Sim...read more
Q35. What is loops, explain the types of loops?
Loops are used to execute a set of statements repeatedly. There are three types of loops: for, while, and do-while.
For loop is used when the number of iterations is known beforehand.
While loop is used when the number of iterations is not known beforehand.
Do-while loop is similar to while loop, but it executes the statements at least once before checking the condition.
Example: for(int i=0; i<10; i++) { //statements }
Example: int i=0; while(i<10) { //statements i++; }
Example: i...read more
Q36. What is an exception in java?
An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions.
Exceptions are objects that are thrown when an error occurs in a program.
They can be caught and handled using try-catch blocks.
Common exceptions include NullPointerException, ArrayIndexOutOfBoundsException, and IOException.
Exceptions can be caused by a variety of factors, such as invalid input, network errors, or programming errors.
Q37. What is throw keyword in java?
throw keyword is used to explicitly throw an exception in Java.
It is followed by an instance of the Exception class or one of its subclasses.
It is used to handle exceptional situations in a program.
It is used in combination with try-catch block to handle exceptions.
Example: throw new NullPointerException();
Q38. What is Inheritance? What is a parent class ?
Inheritance is a concept in object-oriented programming where a class can inherit attributes and methods from another class, known as the parent class.
Inheritance allows for code reusability and promotes the concept of hierarchical classification.
A parent class is also known as a base class or superclass.
Child classes can inherit attributes and methods from the parent class.
Example: If we have a parent class 'Animal' with attributes like 'name' and methods like 'eat()', a chi...read more
Q39. Tell me the differences between a list and a tuple
A list is mutable and ordered while a tuple is immutable and ordered.
Lists can be modified while tuples cannot
Lists are defined using square brackets while tuples use parentheses
Lists are used for collections of data that may change while tuples are used for fixed collections of data
Example of a list: [1, 2, 3] and example of a tuple: (1, 2, 3)
Q40. array in Python? Slicing in Py? Scope in py? list
Python arrays, slicing, scope, and lists.
Arrays in Python are homogeneous collections of data that are stored in contiguous memory locations.
Slicing in Python is a way to extract a portion of a sequence, such as a string, list, or tuple.
Scope in Python refers to the region of a program where a variable is defined and can be accessed.
Lists in Python are ordered collections of items that can be of different data types.
Q41. How do you look up on solution when you are stuck?
I first try to analyze the problem, research online resources, consult with colleagues, and experiment with different solutions.
Analyze the problem to understand the root cause
Research online resources such as forums, documentation, and tutorials
Consult with colleagues or mentors for their insights
Experiment with different solutions to see what works best
Q42. Do you know what are AI and ML ?
AI stands for Artificial Intelligence and ML stands for Machine Learning.
AI is the simulation of human intelligence in machines that are programmed to think and learn like humans.
ML is a subset of AI that involves training algorithms to make predictions or decisions based on data.
AI and ML are used in various industries such as healthcare, finance, and transportation.
Examples of AI and ML include virtual assistants like Siri and Alexa, self-driving cars, and fraud detection s...read more
Q43. What is the difference between primary and unique key
Primary key uniquely identifies a record in a table, while a unique key ensures that all values in a column are distinct.
Primary key can't have null values, while unique key can have one null value.
A table can have only one primary key, but multiple unique keys.
Primary key is automatically indexed, while unique key may or may not be indexed.
Q44. How many data types are there in python?
Python has 6 standard data types - Numbers, Strings, Lists, Tuples, Sets, and Dictionaries.
Python has 3 numeric data types - int, float, and complex
Strings are immutable sequences of Unicode characters
Lists are mutable sequences of objects
Tuples are immutable sequences of objects
Sets are unordered collections of unique elements
Dictionaries are unordered key-value pairs
Q45. About inheritance and explain it with real life examples?
Inheritance is a concept in object-oriented programming where a class can inherit properties and methods from another class.
Inheritance allows for code reuse and promotes a hierarchical structure.
A child class can inherit properties and methods from a parent class.
For example, a Car class can inherit properties and methods from a Vehicle class.
Another example is a Dog class inheriting properties and methods from an Animal class.
Inheritance can also involve multiple levels, wi...read more
Q46. Working of constructors in inheritance with real life examples?
Constructors in inheritance allow child classes to inherit properties and methods from parent classes.
Constructors in child classes can call the constructor of the parent class using the 'super' keyword.
If a child class does not have a constructor, it will automatically inherit the constructor of the parent class.
Constructors can be used to initialize properties of the child class as well as the parent class.
Real life example: A car is a child class of a vehicle. The construc...read more
Q47. What are the features of OOPS ?
OOPS (Object-Oriented Programming System) features include encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation: Bundling data and methods that operate on the data into a single unit (class).
Inheritance: Ability to create a new class by inheriting attributes and methods from an existing class.
Polymorphism: Ability to use a single interface to represent different data types or objects.
Abstraction: Hiding the complex implementation details and showing only th...read more
Q48. Paper presentation experience outside your college campus.
I have presented a paper on Artificial Intelligence at a national conference.
Presented a paper on AI at a national conference organized by IEEE.
Discussed the impact of AI on the future of work and society.
Received positive feedback from the audience and panelists.
Networked with professionals in the field and gained insights into current research.
Published the paper in the conference proceedings.
Q49. What is thePrototype of C language?
The prototype of C language is int main()
The prototype specifies the return type and parameters of a function
int main() is the prototype for the main function in C
The parentheses are required even if there are no parameters
Other functions can have different prototypes depending on their return type and parameters
Q50. What is object oriented programming language? What are constructors?
Object oriented programming is a paradigm that uses objects to represent real-world entities. Constructors are special methods used to initialize objects.
Object oriented programming focuses on objects and their interactions
Objects have properties and methods that define their behavior
Constructors are used to create and initialize objects
In Java, constructors have the same name as the class and are called when an object is created
Constructors can take parameters to set initial...read more
Q51. What are the programming language you know?
I am proficient in Java, Python, and C++.
Proficient in Java, Python, and C++
Experience with object-oriented programming
Familiarity with data structures and algorithms
Knowledge of web development frameworks such as Django and Spring
Q52. What is java? What are the features of java
Java is a high-level, object-oriented programming language used for developing applications and software.
Java is platform-independent, meaning it can run on any platform with a Java Virtual Machine (JVM)
It is statically-typed, which means that variables must be declared before they can be used
Java is object-oriented, which means that everything in Java is an object
It has automatic memory management, meaning that the programmer does not need to manually allocate and deallocate...read more
Q53. what are collections in java?
Collections in Java are classes and interfaces that group multiple objects into a single unit.
Collections provide a way to manage and manipulate groups of objects.
They are used to store, retrieve, and manipulate data in a structured way.
Examples of collections include ArrayList, LinkedList, HashSet, and TreeMap.
Collections can be used to sort, search, filter, and modify data.
They are an important part of Java programming and are used extensively in real-world applications.
Q54. Differentiate between call by reference and call by value
Call by reference passes the address of the variable as an argument, while call by value passes the value of the variable.
Call by reference allows the function to modify the actual value of the variable passed as an argument.
Call by value only allows the function to work with a copy of the variable's value.
Example: In call by reference, changes made to the parameter inside the function will reflect outside the function. In call by value, changes made to the parameter inside t...read more
Q55. Define oops and explain the types of it.
OOPs stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects.
There are four main types of OOPs: Abstraction, Encapsulation, Inheritance, and Polymorphism.
Abstraction is the process of hiding complex implementation details and showing only the necessary information to the user.
Encapsulation is the process of binding data and functions that manipulate that data together in a single unit.
Inheritance is the process of creating new clas...read more
Q56. what are pointers?
Pointers are variables that store memory addresses of other variables in a program.
Pointers allow for dynamic memory allocation and manipulation.
They are used to pass data between functions efficiently.
Pointers can be used to create complex data structures like linked lists and trees.
Example: int *ptr; // declares a pointer to an integer variable
Example: ptr = # // assigns the address of num to ptr
Example: *ptr = 10; // assigns the value 10 to the variable pointed to by ptr
Q57. Types of data types with few examples.
Data types are classifications of data items that indicate the kind of values they contain.
Primitive data types: int, float, double, char, boolean
Non-primitive data types: arrays, strings, classes, interfaces
Examples: int age = 25, float price = 10.5, char grade = 'A', boolean isTrue = true, String name = 'John', int[] numbers = {1, 2, 3}
Q58. Write a program to find the greatest number among three numbers
Program to find the greatest number among three numbers
Declare three variables to store the three numbers
Compare the first two numbers and store the greater one in a temporary variable
Compare the temporary variable with the third number and store the greatest one in another variable
Print the greatest number
Q59. IS PYTHON A CASE SENSITIVE LANGUAGE
Yes, Python is a case sensitive language.
Variable names 'myVar' and 'myvar' are different in Python.
Keywords like 'if', 'else', 'while' are case sensitive.
Function names and module names are also case sensitive.
Q60. Pseudocode for switching the values of two variables without using a third variable
Switch values of two variables without using a third variable
Use XOR operator
Addition and subtraction can also be used
Pointers can be used to swap values
Q61. Are you open to learning new technologies?
Yes, I am open to learning new technologies as it helps me stay updated and grow in my career.
I believe in continuous learning and adapting to new technologies
I am always eager to expand my skill set and knowledge
Learning new technologies can open up new opportunities and challenges for me
Q62. What is Normalization in SQL?
Normalization in SQL is the process of organizing data in a database to reduce redundancy and improve data integrity.
Normalization involves breaking down a database into smaller, more manageable tables and defining relationships between them.
It helps in reducing data redundancy by storing data in a structured and organized manner.
Normalization ensures data integrity by preventing anomalies such as insertion, update, and deletion anomalies.
There are different normal forms such...read more
Q63. What is the operating system in your laptop?
The operating system in my laptop is Windows 10.
My laptop runs on Windows 10 operating system.
Windows 10 is a popular operating system developed by Microsoft.
It has a user-friendly interface and supports a wide range of software applications.
Some of the key features of Windows 10 include Cortana, Microsoft Edge, and virtual desktops.
Q64. Write a program to count deleted char in your name
A program to count the number of deleted characters in a given name.
Create a variable to store the count of deleted characters.
Loop through each character in the name.
If the character is not present in the name, increment the count variable.
Return the count variable.
Q65. Tell me the definition of a class
A class is a blueprint for creating objects that have similar attributes and behaviors.
A class is a user-defined data type that encapsulates data and functions.
It defines the attributes and methods that an object of that class will have.
Objects are instances of a class.
Classes can inherit properties and methods from other classes.
Example: A class 'Car' can have attributes like 'color', 'model', and methods like 'start', 'stop'.
Q66. What is encapsulation. Explain it with example
Encapsulation is the concept of bundling data and methods that operate on the data into a single unit, known as a class.
Encapsulation helps in hiding the internal state of an object and restricting access to it.
It allows for data hiding, which prevents direct access to an object's attributes.
Encapsulation also helps in achieving data abstraction, where only necessary details are exposed to the outside world.
Example: In a class representing a car, the variables like speed and ...read more
Q67. Write code for cube of number , prime number , sorting , DBMS related , SQL.
Code for cube of number, prime number, sorting, DBMS related, SQL
Cube of a number: num*num*num
Prime number: check if num is divisible by any number from 2 to num-1
Sorting: use built-in sorting functions or implement bubble sort, merge sort, quick sort, etc.
DBMS related: learn about database design, normalization, SQL queries, etc.
SQL: use SQL commands to create, modify, and query databases
Q68. Create Login page using html, css and js
Create a login page using HTML, CSS, and JS
Use HTML for structure and form elements
Style the page using CSS for layout and design
Implement client-side validation using JavaScript
Handle form submission and authentication using JS
Q69. What do you mean by abstraction
Abstraction is the process of hiding complex details and showing only essential features of an object or system.
Abstraction helps in managing complexity by breaking down a system into smaller, more manageable parts.
It allows us to focus on the important aspects of a system while ignoring the irrelevant details.
Abstraction is used in programming to create classes and objects that represent real-world entities.
For example, a car object can have properties like make, model, and ...read more
Q70. Write any sorting technique with your preferred language.
One sorting technique is Bubble Sort in Python.
Initialize a flag to track if any swaps are made in a pass
Repeat until no swaps are made: Compare adjacent elements and swap if necessary
Example: def bubble_sort(arr): for i in range(len(arr)): for j in range(0, len(arr)-i-1): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j]
Q71. Write a program to print a Fibonacci series
Program to print Fibonacci series in Python
Initialize variables for first two numbers in the series (0 and 1)
Use a loop to calculate and print the next number by adding the previous two numbers
Continue the loop until the desired number of terms is reached
Q72. Write a program to find Simple Interest?
Program to calculate Simple Interest
Take input of principal amount, rate of interest and time period
Calculate simple interest using formula: (P * R * T) / 100
Display the calculated simple interest
Q73. How do you traverse linked list?
Traversing a linked list involves iterating through each node starting from the head node.
Start at the head node
Iterate through each node by following the 'next' pointer
Stop when reaching the end of the list (next pointer is null)
Q74. Write a sample sql query to fetch data from two tables
SQL query to fetch data from two tables
Use JOIN keyword to combine data from two tables
Specify the columns you want to retrieve in the SELECT statement
Use ON clause to specify the relationship between the tables
Q75. Which programming language do you know?
I know multiple programming languages including Java, Python, and C++.
Proficient in Java with experience in developing web applications using Spring framework
Familiar with Python for data analysis and machine learning
Experience in C++ for competitive programming and algorithm development
Q76. Who is CEO of TCS?
Rajesh Gopinathan is the CEO of TCS.
Rajesh Gopinathan took over as CEO of TCS in 2017.
He has been with TCS since 2001 and has held various leadership roles.
Under his leadership, TCS has continued to grow and expand globally.
Q77. What is DDL,DML & DCL commands?
DDL, DML, and DCL are SQL commands used to manipulate databases.
DDL (Data Definition Language) commands are used to create, modify, and delete database objects such as tables, indexes, and views.
DML (Data Manipulation Language) commands are used to insert, update, and delete data in a database.
DCL (Data Control Language) commands are used to control access to the database, such as granting or revoking permissions.
Examples of DDL commands include CREATE TABLE, ALTER TABLE, and...read more
Q78. What do you mean by OOPS
OOPS stands for Object-Oriented Programming System
OOPS is a programming paradigm that focuses on objects and their interactions
It allows for encapsulation, inheritance, and polymorphism
Encapsulation refers to the bundling of data and methods within a single unit
Inheritance allows for the creation of new classes based on existing ones
Polymorphism allows for the use of a single interface to represent multiple types of objects
Q79. Tell me about python?
Python is a high-level, interpreted programming language known for its simplicity and readability.
Python is dynamically typed and supports multiple programming paradigms.
It has a large standard library and a vast collection of third-party modules.
Python is widely used in web development, scientific computing, data analysis, and artificial intelligence.
Some popular frameworks and libraries in Python include Django, Flask, NumPy, and TensorFlow.
Q80. What is pointers and it's types?
Pointers are variables that store memory addresses. They can be used to manipulate data and improve program efficiency.
There are four types of pointers: null pointers, void pointers, function pointers, and pointer to pointers.
Example: int *ptr; // declares a pointer to an integer
Example: int **ptr; // declares a pointer to a pointer to an integer
Q81. Reason for Background change ie from Mechanical to IT
Passion for technology and interest in IT led to transition from Mechanical to IT field.
Discovered passion for technology and IT during college courses
Realized interest in coding and software development
Opportunity to work on IT projects during internships
Belief in the growth and opportunities in the IT industry
Q82. What is this keyword in python ?
The 'this' keyword in Python refers to the current instance of the class.
Used to refer to the current instance of the class
Can be used to access variables and methods of the current instance
Used inside a method of a class
Example: self.variable_name or self.method_name()
Q83. What do you know 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.
Examples of DBMS include MySQL, Oracle, SQL Server, and PostgreSQL.
Q84. Tell about OOPS concepts in brief.
OOPS concepts refer to Object-Oriented Programming concepts which 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.
Q85. What is a map ?
A map is a visual representation of an area, showing physical features, roads, and other details.
A map can be used for navigation and orientation.
It can show geographical features such as mountains, rivers, and lakes.
Maps can also display man-made features such as roads, buildings, and landmarks.
Different types of maps include topographic, political, and weather maps.
Maps can be created using various tools such as GPS, satellite imagery, and cartography software.
Q86. What are preprocessor in C language
Preprocessors are directives that are executed before the compilation of the program.
Preprocessors start with a # symbol.
They are used to include header files, define constants, and perform conditional compilation.
Examples of preprocessor directives are #include, #define, #ifdef, #ifndef, #endif.
Preprocessors are executed before the actual compilation of the program.
They are used to modify the source code before it is compiled.
Q87. How java and python are different?
Java is a statically typed language with a strong emphasis on object-oriented programming, while Python is dynamically typed and focuses on simplicity and readability.
Java is statically typed, while Python is dynamically typed
Java is strongly typed, while Python is weakly typed
Java is compiled to bytecode and runs on a virtual machine, while Python is interpreted
Java has a strong emphasis on object-oriented programming, while Python supports multiple programming paradigms
Java...read more
Q88. Difference between C,C++ Describe your Projects Oops concepts
Difference between C and C++, Projects, and OOPs concepts
C is a procedural language while C++ is an object-oriented language
C++ supports features like inheritance, polymorphism, and encapsulation
Projects: developed a calculator using C++, a file management system using C
OOPs concepts: Abstraction, Encapsulation, Inheritance, Polymorphism
Q89. Why cilling fans are dual phase ?
Ceiling fans are dual phase to improve efficiency and reduce energy consumption.
Dual phase fans have two sets of windings for better control of speed and direction
They provide smoother operation and reduce noise levels
Dual phase fans are more energy efficient compared to single phase fans
Examples of dual phase ceiling fans include those with remote control and variable speed settings
Q90. What is SDLC in software engineering?
SDLC stands for Software Development Life Cycle, which is a process used by software developers to design, develop, and test high-quality software.
SDLC is a structured process that consists of several phases including planning, analysis, design, implementation, testing, and maintenance.
Each phase in the SDLC has its own set of activities and deliverables that must be completed before moving on to the next phase.
Examples of SDLC models include Waterfall, Agile, and DevOps, eac...read more
Q91. Explain how a diode works, write simple c program
A diode is an electronic component that allows current to flow in one direction and blocks it in the opposite direction.
A diode has two terminals: an anode and a cathode.
When the voltage across the diode is positive, it conducts current.
When the voltage across the diode is negative, it blocks current.
Diodes are commonly used in rectifier circuits to convert AC to DC.
A simple C program to control a diode can be written using GPIO pins on a microcontroller.
Q92. On which protocol REST apis work.
REST APIs work on the HTTP protocol.
REST APIs use HTTP methods like GET, POST, PUT, DELETE.
They rely on URLs to access resources.
Responses are typically in JSON or XML format.
Example: GET request to 'https://api.example.com/users' to retrieve user data.
Q93. Dbms joins and what are networks ip
DBMS joins are used to combine data from multiple tables. IP addresses are unique identifiers assigned to devices on a network.
DBMS joins are used to retrieve data from multiple tables based on a common column
There are different types of joins such as inner join, outer join, left join, right join
IP addresses are used to identify devices on a network and allow them to communicate with each other
IP addresses are unique and consist of four numbers separated by dots, such as 192....read more
Q94. What is a tree ?
A tree is a perennial plant with a single stem or trunk, supporting branches and leaves.
Trees are typically tall and have a woody stem.
They have roots that anchor them to the ground and absorb water and nutrients.
Trees provide oxygen, shade, and habitat for animals.
Examples of trees include oak, maple, pine, and palm trees.
Q95. What is an abstract class?
An abstract class is a class that cannot be instantiated and is meant to be subclassed.
An abstract class can have abstract and non-abstract methods.
Abstract methods have no implementation and must be implemented by the subclass.
A class can only extend one abstract class but can implement multiple interfaces.
Example: Animal is an abstract class with abstract method 'makeSound'. Dog and Cat are subclasses that implement 'makeSound'.
Q96. Difference Between Method and Constructor?
A method is a function that belongs to a class and can be called to perform a specific task. A constructor is a special method used to initialize an object when it is created.
Methods are defined within a class and can be called using an object of that class.
Constructors are used to initialize the state of an object and are automatically called when an object is created.
Methods can have return types and parameters, while constructors do not have return types and have the same ...read more
Q97. models in s/w development lifecycle?
Models are used in software development lifecycle to plan, design, implement and test software.
Models help in visualizing the software development process
They provide a framework for organizing and managing the development process
Some popular models include Waterfall, Agile, Spiral, and V-Model
Each model has its own advantages and disadvantages
Choosing the right model depends on the project requirements and constraints
Q98. Describe the user of Classes and Interfaces.
Classes and interfaces are used to define objects and their behavior in object-oriented programming.
Classes are used to define objects with properties and methods.
Interfaces are used to define a set of methods that a class must implement.
Classes can inherit properties and methods from other classes.
Interfaces can be implemented by multiple classes.
Classes and interfaces promote code reusability and modularity.
Q99. Create a simple form with HTML
Create a simple form with HTML
Use the <form> tag to create the form
Add <input> tags for different form fields like text, email, password, etc.
Include a submit button using <input type='submit'>
Q100. What is the N queen problem?
The N queen problem is a classic problem of placing N chess queens on an N×N chessboard so that no two queens attack each other.
In the N queen problem, the challenge is to place N queens on an N×N chessboard in such a way that no two queens threaten each other.
Queens can move horizontally, vertically, and diagonally, so the placement must ensure no two queens share the same row, column, or diagonal.
The problem can be solved using backtracking algorithms like recursive depth-f...read more
More about working at TCS
Top HR Questions asked in Marks & Spencer
Interview Process at Marks & Spencer
Top Assistant System Engineer Trainee Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month