Add office photos
Engaged Employer

Bounteous x Accolite

3.5
based on 756 Reviews
Filter interviews by

100+ Godrej Consumer Products Interview Questions and Answers

Updated 13 Dec 2024
Popular Designations
Q1. Loot Houses

A thief wants to loot houses. He knows the amount of money in each house. He cannot loot two consecutive houses. Find the maximum amount of money he can loot.

Input Format :
The first line of input c...read more
View 3 more answers
Q2. Topological Sort

You are given a directed acyclic graph. Your task is to find any topological sorting of the graph.

A directed acyclic graph is a directed graph with no directed cycles.

Topological sorting for D...read more

Add your answer

Q3. Total time: 110 mins 1. Find missing and duplicate numbers from given array(algo, code, optimization, dry run, complexity analysis) 2. Flatten Binary tree to Linked List Conversion (algo, code, optimization, dr...

read more
Ans.

Interview questions for Software Engineer position

  • Array manipulation and linked list operations

  • Tree data structure and balancing techniques

  • Database concepts and differences between SQL and NoSQL

  • Web development frameworks and protocols

  • Concepts of Deadlock and Race Condition

  • Use of pointers in function oriented programming and their absence in Java

Add your answer

Q4. Can you make a constructor private in Cpp, if not what error will you get (Compile Time Error or Runtime Error)

Ans.

Yes, a constructor can be made private in C++ to restrict object creation outside the class.

  • Private constructors are used in Singleton design pattern to ensure only one instance of the class is created.

  • If a constructor is made private, it can only be accessed by the member functions of the class.

  • Attempting to create an object of a class with a private constructor outside the class will result in a compile-time error.

Add your answer
Discover Godrej Consumer Products interview dos and don'ts from real experiences

Q5. What is the difference between Binary Tree and Binary Search Tree

Ans.

Binary Tree is a tree data structure where each node has at most two children. Binary Search Tree is a binary tree with the property that the left subtree of a node contains only nodes with keys lesser than the node's key and the right subtree of a node contains only nodes with keys greater than the node's key.

  • Binary Tree can have any values in the nodes, while Binary Search Tree has a specific order of values.

  • Binary Search Tree allows for efficient searching, insertion, and ...read more

Add your answer
Q6. Maximum subarray

Ninjas has been given an array. He wants to find a subarray such that the sum of all elements in the subarray is maximum.

Subarray 'A' is greater than sub-array 'B' if sum(A) > sum(B). If two su...read more

View 2 more answers
Are these interview questions helpful?

Q7. What are the Dynamic-link library (DLL) in Cpp and its use?

Ans.

DLL is a library of executable functions and data that can be used by a Windows application.

  • DLLs are loaded at runtime and can be shared by multiple applications.

  • They allow for modular programming and reduce memory usage.

  • DLLs can be used for device drivers, system utilities, and application extensions.

  • Examples of DLLs include kernel32.dll, user32.dll, and msvcr100.dll.

Add your answer

Q8. What are function pointers and the differences between normal function and function pointers?

Ans.

Function pointers are pointers that point to the memory address of a function. They can be passed as arguments or returned from a function.

  • Function pointers allow for dynamic function calls at runtime

  • Function pointers can be used to implement callbacks

  • Function pointers can be used to implement polymorphism

  • Normal functions are called directly, while function pointers are called indirectly

  • Function pointers can be assigned to NULL to indicate that they do not point to a valid fu...read more

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Explain the diamond problem in Cpp, and how to solve it.

Ans.

Diamond problem occurs in multiple inheritance when two base classes have a common method. It is solved using virtual inheritance.

  • Diamond problem occurs when a derived class inherits from two base classes that have a common method.

  • Virtual inheritance is used to solve the diamond problem.

  • Virtual inheritance ensures that only one instance of the common base class is created.

Add your answer

Q10. What are the ways to prevent Instantiation of Class?

Ans.

Ways to prevent instantiation of a class

  • Declare the class as abstract

  • Make the constructor private

  • Implement a static factory method

  • Throw an exception in the constructor

  • Use the Singleton pattern

Add your answer

Q11. A tweak to the pair sum problem: there can be any number of elements that add up to the target

Ans.

The task is to find any number of elements in an array that add up to a given target.

  • Use a recursive approach to find all possible combinations of elements that add up to the target.

  • Start with the first element and recursively call the function with the remaining elements and the reduced target.

  • If the target becomes zero, add the current combination to the result.

  • If the target becomes negative or there are no more elements, backtrack and try the next element.

  • Return all the co...read more

Add your answer

Q12. Separate negative and positive numbers in a linked list.

Ans.

Separate negative and positive numbers in a linked list.

  • Create two separate linked lists for positive and negative numbers

  • Traverse the original linked list and add nodes to respective lists

  • Join the two lists to get the final linked list with separated numbers

Add your answer

Q13. How can you print names of 4 threads in the given order?

Ans.

Printing names of 4 threads in a given order using an array of strings.

  • Create an array of strings with the names of the threads in the desired order.

  • Use a loop to iterate through the array and print each thread name.

  • Ensure that the threads are started in the same order as the names in the array.

Add your answer

Q14. Delete Kth node from the end of the linked list in single iteration

Ans.

Delete Kth node from end of linked list in single iteration

  • Use two pointers, one to traverse the list and another to keep track of Kth node from end

  • Move both pointers simultaneously until the first pointer reaches the end

  • Delete the Kth node from end using the second pointer

Add your answer

Q15. Segregate 0's and 1's in array - Dutch National Flag Algo Again

Ans.

Segregate 0's and 1's in array using Dutch National Flag Algorithm

  • Use three pointers - low, mid, and high

  • low points to the first index of 1

  • mid points to the first index of unknown element

  • high points to the last index of 1

  • If arr[mid] is 0, swap arr[low] and arr[mid], increment low and mid

  • If arr[mid] is 1, increment mid

  • If arr[mid] is 2, swap arr[mid] and arr[high], decrement high

Add your answer

Q16. Equal Sum Partition along with print that 2 arrays (DP + matrix printing)

Ans.

Equal Sum Partition problem with DP and matrix printing

  • The problem involves dividing an array into two subsets with equal sum

  • Dynamic programming can be used to solve this problem efficiently

  • A matrix can be used to keep track of the subsets

  • Printing the subsets can be done by backtracking through the matrix

Add your answer
Q17. Intersection of Linked List

You are given two Singly Linked List of integers, which are merging at some node of a third linked list.

Your task is to find the data of the node at which merging starts. If there is...read more

View 3 more answers
Q18. Rotting Oranges

You have been given a grid containing some oranges. Each cell of this grid has one of the three integers values:

  • Value 0 - representing an empty cell.
  • Value 1 - representing a fresh orange.
  • ...read more
  • View 3 more answers

    Q19. 8. If not engineering then what?

    Ans.

    I would have pursued a career in music.

    • I have been playing the guitar for over 10 years.

    • I have performed at local gigs and events.

    • I enjoy writing and composing my own music.

    Add your answer

    Q20. How to check for a loop in linked list?

    Ans.

    To check for a loop in a linked list, we use the Floyd's cycle-finding algorithm.

    • Create two pointers, slow and fast, and initialize them to the head of the linked list.

    • Move slow pointer by one node and fast pointer by two nodes.

    • If there is a loop, the two pointers will eventually meet.

    • If there is no loop, the fast pointer will reach the end of the linked list.

    • Time complexity of this algorithm is O(n) and space complexity is O(1).

    Add your answer

    Q21. Max multiplication of 3 numbers in an array

    Ans.

    Find the maximum multiplication of 3 numbers in an array of strings.

    • Convert the array of strings to an array of integers.

    • Sort the array in descending order.

    • Check the product of first three elements and last two elements with the first element.

    Add your answer
    Q22. Left View of Binary Tree

    Given a binary tree. Print the Left View of the Tree.

    Example :
    If the input tree is as depicted in the picture: 

    alt text

    The Left View of the tree will be: 2 35 2 
    Input format :
    Elements in t...read more
    View 2 more answers
    Q23. Reverse Linked List
    Input Format :
    The first line of input contains a single integer T, re...read more
    View 2 more answers
    Q24. Merge K Sorted Arrays

    You have been given ‘K’ different arrays/lists, which are sorted individually (in ascending order). You need to merge all the given arrays/list such that the output array/list should be so...read more

    View 3 more answers
    Q25. Minimum Time To Solve The Problems

    There are 'N' number of subjects and the ith subject contains subject[i] number of problems. Each problem takes 1 unit of time to be solved. Also, you have 'K' friends, and you...read more

    View 5 more answers

    Q26. What is finally and will it execute if System.exit() is called?

    Ans.

    Finally is a block of code that executes after try-catch block. It will not execute if System.exit() is called.

    • Finally block is used to execute a block of code after try-catch block

    • It will execute even if an exception is thrown

    • Finally block will not execute if the JVM exits before the block is executed

    • System.exit() terminates the JVM and finally block will not execute

    View 1 answer
    Q27. Reverse Words In A String

    You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or trailing spaces but in the ou...read more

    View 3 more answers
    Q28. Majority Element

    You have been given an array/list 'ARR' consisting of 'N' integers. Your task is to find the majority element in the array. If there is no majority element present, print -1.

    Note:
    A majority el...read more
    View 4 more answers

    Q29. Project Explanation which includes Q&A as well.

    Ans.

    Developed a project management tool for tracking tasks and deadlines.

    • Implemented user authentication and authorization for secure access.

    • Utilized a relational database to store project data and user information.

    • Designed a user-friendly interface with drag-and-drop functionality for task management.

    Add your answer
    Q30. Maximum Path Sum Between Two Leaves

    You are given a non-empty binary tree where each node has a non-negative integer value. Return the maximum possible sum of path between any two leaves of the given tree.

    The p...read more

    View 3 more answers

    Q31. Check if a linked list is circular or not

    Ans.

    To check if a linked list is circular, we can use Floyd's cycle-finding algorithm.

    • Create two pointers, slow and fast, and initialize them to the head of the linked list

    • Move slow pointer by one node and fast pointer by two nodes

    • If the linked list is circular, the fast pointer will eventually catch up to the slow pointer

    • If the linked list is not circular, the fast pointer will reach the end of the list

    • Time complexity: O(n), Space complexity: O(1)

    Add your answer

    Q32. Remove duplicates from Linked List. Both variants.

    Ans.

    Remove duplicates from Linked List. Both variants.

    • Variant 1: Using Hash Set to keep track of visited nodes and removing duplicates

    • Variant 2: Using two pointers to compare each node with all subsequent nodes and removing duplicates

    • Example: 1->2->3->2->4->3, Output: 1->2->3->4

    Add your answer

    Q33. Calculating the depth of a tree

    Ans.

    Calculating the depth of a tree

    • Depth of a tree is the maximum distance from the root node to any leaf node

    • Can be calculated recursively by finding the maximum depth of left and right subtrees

    • Base case is when the node is null, return 0

    Add your answer
    Q34. Sum root to leaf

    You are given an arbitrary binary tree consisting of N nodes where each node is associated with a certain integer value from 1 to 9. Consider each root to leaf path as a number.

    For example:

     1 ...read more
    View 2 more answers
    Q35. N-th Node From The End

    You are given a Singly Linked List of integers. You have to find the N-th node from end.

    For Example
    If the given list is (1 -> -2 -> 0 -> 4) and N=2: 

    example

    Then the 2nd node from the end is ...read more
    View 3 more answers
    Q36. LCA of Binary Tree

    You have been given a Binary Tree of distinct integers and two nodes ‘X’ and ‘Y’. You are supposed to return the LCA (Lowest Common Ancestor) of ‘X’ and ‘Y’.

    The LCA of ‘X’ and ‘Y’ in the bina...read more

    View 3 more answers

    Q37. What are registers in Cpp?

    Ans.

    Registers are small, fast memory locations in a CPU that store data for quick access.

    • Registers are used to store data that is frequently accessed by the CPU.

    • They are faster than accessing data from RAM.

    • Registers are limited in number and size.

    • Examples of registers include the program counter, stack pointer, and general-purpose registers.

    • Register usage can be optimized for performance in code.

    • Accessing registers can be done using assembly language.

    • In C++, registers can be decl...read more

    Add your answer

    Q38. what is level order traversal of tree?Write code for the same.

    Ans.

    Level order traversal is a tree traversal algorithm that visits nodes level by level.

    • Start at the root node and visit all nodes at the current level before moving to the next level

    • Use a queue to keep track of nodes at each level

    • Enqueue the root node, then dequeue and visit each node while enqueueing its children

    • Repeat until the queue is empty

    • Time complexity: O(n), space complexity: O(w) where w is the maximum width of the tree

    Add your answer
    Q39. Ninja and the Maze

    Ninja went to an amusement park and visited a maze. Now, he is stuck in the maze. He can go in any direction(Up, Down, Left, or Right) from this point, but he cannot change his direction of mo...read more

    Add your answer

    Q40. Reverse the linked list in groups of k

    Ans.

    Reverse a linked list in groups of k

    • Create a function to reverse a linked list

    • Iterate through the linked list in groups of k

    • Reverse each group using the function

    • Connect the reversed groups back together

    • Return the new head of the linked list

    Add your answer

    Q41. Encapsulation and its real-time examples

    Ans.

    Encapsulation is a mechanism of wrapping data and code together into a single unit.

    • Encapsulation helps in achieving data hiding and abstraction.

    • It provides better control over the data by making it private and accessible only through public methods.

    • Real-time examples of encapsulation include a car's engine, which is encapsulated and can only be accessed through the car's interface.

    • Another example is a mobile phone, where the internal components are encapsulated and can only b...read more

    Add your answer

    Q42. What is Runtime polymorphism

    Ans.

    Runtime polymorphism is the ability of an object to take on multiple forms during runtime.

    • It is achieved through method overriding

    • It allows for more flexibility and extensibility in code

    • It is a key feature of object-oriented programming

    • Example: Animal class with different subclasses such as Dog, Cat, and Bird

    Add your answer
    Q43. Left Rotations of An Array

    You are given an array consisting of 'N' elements and you need to perform 'Q' queries on the given array. Each query consists of an integer which tells the number of elements by which ...read more

    View 4 more answers

    Q44. Coding question: Given a string, find the number of occurences of each character.

    Ans.

    Count the number of occurrences of each character in a given string.

    • Create a dictionary to store the count of each character.

    • Iterate through the string and update the count in the dictionary.

    • Return the dictionary with character count.

    View 1 answer

    Q45. Inheritance and its disadvantages

    Ans.

    Inheritance allows a subclass to inherit properties and methods from a superclass, but it has some disadvantages.

    • Inheritance can lead to tight coupling between classes, making it difficult to modify the superclass without affecting the subclass.

    • Inheritance can also lead to the creation of deep class hierarchies, which can be difficult to understand and maintain.

    • Inheritance can result in code duplication if multiple subclasses need to override the same method or property.

    • Inher...read more

    Add your answer
    Q46. Median of two sorted arrays

    You are given two sorted arrays 'A' & 'B' of sizes 'N' & 'M'. You need to find the median of the two arrays when merged. If the total number of elements i.e., N + M is even then the m...read more

    View 3 more answers
    Q47. Topological Sort

    A Directed Acyclic Graph (DAG) is a directed graph that contains no cycles.

    Topological Sorting of DAG is a linear ordering of vertices such that for every directed edge from vertex ‘u’ to verte...read more

    View 2 more answers

    Q48. Dutch national flag problem

    Ans.

    The Dutch national flag problem is a sorting problem that involves sorting an array of 3 distinct values.

    • The problem involves sorting an array of 3 distinct values: red, white, and blue.

    • The goal is to sort the array in-place, without using any additional data structures.

    • The solution involves using three pointers to keep track of the boundaries between the different values.

    Add your answer
    Q49. Kth largest element in the unsorted array

    You are given an array consisting of 'N' distinct positive integers and a number 'K'. Your task is to find the kth largest element in the array.

    Example:
    Consider the ar...read more
    View 2 more answers
    Q50. Trapping Rain Water

    You have been given a long type array/list 'ARR' of size 'N'. It represents an elevation map wherein 'ARR[i]' denotes the elevation of the 'ith' bar. Print the total amount of rainwater that ...read more

    View 3 more answers
    Q51. Sort 0 1 2

    You have been given an integer array/list(ARR) of size 'N'. It only contains 0s, 1s and 2s. Write a solution to sort this array/list.

    Note :
    Try to solve the problem in 'Single Scan'. ' Single Scan' r...read more
    View 3 more answers
    Q52. Distinct Occurences

    You are given two strings 'A' and 'B' of length 'N' and 'M' respectively, your task is to find the number of distinct occurrences of string 'B' in the string A as a subsequence.

    Note:
    1. A su...read more
    View 2 more answers

    Q53. Merge two sorted linked lists

    Ans.

    Merge two sorted linked lists

    • Create a new linked list

    • Compare the first nodes of both lists and add the smaller one to the new list

    • Move the pointer of the added node to the next node in the list

    • Repeat until one of the lists is empty

    • Add the remaining nodes of the non-empty list to the new list

    Add your answer
    Q54. Distance between two nodes of a Tree

    Given a binary tree and the value of two nodes, find the distance between the given two nodes of the Binary Tree.

    Distance between two nodes is defined as the minimum number ...read more

    View 2 more answers
    Q55. Technical Questions

    He asked me to introduce myself.

    Then he asked me whether I knew OOPS concepts.

    I explained all the OOPS concepts with real time examples.

    Questions Related to trees.

    He asked me to write some ...read more

    Add your answer

    Q56. Find all palindromic strings in a string program

    Ans.

    Program to find all palindromic strings in a given string.

    • Iterate through the string and check for palindromic substrings using two pointers.

    • Add the palindromic substrings to an array of strings.

    • Return the array of palindromic strings.

    Add your answer
    Q57. Compiler Design Question

    What is NP and NP-Hard problem?

    Add your answer

    Q58. Tree traversal to find minimum number

    Ans.

    Use tree traversal to find the minimum number in a tree structure.

    • Start at the root node and compare it with its children to find the minimum value.

    • Use depth-first search or breadth-first search to traverse the tree.

    • Keep track of the minimum value found so far as you traverse the tree.

    • Consider implementing a recursive function to traverse the tree efficiently.

    Add your answer

    Q59. Coding question: Implement Merge Sort

    Ans.

    Merge Sort is a divide-and-conquer algorithm that recursively divides an array into two halves, sorts them, and then merges them.

    • Divide the array into two halves

    • Recursively sort each half

    • Merge the sorted halves

    View 1 answer
    Q60. Compiler Design Question

    What is a regular language ?

    Add your answer

    Q61. Find 2nd max salary- SQL

    Ans.

    SQL query to find the 2nd highest salary in a table.

    • Use ORDER BY and LIMIT to sort and select the 2nd highest salary.

    • Use subquery to avoid duplicates if necessary.

    Add your answer

    Q62. 1. Write a code to split an array of integers into two subarray where both the array has equal sum.

    Ans.

    Code to split an array of integers into two subarrays with equal sum.

    • Iterate through the array and calculate the total sum.

    • Divide the sum by 2 to get the target sum for each subarray.

    • Use dynamic programming to find a subset of the array that adds up to the target sum.

    • Return the two subarrays.

    • Example: [1, 2, 3, 4, 5, 6] -> [1, 2, 3, 6], [4, 5]

    • Example: [1, 2, 3, 4, 5] -> [1, 4, 5], [2, 3]

    Add your answer

    Q63. What is method overriding

    Ans.

    Method overriding is a feature in object-oriented programming where a subclass provides a specific implementation of a method that is already provided by its parent class.

    • Occurs when a subclass provides a specific implementation of a method that is already provided by its parent class

    • The method in the subclass must have the same name, return type, and parameters as the method in the parent class

    • Allows for polymorphism, where a subclass can be treated as an instance of its par...read more

    Add your answer
    Q64. Compiler Design Question

    What is a token?

    Add your answer

    Q65. Java core features and advantages

    Ans.

    Java is a popular programming language known for its platform independence and object-oriented features.

    • Platform independence allows Java code to run on any platform without recompilation

    • Object-oriented features like encapsulation, inheritance, and polymorphism make code modular and reusable

    • Java has a vast standard library with built-in support for networking, I/O, and concurrency

    • Java is highly secure with features like bytecode verification and automatic memory management

    Add your answer

    Q66. To write code to build up a binary tree from scratch (implement a BST) and then to write all the methods like all the tree traversal algo, and all other stuffs.

    Ans.

    Implementing a binary search tree and its traversal methods.

    • Start by defining a Node class with left and right child pointers.

    • Implement insert() method to add nodes to the tree.

    • Implement inorder(), preorder(), and postorder() traversal methods.

    • Implement search() method to find a node in the tree.

    • Implement delete() method to remove a node from the tree.

    • Consider edge cases like empty tree, duplicate nodes, etc.

    Add your answer
    Q67. Compiler Design Question

    What is Grammar?

    Add your answer

    Q68. Given an array of non-negative integers.Find the length of the longest subsequence such that elements in the subsequence are contiguous integers. The consecutive numbers can be in any order. Example n=7 nums={2...

    read more
    Ans.

    Find the length of the longest subsequence of contiguous integers in an array.

    • Sort the array

    • Iterate through the array and check for consecutive integers

    • Keep track of the longest subsequence found

    Add your answer

    Q69. Get list of pincodes from these objects Employee{ id Long, name String, Addresses : List } Addresses{ houseNo long, pindcode long, state String, country String, } Ans. Use flatMap to flatten and then use map to...

    read more
    Ans.

    Use flatMap and map to extract list of pincodes from Employee objects

    • Use flatMap to flatten the list of Addresses in each Employee object

    • Use map to iterate over the flattened list and extract the pincodes

    • Example: employeeList.stream().flatMap(emp -> emp.getAddresses().stream()).map(address -> address.getPincode()).collect(Collectors.toList())

    Add your answer

    Q70. What is Database Pooling, Hikari and its configurations. Java 8 to current enchancements and current java version Factory and Builder design patterns to explain and code Project expalantion and details, Cross q...

    read more
    Ans.

    Database pooling is a technique used to manage a pool of database connections for efficient resource utilization. HikariCP is a popular database connection pooling library in Java.

    • HikariCP is a high-performance database connection pooling library for Java applications.

    • It is known for its low latency and high throughput.

    • Configurations for HikariCP include settings such as maximum pool size, connection timeout, and idle timeout.

    • Example: HikariConfig config = new HikariConfig();...read more

    Add your answer

    Q71. DBMS types and features known

    Ans.

    DBMS types include relational, NoSQL, object-oriented, and hierarchical. Each has unique features and use cases.

    • Relational DBMS: structured data, ACID compliance, SQL queries (e.g. MySQL, Oracle)

    • NoSQL DBMS: unstructured data, flexible schema, horizontal scaling (e.g. MongoDB, Cassandra)

    • Object-oriented DBMS: data stored as objects, supports inheritance and polymorphism (e.g. db4o)

    • Hierarchical DBMS: data organized in a tree-like structure, good for storing nested data (e.g. IBM...read more

    Add your answer

    Q72. Code a system to query an API, do multiprocessing and improve the efficiency

    Ans.

    Code a system to query an API, do multiprocessing and improve efficiency

    • Use a library like requests in Python to query the API

    • Implement multiprocessing using a library like multiprocessing or threading in Python

    • Optimize efficiency by caching API responses or using asynchronous programming

    Add your answer

    Q73. conditions for a deadlock

    Ans.

    Conditions for a deadlock in software engineering

    • Deadlock occurs when each process in a set is waiting for an event that only another process in the set can cause

    • Four conditions for a deadlock: mutual exclusion, hold and wait, no preemption, circular wait

    • Example: Process A holds resource X and waits for resource Y, while Process B holds resource Y and waits for resource X

    Add your answer

    Q74. 2. find unique character in a window of k size in a string

    Ans.

    Find unique characters in a window of k size in a string.

    • Use a sliding window approach.

    • Maintain a hash table to keep track of character frequency.

    • Remove characters from hash table as the window slides.

    Add your answer

    Q75. Find the maximum for each and every contiguous subarray of size k from an arr of size n.

    Ans.

    Find maximum for each contiguous subarray of size k from an array of size n.

    • Iterate through the array and keep track of maximum for each subarray of size k

    • Use a sliding window approach to efficiently calculate maximum for each subarray

    • Time complexity: O(n)

    • Example: arr = [10, 5, 2, 7, 1, 9, 4], k = 3, output = [10, 7, 7, 9, 9]

    Add your answer
    Q76. DBMS Question

    How many level of Normalization are there ?

    Add your answer

    Q77. concets on oops

    Ans.

    OOPs concepts are the fundamental principles of object-oriented programming.

    • Abstraction

    • Encapsulation

    • Inheritance

    • Polymorphism

    Add your answer

    Q78. 1. If you given a no return its corresponding excel no.

    Ans.

    Convert given no to corresponding excel no.

    • Excel no starts from 1 and goes up to 16384

    • Excel no is calculated using column and row numbers

    • For example, 1 corresponds to A, 27 corresponds to AA, 28 corresponds to AB, and so on

    Add your answer

    Q79. How do you troubleshoot if a having internet issue?

    Ans.

    To troubleshoot an internet issue, check the connection, restart the router, check for software issues, and contact the service provider if needed.

    • Check the physical connection of the router and modem

    • Restart the router and modem

    • Check for any software issues on the device (e.g. network settings, firewall)

    • Contact the internet service provider for further assistance

    Add your answer
    Q80. React Question

    How does Redux work?

    Add your answer

    Q81. Program to find repeating characters in a string

    Ans.

    The program finds repeating characters in a given string.

    • Iterate through each character in the string

    • Store each character in a data structure

    • If a character is already present in the data structure, it is a repeating character

    View 1 answer

    Q82. How to find the Second highest salary from employees table. Write the logic for pre-order, inorder and post-order traversal of a binary tree

    Ans.

    To find the second highest salary from employees table and traverse a binary tree in pre-order, in-order, and post-order.

    • To find the second highest salary, you can use a subquery or window function like ROW_NUMBER() or DENSE_RANK().

    • For pre-order traversal, visit the root node first, then recursively do a pre-order traversal of the left subtree, followed by the right subtree.

    • For in-order traversal, recursively do an in-order traversal of the left subtree, visit the root node, ...read more

    Add your answer

    Q83. 1.Implement merge sort. 2. Kth largest element.

    Ans.

    Implement merge sort and find kth largest element in an array.

    • Merge sort is a divide and conquer algorithm that recursively divides the array into two halves, sorts them and then merges them.

    • Kth largest element can be found using quick select algorithm or by sorting the array and returning the kth element from the end.

    • Merge sort has a time complexity of O(nlogn) and space complexity of O(n).

    • Quick select has a time complexity of O(n) in average case and O(n^2) in worst case.

    • So...read more

    Add your answer

    Q84. Types of props and their how do they work?

    Ans.

    Props are inputs passed to React components. There are two types: ownProps and childrenProps.

    • ownProps are passed directly to the component from its parent

    • childrenProps are passed to the component through its children

    • ownProps can be accessed using this.props in the component

    • childrenProps can be accessed using this.props.children in the component

    Add your answer

    Q85. Design Patterns like Singleton and how to create them

    Ans.

    Singleton is a creational design pattern that ensures a class has only one instance and provides a global point of access to it.

    • To create a Singleton, make the constructor private to prevent direct instantiation

    • Create a static method that returns the instance of the class

    • Use lazy initialization to create the instance only when it's needed

    • Ensure thread safety by using synchronized keyword or double-checked locking

    • Examples: java.lang.Runtime, java.awt.Desktop, java.util.Calenda...read more

    Add your answer
    Q86. Compiler Design Question

    . List The Sub Parts Or Phases Of Analysis Part

    Add your answer
    Q87. React Question

    Difference between Functional Components and Class Components

    Add your answer

    Q88. What are joins? How are they useful?

    Ans.

    Joins are used to combine data from two or more tables based on a related column.

    • Joins are useful for retrieving data from multiple tables that have a relationship.

    • There are different types of joins such as inner join, left join, right join, and full outer join.

    • Inner join returns only the matching rows from both tables.

    • Left join returns all the rows from the left table and matching rows from the right table.

    • Right join returns all the rows from the right table and matching row...read more

    Add your answer

    Q89. Segregate an array containing 0 and 1 with minimum number of swaps.

    Ans.

    Segregate an array of 0s and 1s with minimum swaps.

    • Count the number of 0s in the array.

    • Swap the 1s with the 0s until all 0s are on one side and 1s on the other.

    • The minimum number of swaps required is half the number of 1s on the side with fewer 1s.

    Add your answer
    Q90. React Question

    What is props?

    Add your answer

    Q91. What is Singleton design pattern.

    Ans.

    Singleton design pattern restricts the instantiation of a class to one object.

    • Ensures only one instance of a class exists

    • Provides a global point of access to that instance

    • Used when only one instance of a class is needed throughout the application

    • Example: Database connection manager

    Add your answer

    Q92. Explain Automation framework that u suggest to automate amazon application

    Ans.

    I suggest using a hybrid automation framework for testing Amazon application.

    • Use Selenium WebDriver for web automation

    • Use Appium for mobile automation

    • Use TestNG for test management and reporting

    • Use Page Object Model for better code maintenance

    • Use data-driven approach for test data management

    • Use Jenkins for continuous integration and deployment

    Add your answer

    Q93. Given 2 Nodes 1->9 ->0 1->0 Add both of them so resulting node would be 2->0->0 190 +10 = 200 Java 8 questions

    Ans.

    Add two linked lists representing numbers and return the resulting linked list.

    • Traverse both linked lists and add the corresponding digits, keeping track of carry.

    • Create a new node for each digit and update the carry for the next iteration.

    • If one list is longer than the other, add the remaining digits to the result.

    • Handle the case where the carry is not zero after all digits have been added.

    • Time complexity: O(max(m,n)), where m and n are the lengths of the input lists.

    Add your answer

    Q94. How do you handle an irate customer?

    Ans.

    I remain calm, listen actively, empathize with their situation, apologize for any inconvenience, and work towards finding a solution.

    • Remain calm and composed

    • Listen actively to understand their concerns

    • Empathize with their situation

    • Apologize for any inconvenience caused

    • Work towards finding a solution to address their issue

    Add your answer
    Q95. React Question

    What is Redux?

    Add your answer

    Q96. What is your approach to building basic logic skills?

    Ans.

    My approach to building basic logic skills involves practicing problem-solving exercises, breaking down complex problems into smaller parts, and seeking feedback to improve.

    • Practice problem-solving exercises regularly to strengthen logical thinking abilities.

    • Break down complex problems into smaller, more manageable parts to better understand the problem and find solutions.

    • Seek feedback from peers or mentors to identify areas for improvement and refine logic skills.

    • Utilize res...read more

    Add your answer

    Q97. Programming - find the frequency of given character in a sorted string.

    Ans.

    Use binary search to find the first and last occurrence of the character, then calculate the frequency.

    • Use binary search to find the first occurrence of the character in the string.

    • Use binary search to find the last occurrence of the character in the string.

    • Calculate the frequency by subtracting the indices of the last and first occurrences and adding 1.

    Add your answer

    Q98. Method overriding based code question -> guess the output

    Ans.

    Method overriding in Java with code example

    • Output will be 'Child class method' as the method in Child class overrides the method in Parent class

    • Method overriding is a feature that allows a subclass to provide a specific implementation of a method that is already provided by its superclass

    • The method in the subclass should have the same name, return type, and parameters as the method in the superclass

    Add your answer

    Q99. OOPs concepts, and their pillars. Design a Vehicle class, by understanding the requirements

    Ans.

    OOPs concepts and pillars. Design a Vehicle class based on requirements.

    • OOPs concepts: Abstraction, Encapsulation, Inheritance, Polymorphism

    • Vehicle class requirements: attributes like make, model, year, methods like start, stop, accelerate

    Add your answer
    Q100. OS Question

    What is segmentation

    Add your answer
    1
    2
    Contribute & help others!
    Write a review
    Share interview
    Contribute salary
    Add office photos

    Interview Process at Godrej Consumer Products

    based on 89 interviews in the last 1 year
    Interview experience
    3.7
    Good
    View more
    Interview Tips & Stories
    Ace your next interview with expert advice and inspiring stories

    Top Interview Questions from Similar Companies

    3.3
     • 479 Interview Questions
    3.7
     • 407 Interview Questions
    3.6
     • 377 Interview Questions
    3.8
     • 265 Interview Questions
    3.9
     • 192 Interview Questions
    3.9
     • 135 Interview Questions
    View all
    Top Bounteous x Accolite Interview Questions And Answers
    Share an Interview
    Stay ahead in your career. Get AmbitionBox app
    qr-code
    Helping over 1 Crore job seekers every month in choosing their right fit company
    70 Lakh+

    Reviews

    5 Lakh+

    Interviews

    4 Crore+

    Salaries

    1 Cr+

    Users/Month

    Contribute to help millions
    Get AmbitionBox app

    Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

    Follow us
    • Youtube
    • Instagram
    • LinkedIn
    • Facebook
    • Twitter