Virtusa Software Services
20+ Thomas Cook Interview Questions and Answers
Q1. Write a React Class component. Convert this Class to a Functional Component. How can you pass prop from parent to child component? Write code.
Answer to a React Developer interview question about class and functional components and passing props.
Class component: class MyComponent extends React.Component {}
Functional component: const MyComponent = (props) => {}
Passing props from parent to child:
Q2. What are export types in ReactJS?
Export types in ReactJS allow components, functions, and variables to be accessed and used in other files.
Exporting a component allows it to be imported and used in other files
Exporting a function allows it to be imported and used in other files
Exporting a variable allows it to be imported and used in other files
Q3. What are Hooks in React? Explain useState, useEffect hooks.
Hooks are functions that allow you to use state and other React features without writing a class.
useState is a hook that allows you to add state to functional components.
useEffect is a hook that allows you to perform side effects in functional components.
Hooks can only be used in functional components.
Hooks must be called at the top level of a functional component.
Hooks can be used to replace lifecycle methods in class components.
Q4. How Promise works? What is Promise.all. Write code for both.
Promises are a way to handle asynchronous operations in JavaScript. Promise.all is used to execute multiple promises concurrently.
Promises represent a value that may not be available yet
They have three states: pending, fulfilled, and rejected
Promise.all takes an array of promises and returns a new promise that resolves when all promises in the array have resolved
If any promise in the array is rejected, the returned promise is rejected with the reason of the first promise that...read more
Q5. What is the significance of 'this' keyword in JS?
The 'this' keyword in JS refers to the object that is currently executing the code.
The value of 'this' depends on how a function is called.
In a method, 'this' refers to the object that the method belongs to.
In a regular function, 'this' refers to the global object (window in a browser).
In an event handler, 'this' refers to the element that triggered the event.
The value of 'this' can be explicitly set using call(), apply(), or bind() methods.
Q6. Features of ES6. Explain Spread Operator and Rest Parameter by writing code. Give example for Object Destructuring.
ES6 features: Spread Operator, Rest Parameter, Object Destructuring
Spread Operator: allows an iterable to be expanded into individual elements
Rest Parameter: allows a function to accept an indefinite number of arguments as an array
Object Destructuring: allows extracting properties from an object and assigning them to variables
Q7. How setState works in React?
setState is a method used in React to update the state of a component.
setState is asynchronous and batched for performance optimization.
It merges the new state with the previous state.
It schedules a re-render of the component and its children.
Passing a function to setState ensures the previous state is used correctly.
Example: this.setState({ count: this.state.count + 1 })
Q8. 3: Programing languages you're favour with , C or C++ or Java or Python.
I am proficient in C++, Java, and Python.
Strong understanding of object-oriented programming concepts
Experience with data structures and algorithms
Proficient in using IDEs such as Eclipse and Visual Studio
Q9. What is difference between generator and iterator
Generators produce values one at a time, while iterators are objects that allow iteration over a sequence of values.
Generators are functions that can pause and resume execution, producing a sequence of values lazily.
Iterators are objects that implement the Iterator protocol, allowing iteration over a sequence of values.
Generators can be created using function* syntax in JavaScript, while iterators can be created using the Symbol.iterator method.
Q10. Explain the different types of inhertance in python
Python supports single, multiple, and multilevel inheritance.
Single inheritance: A class can inherit from only one parent class.
Multiple inheritance: A class can inherit from multiple parent classes.
Multilevel inheritance: A class can inherit from a derived class, creating a hierarchy.
Q11. Write python code to remove duplicates from a list
Python code to remove duplicates from a list of strings
Use set() to remove duplicates from the list
Convert the set back to a list to maintain the order of elements
Example: input_list = ['apple', 'banana', 'apple', 'orange']
Output: ['apple', 'banana', 'orange']
Q12. Coding syntax why used
Coding syntax is used to define the rules and structure of a programming language.
Coding syntax ensures that code is written in a consistent and understandable manner.
It helps the compiler or interpreter understand and execute the code correctly.
Syntax errors can be easily identified and corrected during the development process.
Examples: curly braces {} in C/C++, indentation in Python, semicolons ; in many languages.
Q13. What is difference between let const and var
let and const are block-scoped while var is function-scoped. const cannot be reassigned, let and var can.
let and const are block-scoped, var is function-scoped
const cannot be reassigned, let and var can be
var can be hoisted, let and const cannot
Q14. Top earning employee in a sql table
To find the top earning employee in a SQL table, you can use a SQL query with the MAX function on the salary column.
Use a SQL query with the MAX function on the salary column to retrieve the highest salary in the table.
Join the result with the employee table to get the details of the top earning employee.
Example: SELECT * FROM employees WHERE salary = (SELECT MAX(salary) FROM employees);
Q15. What are declarative rules?
Declarative rules are statements that define the desired outcome without specifying the steps to achieve it.
Declarative rules focus on what needs to be done rather than how to do it
They are commonly used in programming languages like SQL and Prolog
Example: SQL SELECT statement specifies what data to retrieve without specifying how to retrieve it
Q16. What is hoisting in js
Hoisting is a JavaScript behavior where variable and function declarations are moved to the top of their containing scope during compilation.
Variable and function declarations are hoisted to the top of their scope.
Only declarations are hoisted, not initializations.
Function declarations take precedence over variable declarations.
Q17. What is role and responsiblity
The role and responsibility of a Senior Software Engineer is to design, develop, and maintain software applications, lead a team of developers, and ensure the quality and efficiency of the software development process.
Designing and developing software applications
Leading a team of developers
Ensuring the quality and efficiency of the software development process
Collaborating with stakeholders to gather requirements and provide technical solutions
Mentoring junior developers and...read more
Q18. What is the Workflow for documentation
Documentation workflow involves planning, writing, reviewing, editing, and publishing content.
Plan the documentation by identifying the audience and purpose
Write the content following a structured format
Review the content for accuracy, clarity, and completeness
Edit the content for grammar, style, and consistency
Publish the documentation in the appropriate format
Q19. Multiply two tuples
Multiplying two tuples involves multiplying corresponding elements of each tuple and summing the results.
Multiply the first element of the first tuple with the first element of the second tuple, then multiply the second element of the first tuple with the second element of the second tuple, and so on.
Sum the results of the multiplications to get the final result.
Example: (2, 3) * (4, 5) = (2*4) + (3*5) = 8 + 15 = 23
Q20. What is Project Management
Project Management is the practice of planning, organizing, and executing projects to achieve specific goals within defined constraints.
Project Management involves defining project objectives, creating a project plan, and allocating resources.
It includes coordinating and communicating with team members, stakeholders, and clients.
Project Managers monitor progress, manage risks, and make adjustments to ensure successful project completion.
Examples of projects can range from bui...read more
Q21. what are collections
Collections are data structures used to store and manipulate groups of related objects.
Collections can be of various types such as lists, sets, maps, etc.
They allow for easy manipulation and retrieval of data.
Examples include ArrayList, HashSet, and HashMap.
Q22. Non repeating char from a string
Find the first non-repeating character in a string
Iterate through the string and count the frequency of each character
Return the first character with a frequency of 1
Q23. What is currying
Currying is a technique in functional programming where a function with multiple arguments is transformed into a sequence of nested functions, each taking a single argument.
Currying helps in creating reusable functions and partial application.
It allows for better code organization and readability.
Example: const add = a => b => a + b; add(2)(3) will return 5.
Top HR Questions asked in Thomas Cook
Interview Process at Thomas Cook
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month