Tcg Digital Solutions
Alamo XS Real Interview Questions and Answers
Q1. How does map and unordered map are implemented in C++ STL library.
Map and unordered map are implemented as associative containers in C++ STL library.
Map is implemented as a balanced binary search tree while unordered map is implemented as a hash table.
Map stores elements in a sorted order while unordered map does not guarantee any specific order.
Map has a logarithmic time complexity for insertion, deletion, and search operations while unordered map has an average constant time complexity for these operations.
Map allows only unique keys whil...read more
Q2. How to debug a C++ program containg a segmentation fault using GDB, how to add break points at suspected function, how to take core dumps of a binary.
Debugging C++ program with segmentation fault using GDB
Compile the program with -g flag to include debugging symbols
Run the program with GDB and set breakpoints at suspected functions
Use 'run' command to execute the program within GDB
Use 'backtrace' command to see the call stack when the segmentation fault occurs
Use 'print' command to inspect variables and memory addresses
Use 'core dump' command to generate a core dump file for post-mortem analysis
Q3. How to grep a value from a file containing key = value format enteries in each line when key is given using bash or shell scripting.
To grep a value from a file with key=value format, use awk command with delimiter as '=' and search for the key.
Use awk command with delimiter as '=' to split the line into key and value
Search for the key in the key column and print the corresponding value column
Example: awk -F'=' '/key/ {print $2}' file.txt
Q4. How to store a key value pairs in C++ data structures where key is same for some of the entries ?
Use C++ map or unordered_map to store key value pairs with same key
C++ map and unordered_map are associative containers that store elements in key value pairs
If the key is same for some entries, map will store only one entry while unordered_map can store multiple entries
Example: map
myMap; myMap["key1"] = 1; myMap["key2"] = 2; myMap["key1"] = 3; // myMap["key1"] will be 3 Example: unordered_map
myUnorderedMap; myUnorderedMap["key1"] = 1; myUnorderedMap["key2"] = 2; myUnordered...read more
Q5. What are virtual functions, Vtables, and method overriding in C++
Virtual functions are functions that can be overridden in derived classes. Vtables are tables of function pointers used for dynamic dispatch.
Virtual functions allow for polymorphism and dynamic binding
Vtables are used to implement virtual functions
Method overriding is when a derived class provides its own implementation of a virtual function
Virtual functions are declared using the virtual keyword
Example: class Animal { virtual void makeSound() { cout << 'Animal sound'; } }; c...read more
Q6. Explain directives , dependency injection, promise and observables,way features, routing, interceptor, communication between components
Explanation of directives, dependency injection, promise and observables, routing, interceptor, and communication between components.
Directives are markers on a DOM element that tell AngularJS to attach a specified behavior to that element.
Dependency Injection is a design pattern that allows a class to be injected with its dependencies rather than creating them itself.
Promises are objects that represent the eventual completion or failure of an asynchronous operation and its r...read more
Q7. How to create a singleton class ?
A singleton class is a class that can only have one instance created throughout the lifetime of an application.
Create a private constructor to prevent external instantiation.
Create a private static instance of the class.
Create a public static method to access the instance.
Ensure thread safety by using synchronized keyword or static initializer.
Example: public class Singleton { private static Singleton instance = null; private Singleton() {} public static synchronized Singleto...read more
Q8. What is singleton class?
A singleton class is a class that can only have one instance created at a time.
Singleton classes are often used in situations where only one instance of a class is needed, such as for managing a database connection or a configuration file.
The singleton pattern is implemented by making the constructor of the class private and providing a static method that returns the single instance of the class.
Singleton classes can be thread-safe by using synchronization or lazy initializat...read more
Q9. Explain Angular hooks
Angular hooks are functions that allow developers to tap into the lifecycle of a component or directive.
Angular hooks are used to perform actions at specific points in the lifecycle of a component or directive
There are several types of hooks, including ngOnInit, ngOnChanges, and ngOnDestroy
ngOnInit is called once when the component is initialized
ngOnChanges is called whenever a data-bound input property changes
ngOnDestroy is called just before the component is destroyed
More about working at Tcg Digital Solutions
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month