Add office photos
CGI Group logo
Engaged Employer

CGI Group

Verified
4.0
based on 4.6k Reviews
Video summary
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
Software Engineer
Experienced
Skills
Clear (1)

40+ CGI Group Software Engineer Interview Questions and Answers

Updated 12 Oct 2024

Q1. String Compression Problem Statement

Ninja needs to perform basic string compression. For any character that repeats consecutively more than once, replace the repeated sequence with the character followed by th...read more

Ans.

Implement a function to compress a string by replacing consecutive characters with the character followed by the count of repetitions.

  • Iterate through the input string and keep track of consecutive characters and their counts

  • Replace consecutive characters with the character followed by the count of repetitions if count is greater than 1

  • Return the compressed string

View 1 answer
right arrow
Q2. How many types of memory areas are allocated by the JVM?
Ans.

JVM allocates 5 types of memory areas: Method Area, Heap, Stack, PC Register, and Native Method Stack.

  • Method Area stores class structures and static variables.

  • Heap is where objects are allocated.

  • Stack holds method-specific data and references.

  • PC Register stores the address of the current instruction being executed.

  • Native Method Stack is used for native method execution.

Add your answer
right arrow

Q3. 1,Diff bwn aggregation and composition? 2,w a p to print fibnoci sries? with recursion? 3,Diff bwn interface and abstract? 4,w ap to print * patteren? * ** *** **** 5,Explain custom immutable class? 6,what is i...

read more
Ans.

This JSON contains answers to interview questions for a Software Engineer position.

  • Aggregation and composition are both forms of association in object-oriented programming.

  • Aggregation represents a 'has-a' relationship, where one object contains another object as a part.

  • Composition is a stronger form of aggregation, where the lifetime of the contained object is controlled by the container object.

  • Fibonacci series can be printed using recursion by defining a recursive function t...read more

Add your answer
right arrow
Q4. What are the various access specifiers in Java?
Ans.

Access specifiers in Java control the visibility of classes, methods, and variables.

  • There are four access specifiers in Java: public, private, protected, and default.

  • Public: accessible from any other class.

  • Private: accessible only within the same class.

  • Protected: accessible within the same package and subclasses.

  • Default: accessible only within the same package.

Add your answer
right arrow
Discover CGI Group interview dos and don'ts from real experiences
Q5. What is the difference between an abstract class and an interface in OOP?
Ans.

Abstract class can have both abstract and non-abstract methods, while interface can only have abstract methods.

  • Abstract class can have constructors, fields, and methods, while interface cannot have any implementation.

  • A class can implement multiple interfaces but can only inherit from one abstract class.

  • Abstract classes are used to define a common behavior for subclasses, while interfaces are used to define a contract for classes to implement.

  • Example: Abstract class 'Animal' w...read more

Add your answer
right arrow
Q6. What is the purpose of using @ComponentScan in class files?
Ans.

@ComponentScan is used in class files to enable component scanning for Spring beans.

  • Enables Spring to automatically detect and register Spring beans within the specified package(s)

  • Reduces the need for manual bean registration in configuration files

  • Can be used with basePackages attribute to specify the base package for scanning

  • Can also be used with includeFilters and excludeFilters to customize the scanning process

Add your answer
right arrow
Are these interview questions helpful?
Q7. What are the basic annotations that Spring Boot offers?
Ans.

Spring Boot offers basic annotations like @RestController, @RequestMapping, @Autowired, @Component, @Service, @Repository.

  • @RestController - used to define RESTful web services.

  • @RequestMapping - maps web requests to specific handler methods.

  • @Autowired - used for automatic dependency injection.

  • @Component - marks a Java class as a Spring component.

  • @Service - marks a Java class as a Spring service.

  • @Repository - marks a Java class as a Spring data repository.

Add your answer
right arrow
Q8. What are the types of design patterns in Java?
Ans.

Design patterns in Java are reusable solutions to common problems encountered in software design.

  • Creational Patterns: Singleton, Factory, Builder

  • Structural Patterns: Adapter, Decorator, Facade

  • Behavioral Patterns: Observer, Strategy, Template Method

Add your answer
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop
Q9. What do you know about the JIT compiler?
Ans.

JIT compiler stands for Just-In-Time compiler, which compiles code during runtime instead of ahead of time.

  • JIT compiler improves performance by compiling code on the fly as it is needed

  • It can optimize code based on runtime conditions and platform specifics

  • Examples include Java HotSpot VM's JIT compiler and .NET's JIT compiler

Add your answer
right arrow

Q10. how can you improve performance of your spring boot application

Ans.

To improve performance of a Spring Boot application, consider optimizing database queries, caching, using asynchronous processing, and monitoring performance metrics.

  • Optimize database queries by using indexes, avoiding N+1 queries, and limiting the amount of data fetched.

  • Implement caching to store frequently accessed data in memory, reducing the need to fetch data from the database repeatedly.

  • Use asynchronous processing for time-consuming tasks to free up resources and improv...read more

Add your answer
right arrow

Q11. how did you implement logging in your springboot application

Ans.

Implemented logging in Spring Boot application using SLF4J and Logback

  • Added dependencies for SLF4J and Logback in pom.xml

  • Configured logback.xml for logging levels and appenders

  • Injected Logger instances using @Autowired annotation in classes

  • Used logger.debug(), logger.info(), logger.error() methods for logging

Add your answer
right arrow
Q12. What do you mean by data encapsulation?
Ans.

Data encapsulation is the concept of bundling data and methods that operate on the data into a single unit or class.

  • Data encapsulation helps in hiding the internal state of an object and restricting access to it.

  • It allows for better control over the data by preventing external code from directly modifying it.

  • Encapsulation also promotes code reusability and modularity by grouping related data and functions together.

  • Example: In object-oriented programming, a class encapsulates ...read more

Add your answer
right arrow

Q13. Write a code to find Number of occurrences of a word in a string

Ans.

Code to find number of occurrences of a word in a string

  • Split the string into an array of words

  • Loop through the array and count the occurrences of the given word

Add your answer
right arrow
Q14. What is dependency injection?
Ans.

Dependency injection is a design pattern where components are given their dependencies rather than creating them internally.

  • Allows for easier testing by providing mock dependencies

  • Promotes loose coupling between components

  • Improves code reusability and maintainability

  • Examples: Constructor injection, Setter injection, Interface injection

Add your answer
right arrow

Q15. Singleton can be broken by cloning, how to prevent it?

Ans.

To prevent Singleton from being broken by cloning, we can override the clone method and throw an exception.

  • Override the clone method in the Singleton class and throw an exception to prevent cloning.

  • Alternatively, you can return the same instance in the clone method instead of creating a new instance.

  • Use serialization and deserialization to create a new instance of the Singleton class.

Add your answer
right arrow

Q16. When a function is passed as an argument to another function. Then it is a callback function

Ans.

Yes, a callback function is a function that is passed as an argument to another function.

  • Callback functions are commonly used in event handling, asynchronous programming, and functional programming.

  • Example: setTimeout(function() { console.log('Hello!'); }, 1000);

  • Example: array.map(function(item) { return item * 2; });

Add your answer
right arrow

Q17. what is oop concept, difference b/w interface and abstract class

Ans.

OOP concept focuses on creating objects that interact with each other. Interface is a contract for classes to implement, while abstract class can have some implemented methods.

  • OOP concept involves creating objects that have properties and methods to interact with each other

  • Interface is a contract that defines a set of methods that a class must implement

  • Abstract class can have some implemented methods along with abstract methods that must be implemented by subclasses

Add your answer
right arrow

Q18. name two design pattern used in project

Ans.

Two common design patterns used in projects are Singleton and Observer patterns.

  • Singleton pattern ensures a class has only one instance and provides a global point of access to it.

  • Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Add your answer
right arrow

Q19. What is a vector how is it different from array

Ans.

A vector is a dynamic array that can resize itself, while an array has a fixed size.

  • Vectors can grow or shrink in size dynamically, while arrays have a fixed size.

  • Vectors can easily insert or remove elements at any position, while arrays require shifting elements.

  • Vectors provide bounds checking and can be passed by value, while arrays cannot.

  • Example: vector names = {"Alice", "Bob", "Charlie"};

Add your answer
right arrow

Q20. Unique and primary key Clustered vs non cluster index Store proc

Ans.

The question covers database concepts like unique and primary keys, clustered and non-clustered indexes, and stored procedures.

  • A unique key is a column or set of columns that uniquely identifies each row in a table.

  • A primary key is a unique key that also enforces data integrity rules.

  • A clustered index determines the physical order of data in a table, while a non-clustered index does not.

  • Stored procedures are precompiled SQL statements that can be executed multiple times.

Add your answer
right arrow

Q21. What is polymorphism and examples of it

Ans.

Polymorphism is the ability of an object to take on many forms. It allows objects of different classes to be treated as if they were of the same class.

  • Polymorphism can be achieved through method overloading and method overriding

  • Method overloading is when multiple methods have the same name but different parameters

  • Method overriding is when a subclass provides its own implementation of a method that is already defined in its superclass

  • An example of polymorphism is the use of a ...read more

Add your answer
right arrow

Q22. Diff between Rest Controller & Controller?

Ans.

Rest Controller is used for RESTful web services while Controller is used for general web applications.

  • Rest Controller is used for creating RESTful web services that can consume and produce JSON, XML, etc.

  • Controller is used for general web applications that render views and handle form submissions.

  • Rest Controller uses @RestController annotation while Controller uses @Controller annotation.

  • Rest Controller methods return data directly while Controller methods return ModelAndVie...read more

Add your answer
right arrow

Q23. Parent and child class in Java Constructor overloading

Ans.

Parent and child classes in Java can have constructors with different parameters, known as constructor overloading.

  • In Java, a child class can have its own constructors in addition to inheriting constructors from the parent class.

  • Constructor overloading allows multiple constructors with different parameters in the same class.

  • Example: Parent class 'Vehicle' with a constructor taking 'int speed' parameter, and child class 'Car' with a constructor taking 'int speed' and 'String m...read more

Add your answer
right arrow

Q24. Visual studio > file > new > project name

Ans.

Creating a new project in Visual Studio involves navigating to File > New > Project and providing a name for the project.

  • Navigate to File menu in Visual Studio

  • Select New option

  • Choose Project option

  • Enter a name for the project

Add your answer
right arrow

Q25. type of marker interface

Ans.

Marker interfaces are interfaces with no methods, used to mark classes for special treatment.

  • Marker interfaces have no methods, they simply mark a class as having a certain property or behavior.

  • Examples include Serializable interface in Java, which marks a class as serializable for object serialization.

  • Another example is Cloneable interface in Java, which marks a class as cloneable for object cloning.

Add your answer
right arrow

Q26. time complexity of hashmap

Ans.

Time complexity of hashmap operations is O(1) on average, but can be O(n) in worst case.

  • HashMap operations like get, put, remove have constant time complexity O(1) on average due to hashing

  • In worst case scenario, all keys hash to the same bucket resulting in linear search O(n)

  • Rehashing occurs when load factor exceeds a threshold, increasing time complexity temporarily

Add your answer
right arrow

Q27. types of spring beans scopes

Ans.

Spring beans can have different scopes like singleton, prototype, request, session, and application.

  • Singleton scope: Bean is created only once per Spring IoC container

  • Prototype scope: Bean is created each time it is requested

  • Request scope: Bean is created once per HTTP request

  • Session scope: Bean is created once per HTTP session

  • Application scope: Bean is created once per ServletContext

Add your answer
right arrow

Q28. Remove repeating letters in a string using streams

Ans.

Use streams to remove repeating letters in a string

  • Convert the string to a character array

  • Use a stream to filter out repeating characters

  • Collect the characters back into a string

Add your answer
right arrow

Q29. Sort the list of car model in reverse order

Ans.

Sort the list of car models in reverse order

  • Use a sorting algorithm like bubble sort or quicksort to rearrange the array in reverse order

  • Alternatively, use built-in functions like sort() with a custom comparator function to achieve the same result

Add your answer
right arrow

Q30. Find the palindrome in an array

Ans.

Find palindromes in an array of strings

  • Iterate through each string in the array

  • Check if the string is equal to its reverse to determine if it's a palindrome

  • Store palindromes in a separate array

Add your answer
right arrow

Q31. Current project architecture

Ans.

Our current project architecture follows a microservices approach.

  • We use Docker containers to deploy each microservice.

  • We have a centralized API gateway to handle requests and routing.

  • We use Kubernetes for orchestration and scaling.

  • We use a combination of NoSQL and SQL databases depending on the service's needs.

Add your answer
right arrow

Q32. Visual studio project creation steps

Ans.

Visual Studio project creation involves several steps to set up a new project.

  • Open Visual Studio IDE

  • Click on 'File' > 'New' > 'Project'

  • Select the project type (e.g. Console Application, Web Application)

  • Choose the programming language (e.g. C#, VB.NET)

  • Specify project name, location, and solution name

  • Click 'Create' to generate the project files

Add your answer
right arrow

Q33. differentiate joins in MySql?

Ans.

MySql supports four types of joins: INNER, LEFT, RIGHT, and FULL OUTER.

  • 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 rows from the left table.

  • FULL OUTER JOIN returns all the rows from both tables, with NULL values in the columns where there is no match.

  • JOIN and INNER JOIN are equivalent.

  • LEFT OUTER JOIN and LEF...read more

Add your answer
right arrow

Q34. What are tools you used

Ans.

I have used a variety of tools including IDEs, version control systems, testing frameworks, and build tools.

  • IDEs: Visual Studio, IntelliJ IDEA, Eclipse

  • Version Control Systems: Git, SVN

  • Testing Frameworks: JUnit, Selenium

  • Build Tools: Maven, Gradle

Add your answer
right arrow

Q35. Find the reverse of a number

Ans.

To reverse a number, convert it to a string, reverse the string, and convert it back to a number.

  • Convert the number to a string

  • Reverse the string

  • Convert the reversed string back to a number

Add your answer
right arrow

Q36. What is callback?

Ans.

A callback is a function that is passed as an argument to another function and is executed after a certain event occurs.

  • Callback functions are commonly used in event handling, asynchronous programming, and APIs.

  • They allow for more flexible and modular code by separating concerns.

  • Example: setTimeout function in JavaScript takes a callback function as an argument to be executed after a specified time.

Add your answer
right arrow

Q37. Explained challenge faced

Ans.

Developing a real-time chat application with WebSocket technology

  • Implemented WebSocket protocol for real-time communication

  • Faced challenges with handling large volumes of concurrent connections

  • Optimized code for efficient message delivery and latency reduction

Add your answer
right arrow

Q38. Hashmap internal working of it

Ans.

Hashmap is a data structure that stores key-value pairs and uses hashing to retrieve values quickly.

  • Hashmap uses an array to store the key-value pairs

  • The keys are hashed to generate an index in the array

  • If two keys hash to the same index, a collision occurs and the values are stored in a linked list

  • Retrieving a value involves hashing the key to find the index and then traversing the linked list if necessary

Add your answer
right arrow

Q39. Define object and class

Ans.

Object is an instance of a class that encapsulates data and behavior. Class is a blueprint for creating objects.

  • Object is a specific instance of a class

  • Class defines the properties and behaviors of objects

  • Example: Class 'Car' defines properties like color and behavior like drive()

Add your answer
right arrow

Q40. features of java 8

Ans.

Java 8 introduced several new features including lambda expressions, streams, and default methods.

  • Lambda expressions allow for functional programming and simplify code.

  • Streams provide a way to process collections of data in a functional way.

  • Default methods allow for adding new methods to interfaces without breaking existing code.

  • Date and time API improvements.

  • Nashorn JavaScript engine.

  • Parallel operations on collections.

  • Type annotations.

  • Repeatable annotations.

  • Optional class.

  • Ba...read more

Add your answer
right arrow

Q41. flatten an array

Ans.

Flatten an array of strings

  • Use recursion to iterate through the array and flatten nested arrays

  • Concatenate the elements of the array into a single array

  • Check if each element is an array, if so, recursively flatten it

Add your answer
right arrow

Q42. Explain sap process

Ans.

SAP process is a set of activities and tasks involved in implementing and managing SAP software solutions.

  • SAP process involves planning, designing, configuring, testing, and deploying SAP software.

  • It includes activities like requirement gathering, system analysis, customization, and integration.

  • SAP process also involves training end-users, data migration, and ongoing support and maintenance.

  • Examples of SAP processes include implementing SAP ERP, SAP CRM, or SAP HANA solutions...read more

Add your answer
right arrow

More about working at CGI Group

Back
Awards Leaf
AmbitionBox Logo
Top Rated Company for Women - 2024
Awards Leaf
Awards Leaf
AmbitionBox Logo
Top Rated IT/ITES Company - 2024
Awards Leaf
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at CGI Group Software Engineer

based on 68 interviews
5 Interview rounds
Technical Round - 1
Technical Round - 2
Technical Round - 3
HR Round - 1
HR Round - 2
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Software Engineer Interview Questions from Similar Companies

Info Edge Logo
3.9
 • 50 Interview Questions
Amdocs Logo
3.7
 • 27 Interview Questions
Lowe's Logo
4.1
 • 17 Interview Questions
View all
Recently Viewed
JOBS
Browse jobs
Discover jobs you love
JOBS
Browse jobs
Discover jobs you love
DESIGNATION
SALARIES
Capgemini
LIST OF COMPANIES
Discover companies
Find best workplace
DESIGNATION
SALARIES
Capgemini
SALARIES
Cognizant
SALARIES
Cognizant
SALARIES
Capgemini
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
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

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