Sr Developer Interview Questions

30,108 sr developer interview questions shared by candidates

You are given an array of words (strings) and an integer k k k. Your task is to write a function that returns the k k k longest words from the array. If there are fewer than k k k words in the array, return all the words sorted by length in descending order. If there are ties in length, return the words in alphabetical order. Input: An array of strings words[] where each string consists of lowercase and uppercase letters only. An integer k k k (1 ≤ k k k ≤ 100). Output: An array of the k k k longest words, sorted by length (and alphabetically if lengths are equal). Example: plaintextInput: words = ["apple", "banana", "kiwi", "grape", "watermelon"], k = 3 Output: ["watermelon", "banana", "apple"] Input: words = ["cat", "bat", "rat"], k = 5 Output: ["bat", "cat", "rat"] Constraints: The output array should not exceed k k k elements. You may assume that the input will always have at least one word.
avatar

Senior Java Developer

Interviewed at Apple

4.1
Apr 18, 2025

You are given an array of words (strings) and an integer k k k. Your task is to write a function that returns the k k k longest words from the array. If there are fewer than k k k words in the array, return all the words sorted by length in descending order. If there are ties in length, return the words in alphabetical order. Input: An array of strings words[] where each string consists of lowercase and uppercase letters only. An integer k k k (1 ≤ k k k ≤ 100). Output: An array of the k k k longest words, sorted by length (and alphabetically if lengths are equal). Example: plaintextInput: words = ["apple", "banana", "kiwi", "grape", "watermelon"], k = 3 Output: ["watermelon", "banana", "apple"] Input: words = ["cat", "bat", "rat"], k = 5 Output: ["bat", "cat", "rat"] Constraints: The output array should not exceed k k k elements. You may assume that the input will always have at least one word.

4 tasks in Codility. The first one was about C++ basics like dynamic_cast etc, 4-choice Second one classic parsing exercise in C++ using string, maps, arrays, however very badly specified so that correct solution was simply not feasible in given time, unless you neglect most possible inputs and "go straight to dumbest implementation" that might or might not pass Codility scoring test. Third question is about dynamic programming, in-depth search of cheapest route. Fourth was numerical exercise, relative calculation on angles maybe easy but certainly might be tricky.
avatar

C++ Senior Software Developer

Interviewed at TomTom

3.8
Aug 19, 2021

4 tasks in Codility. The first one was about C++ basics like dynamic_cast etc, 4-choice Second one classic parsing exercise in C++ using string, maps, arrays, however very badly specified so that correct solution was simply not feasible in given time, unless you neglect most possible inputs and "go straight to dumbest implementation" that might or might not pass Codility scoring test. Third question is about dynamic programming, in-depth search of cheapest route. Fourth was numerical exercise, relative calculation on angles maybe easy but certainly might be tricky.

Question on projects and experience. Question very specific to language syntax and libraries? (I don't know what is the use?) Question on LRU cache? Question on how to design ; 1) on designing a dashboard for live traffic and other on scalable storage.
avatar

Senior Software Developer

Interviewed at Netskope

4.2
Jul 27, 2019

Question on projects and experience. Question very specific to language syntax and libraries? (I don't know what is the use?) Question on LRU cache? Question on how to design ; 1) on designing a dashboard for live traffic and other on scalable storage.

Q4. Based on my answer to the question above, he mentioned this code? - He said, that you are saying javascript is async. then what will be the output of this code console.log("a") Promise. execution() console.log("b") Will it wait to resolve promise or it will execute parallely ?
avatar

Senior Frontend Developer

Interviewed at GlobalLogic

3.8
Sep 27, 2022

Q4. Based on my answer to the question above, he mentioned this code? - He said, that you are saying javascript is async. then what will be the output of this code console.log("a") Promise. execution() console.log("b") Will it wait to resolve promise or it will execute parallely ?

Viewing 2331 - 2340 interview questions

Glassdoor has 30,108 interview questions and reports from Sr developer interviews. Prepare for your interview. Get hired. Love your job.