Bounteous x Accolite
40+ Societe Generale Global Solution Centre Interview Questions and Answers
Q1. Loot Houses Problem Statement
A thief is planning to steal from several houses along a street. Each house has a certain amount of money stashed. However, the thief cannot loot two adjacent houses. Determine the...read more
Q2. Topological Sort Problem Statement
You are given a directed acyclic graph (DAG). Your task is to perform topological sorting of the graph and return any valid ordering.
Explanation:
A directed acyclic graph is ...read more
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 moreInterview 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
Q4. Can you make a constructor private in Cpp, if not what error will you get (Compile Time Error or Runtime Error)
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.
Q5. What is the difference between Binary Tree and Binary Search Tree
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
Q6. What are the Dynamic-link library (DLL) in Cpp and its use?
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.
Q7. What are function pointers and the differences between normal function and function pointers?
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
Q8. Explain the diamond problem in Cpp, and how to solve it.
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.
Q9. What are the ways to prevent Instantiation of Class?
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
Q10. A tweak to the pair sum problem: there can be any number of elements that add up to the target
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
Q11. Separate negative and positive numbers in a linked list.
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
Q12. How can you print names of 4 threads in the given order?
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.
Q13. Delete Kth node from the end of the linked list in single iteration
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
Q14. Segregate 0's and 1's in array - Dutch National Flag Algo Again
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
Q15. Equal Sum Partition along with print that 2 arrays (DP + matrix printing)
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
Q16. 8. If not engineering then what?
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.
Q17. How to check for a loop in linked list?
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).
Q18. Max multiplication of 3 numbers in an array
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.
Q19. What is finally and will it execute if System.exit() is called?
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
Q20. Project Explanation which includes Q&A as well.
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.
Q21. Check if a linked list is circular or not
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)
Q22. Remove duplicates from Linked List. Both variants.
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
Q23. Calculating the depth of a tree
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
Q24. What are registers in Cpp?
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
Q25. what is level order traversal of tree?Write code for the same.
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
Q26. Reverse the linked list in groups of k
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
Q27. Encapsulation and its real-time examples
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
Q28. What is Runtime polymorphism
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
Q29. Coding question: Given a string, find the number of occurences of each character.
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.
Q30. Inheritance and its disadvantages
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
Q31. Dutch national flag problem
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.
Q32. Merge two sorted linked lists
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
Q33. Find all palindromic strings in a string program
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.
Q34. Tree traversal to find minimum number
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.
Q35. Coding question: Implement Merge Sort
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
Q36. Find 2nd max salary- SQL
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.
Q37. What is method overriding
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
Q38. Java core features and advantages
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
Q39. DBMS types and features known
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
Q40. conditions for a deadlock
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
Q41. concets on oops
OOPs concepts are the fundamental principles of object-oriented programming.
Abstraction
Encapsulation
Inheritance
Polymorphism
Top HR Questions asked in Societe Generale Global Solution Centre
Interview Process at Societe Generale Global Solution Centre
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month