Add office photos
Nagarro logo
Engaged Employer

Nagarro

Verified
4.0
based on 4.1k Reviews
Video summary
Filter interviews by
Associate Engineer
Fresher
Skills
Clear (1)

10+ Nagarro Associate Engineer Interview Questions and Answers

Updated 27 Aug 2024

Q1. Count Ways To Reach The N-th Stair Problem Statement

You are given a number of stairs, N. Starting at the 0th stair, you need to reach the Nth stair. Each time you can either climb one step or two steps. You ha...read more

Ans.

The problem involves finding the number of distinct ways to climb to the Nth stair by taking one or two steps at a time.

  • Use dynamic programming to solve this problem efficiently.

  • The number of ways to reach the Nth stair is the sum of the number of ways to reach the (N-1)th stair and the (N-2)th stair.

  • Handle large inputs by taking modulo 10^9+7 to avoid overflow.

  • Example: For N=3, there are 3 ways to climb to the third stair: (0, 1, 2, 3), (0, 2, 3), and (0, 1, 3).

Add your answer
right arrow

Q2. Trailing Zeros in Factorial Problem

Find the number of trailing zeroes in the factorial of a given number N.

Input:

The first line contains an integer T representing the number of test cases.
Each of the followi...read more
Ans.

Count the number of trailing zeros in the factorial of a given number.

  • To find the number of trailing zeros in N!, count the number of factors of 5 in the prime factorization of N.

  • Each factor of 5 contributes to a trailing zero in the factorial.

  • For example, for N=10, there are 2 factors of 5 in the prime factorization (5 and 10), so there are 2 trailing zeros.

Add your answer
right arrow
Nagarro Associate Engineer Interview Questions and Answers for Freshers
illustration image

Q3. Convert First Letter to Upper Case

Given a string STR, transform the first letter of each word in the string to uppercase.

Example:

Input:
STR = "I am a student of the third year"
Output:
"I Am A Student Of The...read more
Ans.

The function takes a string as input and transforms the first letter of each word to uppercase.

  • Split the input string into individual words using spaces as delimiters.

  • For each word, convert the first letter to uppercase and concatenate the rest of the word.

  • Join the modified words back together with spaces to form the final transformed string.

Add your answer
right arrow

Q4. What is Decorator, what is binary tree, what is difference between tree and binary tree , about hash map

Ans.

Decorator is a design pattern that allows behavior to be added to an individual object, either statically or dynamically.

  • Binary tree is a tree data structure in which each node has at most two children.

  • A tree is a data structure consisting of nodes connected by edges. A binary tree is a specific type of tree with at most two children per node.

  • A hash map is a data structure that maps keys to values for efficient lookup.

Add your answer
right arrow
Discover Nagarro interview dos and don'ts from real experiences

Q5. Quick and merge time complexity and when worst case happens in quick sort

Ans.

Quick sort has O(n log n) time complexity on average, O(n^2) worst case. Merge sort has O(n log n) time complexity always.

  • Quick sort has an average time complexity of O(n log n) due to its divide-and-conquer approach.

  • Worst case for quick sort occurs when the pivot element is either the smallest or largest element in the array, leading to O(n^2) time complexity.

  • Merge sort always has a time complexity of O(n log n) due to its consistent splitting and merging of subarrays.

Add your answer
right arrow

Q6. Remove a linked list node without head or tail pointer given

Ans.

Removing a node from a linked list without head or tail pointer

  • Use the node to be removed's next node to copy its data and then delete the next node

  • Update the current node's next pointer to skip the next node

Add your answer
right arrow
Are these interview questions helpful?

Q7. How to find largest element in array with O(N) complexity

Ans.

Iterate through array once, keeping track of largest element found so far.

  • Initialize a variable to store the largest element found so far

  • Iterate through the array and update the variable if a larger element is found

  • Return the largest element after the iteration is complete

Add your answer
right arrow

Q8. which Programming language will you prefer HashMap and internal working of HashMap String pool loop in a Linked list Oops Concept real type of problem

Ans.

I would prefer Java for its versatility and widespread use in software development.

  • Java is a popular programming language known for its flexibility and scalability.

  • HashMap is a data structure in Java that stores key-value pairs and uses hashing to efficiently retrieve values.

  • String pool in Java is a pool of unique string literals stored in memory to optimize memory usage.

  • Looping through a Linked List involves iterating through each node in the list until reaching the end.

  • Obje...read more

Add your answer
right arrow
Share interview questions and help millions of jobseekers 🌟
man with laptop

Q9. Your favorite programming language and why

Ans.

My favorite programming language is Python because of its simplicity, readability, and versatility.

  • Python is known for its clean and readable syntax, making it easy to learn and understand.

  • Python has a large standard library and many third-party libraries, allowing for rapid development of a wide range of applications.

  • Python is versatile and can be used for web development, data analysis, machine learning, automation, and more.

Add your answer
right arrow

Q10. Discuss space and time complexity of Linked list traversals

Ans.

Space complexity of linked list traversal is O(1) and time complexity is O(n)

  • Space complexity is constant as we only need a few extra pointers to traverse the list

  • Time complexity is linear as we need to visit each node in the list once

  • Example: Traversing a singly linked list from head to tail requires O(n) time complexity

Add your answer
right arrow

Q11. What is multi threading?

Ans.

Multi threading is a programming concept where multiple threads within a process execute independently to improve performance.

  • Allows for concurrent execution of tasks within a single process

  • Improves performance by utilizing multiple CPU cores

  • Requires careful synchronization to avoid race conditions

  • Examples include web servers handling multiple requests simultaneously

Add your answer
right arrow

Q12. Remove nth element from array

Ans.

Remove the nth element from an array of strings

  • Use the splice method to remove the element at the specified index

  • Remember that array indices start at 0

  • Example: array.splice(n, 1) will remove the element at index n

Add your answer
right arrow

Q13. Find loop on linkedin list

Ans.

To find a loop in a linked list, use Floyd's Cycle Detection Algorithm.

  • Use two pointers, slow and fast, to traverse the linked list.

  • If there is a loop, the fast pointer will eventually meet the slow pointer.

  • Example: 1->2->3->4->5->2 (loop back to 2)

Add your answer
right arrow

Q14. Implement Stacks and Queues

Ans.

Implement Stacks and Queues using arrays

  • For implementing a Stack, use an array and keep track of the top element

  • For implementing a Queue, use an array and maintain front and rear pointers

  • Example: Implementing a Stack using an array - push elements onto the top and pop elements from the top

  • Example: Implementing a Queue using an array - enqueue elements at the rear and dequeue elements from the front

Add your answer
right arrow

Q15. Reverse string in java

Ans.

Reverse a string in Java using StringBuilder

  • Create a StringBuilder object with the input string

  • Use the reverse() method of StringBuilder to reverse the string

  • Convert the StringBuilder object back to a string using toString()

Add your answer
right arrow

Q16. 2. Find Kth smallest element.

Ans.

Use quickselect algorithm to find the Kth smallest element in an array.

  • Implement quickselect algorithm to efficiently find the Kth smallest element.

  • Partition the array around a pivot element and recursively search in the appropriate partition.

  • Time complexity of quickselect is O(n) on average, making it efficient for finding Kth smallest element.

Add your answer
right arrow

Q17. Write a program for calculator

Ans.

A simple calculator program that can perform basic arithmetic operations

  • Create functions for addition, subtraction, multiplication, and division

  • Take user input for numbers and operation choice

  • Display the result of the operation

Add your answer
right arrow

Q18. Write a program

Ans.

Program to sort an array of strings in alphabetical order

  • Use a sorting algorithm like bubble sort or quicksort

  • Compare adjacent strings and swap if necessary

  • Repeat until the array is sorted

Add your answer
right arrow

More about working at Nagarro

Back
Awards Leaf
AmbitionBox Logo
#2 Best Large Company - 2022
Awards Leaf
Awards Leaf
AmbitionBox Logo
#1 Best IT/ITES Company - 2022
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 Nagarro Associate Engineer

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

Top Associate Engineer Interview Questions from Similar Companies

Wipro Logo
3.7
 • 10 Interview Questions
Quess Logo
3.9
 • 10 Interview Questions
View all
Recently Viewed
INTERVIEWS
TCS
100 top interview questions
INTERVIEWS
Accenture
10 top interview questions
REVIEWS
Tata Motors
No Reviews
CAMPUS PLACEMENT
Anna University
INTERVIEWS
Wipro
10 top interview questions
LIST OF COMPANIES
Honda Motorcycle & Scooter
Locations
LIST OF COMPANIES
Bajaj Allianz Life Insurance
Locations
REVIEWS
Tata Motors
No Reviews
REVIEWS
Tata Motors
No Reviews
REVIEWS
Tata Motors
No Reviews
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
75 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