CSD

filter-iconFilter interviews by

CSD Interview Questions and Answers

Updated 27 May 2022

Q1. Swap Kth Elements in an Array

Given an array ARR of size N, perform the operation to swap the Kth element from the beginning with the Kth element from the end of the array.

Example:

Input:
N = 5, K = 2
ARR = [1,...read more
Ans.

Swap Kth elements from the beginning and end of an array.

  • Create a temporary variable to store the Kth element from the beginning

  • Swap the Kth element from the beginning with the Kth element from the end

  • Return the modified array

Q2. Count Derangements

Determine the number of derangements possible for a set of 'N' elements. A derangement is a permutation where no element appears in its original position.

Input:

An integer 'T' representing t...read more
Ans.

Count the number of derangements possible for a set of 'N' elements.

  • Use dynamic programming to calculate the number of derangements for each test case

  • The formula for derangements is D(n) = (n-1)*(D(n-1) + D(n-2)), with base cases D(1) = 0 and D(2) = 1

  • Calculate derangements modulo (10^9 + 7) to avoid overflow issues

Q3. Find the Second Largest Element

Given an array or list of integers 'ARR', identify the second largest element in 'ARR'.

If a second largest element does not exist, return -1.

Example:

Input:
ARR = [2, 4, 5, 6, ...read more
Ans.

Find the second largest element in an array of integers.

  • Iterate through the array to find the largest and second largest elements.

  • Handle cases where all elements are identical by returning -1.

  • Consider edge cases like empty array or array with less than 2 elements.

Q4. What is normalization in the context of database management systems?
Ans.

Normalization in database management systems is the process of organizing data in a database to reduce redundancy and improve data integrity.

  • Normalization involves breaking down a database into smaller, more manageable tables.

  • It helps in reducing data redundancy by storing data in a structured manner.

  • Normalization ensures data integrity by minimizing data anomalies.

  • There are different normal forms such as 1NF, 2NF, 3NF, and BCNF that define the level of normalization.

  • For exam...read more

Are these interview questions helpful?
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

4.0
 • 759 Interviews
4.2
 • 102 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

CSD Interview Questions
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
65 L+

Reviews

4 L+

Interviews

4 Cr+

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