Add office photos
Engaged Employer

Nagarro

4.0
based on 4k Reviews
Filter interviews by

10+ Diyan Corporation Interview Questions and Answers

Updated 27 Aug 2024
Popular Designations

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

Add your answer

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
Add your answer

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
Add your answer

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
Discover Diyan Corporation 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

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
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

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
Share interview questions and help millions of jobseekers 🌟

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

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

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

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

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

Q14. 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

Q15. 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

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

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

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

More about working at Nagarro

#2 Best Large Company - 2022
#1 Best IT/ITES Company - 2022
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Diyan Corporation

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 & Stories
Ace your next interview with expert advice and inspiring stories

Top Associate Engineer Interview Questions from Similar Companies

3.8
 • 27 Interview Questions
3.7
 • 22 Interview Questions
3.8
 • 20 Interview Questions
4.0
 • 11 Interview Questions
3.7
 • 10 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
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