This section includes:
-
Java technical questions
-
OOP and DSA questions
-
Spring/Hibernate basics (optional but useful)
-
Database (SQL) questions
-
Behavioral & HR questions
-
CGI-specific interview expectations
Core Java Interview Questions (With Sample Answers)
Q1. What is the difference between JDK, JRE, and JVM?
A:
-
JVM (Java Virtual Machine) executes Java bytecode and provides platform independence.
-
JRE (Java Runtime Environment) includes JVM + libraries required to run Java applications.
-
JDK (Java Development Kit) includes JRE + compilers/tools needed to develop Java applications.
Q2. What are OOP principles in Java?
A:
-
Encapsulation – Hiding internal details using classes.
-
Inheritance – Code reuse using parent-child relationships.
-
Polymorphism – Same method acting differently (overloading/overriding).
-
Abstraction – Hiding complexity and showing only essentials.
Q3. Explain method overloading vs method overriding.
A:
-
Overloading: Same method name with different parameters (compile-time polymorphism).
-
Overriding: Same method name/signature in subclass (runtime polymorphism).
Q4. What are Java access modifiers?
A:
-
public: Accessible everywhere
-
private: Accessible only within the class
-
protected: Accessible in the same package and subclasses
-
default: Accessible within the same package
Q5. What is the difference between ArrayList and LinkedList?
A:
-
ArrayList: Fast for indexing, slower for insert/delete.
-
LinkedList: Fast for insert/delete, slower for random access.
Spring & Hibernate (Basic Level)
Q6. What is Spring Framework?
A: Spring is a lightweight Java framework used for building enterprise apps. It supports dependency injection and aspect-oriented programming.
Q7. What is Hibernate?
A: Hibernate is an ORM tool for mapping Java objects with database tables. It helps with data persistence without writing SQL manually.
🧠 Data Structures and Logic (Basic for Freshers)
Q8. How do you reverse a string in Java?
Q9. What is a HashMap? How does it work?
A: A HashMap stores data in key-value pairs. It uses hashCode() to determine the bucket and equals() to resolve key collisions.
🗃️ SQL/Database Interview Questions
Q10. What is the difference between WHERE and HAVING?
-
WHERE is used before aggregation, filters rows.
-
HAVING is used after aggregation, filters groups.
Q11. Write a SQL query to fetch top 3 highest salaries.
🤝 Behavioral & HR Interview Questions
Q12. Tell me about yourself.
Answer using the STAR method – summarize your background, academic projects, interest in Java, and eagerness to grow in CGI’s apprentice role.
Q13. Why do you want to join CGI?
“I want to be part of CGI because it offers great learning opportunities and treats employees as partners. I’m excited about contributing to real-world projects and growing under experienced mentors.”
Q14. How do you handle challenges while coding?
“I break the problem into smaller parts, refer to documentation, collaborate with peers, and research online. Debugging step-by-step and asking for help when needed has worked for me.”
Q15. Are you open to working in shifts or relocating?
“Yes, I’m fully open to rotational shifts and relocation. I understand this is common in IT projects and I’m flexible.”
CGI-Specific & Scenario Questions
Q16. How would you debug a program that suddenly crashes?
-
Check logs, isolate the module causing the issue
-
Reproduce the issue locally
-
Use breakpoints or print statements
-
Check for nulls or array bounds
-
Test edge cases
Q17. What do you know about CGI's values?
CGI values ownership, respect, innovation, and teamwork. They refer to employees as "Partners" and promote career growth through collaboration and global opportunities.
📌 Final Interview Tips for CGI Apprentice Java Role:
| Area | Recommendation |
|---|---|
| Resume | Tailor with keywords from the job description (Java, OOP, SQL, Spring basics) |
| Communication | Speak clearly, be confident, and structure answers (Problem → Approach → Result) |
| Technical Round | Focus on Java OOP, DS basics, SQL, and any projects you've done |
| HR Round | Be honest, show enthusiasm, and express your interest in long-term growth |
| Soft Skills | Emphasize teamwork, learning attitude, and accountability |
