## Software Developer Interview Questions

- 1of 1 vote

AnswerWrite a program to implement following logic

- D PRAVEEN KUMAR October 04, 2016 in India

An employee can be promoted if

a) He has good communication skills

b) He is good in training

c) He is either good in programming or debugging.| Report Duplicate | Flag | PURGE

HTC Global Services Software Developer C - 0of 0 votes

AnswersFind unique integers from list of integers

`# Question # Write a function that will return an array of integers that occur exactly once in a given array of integers. # e.g. For a list [1,2,3,5,2,2,3,4], return [1,5,4] since they appear once (order does not matter). def once_integers(integers):`

Follow up:

Optimize the code if input is sorted.

- Saurabh October 03, 2016 in United States for Software Developement - Tools`# What if the input is sorted, such as [1,2,2,2,3,3,4,5], could the algorithm be further optimized # (e.g. space complexity)? def once_integers_sorted(integers):`

| Report Duplicate | Flag | PURGE

Linkedin Software Developer - 0of 0 votes

AnswersString Rotation. Given two string check if String1 is rotating match for String2

- Saurabh October 03, 2016 in United States for Software Developement - Tools`# Given two strings. Write a function that will return true if one string is a rotation of the other string. # e.g. 'bca' and 'cab' are rotations of 'abc' and the function should return true # 'barbazfoo', 'oobarbazf' and 'rbazfooba' are rotations of 'foobarbaz' def is_rotation(string1, string2):`

| Report Duplicate | Flag | PURGE

Linkedin Software Developer Algorithm - 0of 0 votes

AnswersYou are given a matrix of size n*m and need to count the number of submatrices which which have atleast k occurances of x and atleast two corner elements equal. Submatrices should have minimum two rows and two columns.

- sukhmeet032795 October 01, 2016 in United States

Example:

1 2 3

1 3 6

22 1 33

output: 4

i.e

a)

1 2

1 3

b)

1 2 3

1 3 6

c)

1 2

1 3

22 1

d)

1 3

22 1| Report Duplicate | Flag | PURGE

Sabre Holdings Software Developer Algorithm - 0of 0 votes

AnswersConsider a string A containing exactly X characters. A variant of A, A(k), can be obtained by doing a cyclic shift of A starting from position k (0 <= k < X). The number of characters after the shift in A(k) will remain the same as they were in A. Every j-th character (0 <= j <= X-1) of A(k) is equal to (k+j)%X character of A. We will call A a classic word if there are exactly M positions k such that A(k) = A

- Abhishek.Mathur.CA September 30, 2016 in United States

You are given array Q containing exactly R strings. For each permutation s = (s[0], s[1], ..., s[R-1]) of integers between 0 and R-1, inclusive, we can define a string generated by this permutation as a concatenation Q[s[0]] + Q[s[1]] + ... + Q[s[R-1]]. Find the number of permutations that generate classic words. All indices in this problem are 0-based

Constraints

Set Q will contain between 1 and 8 elements, inclusive. Each element will have 1 to 20 characters, inclusive

M will be between 1 and 200, inclusive

Input Format

Line 1: comma separated strings representing set Q

Line 2: Integer M

Output Format

Number of permutations that generate classic words

Sample Input

CD,QCCD,QC

2

Sample Output

3

Explanation

The classic words are "CDQCCDQC" and "QCCDQCCD". Permutation 0, 1, 2 generates the first, and 1, 2, 0 and 2, 0, 1 generate the second| Report Duplicate | Flag | PURGE

unknown Software Developer - 0of 0 votes

AnswersYour friend has invented a new compound consisting of N elements. However, he has forgotten the amount of each element that goes into the recipe.

- Abhishek.Mathur.CA September 30, 2016 in United States

For N-1 pairs of elements, he remembers the proportion in which the elements within each pair should be added to the compound. Fortunately, these N-1 proportions are sufficient to restore the recipe of the entire compound.

You are given N-1 proportions as String. Each String is formatted "#<a> and #<b> as <p>:<q>" (quotes for clarity), which means that the mass of element <a> divided by the mass of element <b> in the cocktail must be equal to <p>/<q> (all elements are 0-indexed). Print exactly N elements, where the first line is the mass of element 0 and second line is the mass of element 1 and so on... such that all the given proportions are satisfied and the total mass is as small as possible. The total mass must be greater than 0.

Input

Line 1: N

Line 2 .. N: proportion_i

Output

N lines of masses, as stated in the problem statement

Input Explanation

Line 1: N, the number of elements

Line 2 to line N: N-1 proportions, format described in the problem statement

Output Explanation

Output will contain exactly N lines, each line is the mass of the element such that all the given proportions are satisfied and the total mass is as small as possible. The total mass must be greater than 0.

Sample Input

3

#0 and #1 as 9:8

#1 and #2 as 9:8

Sample Output

81

72

64| Report Duplicate | Flag | PURGE

unknown Software Developer - 0of 0 votes

AnswersConsider a social website SocialX, where friends connect to each other, just as they do on Facebook

- Abhishek.Mathur.CA September 30, 2016 in United States

Friendship on SocialX is symmetric (if X is a friend of Z, then Z is also a friend of X) however not transient (if X and Z are friends and Z and Y are friends, then X and Y are not necessarily friends)

The term "k-joined" is defined as follows. If two people are friends, they are called 1-joined. For k >= 1, two people X and Z are called (k+1)-joined if X and Z are k-joined, or if there exists a person Y such that X and Y are k-joined and Y and Z are friends.

"Approachable Score" is defined as follows. If two people X and Z are not friends, then their Approachable Score is the fewest number of people (other than themselves) who must be removed from the network in order for X and Z to not be 3-joined. The higher the Approachable Score, the more likely it is that X and Z know each other.

Given a set of friends containing exactly K elements, where K is the number of people in the network. People are numbered from 0 to K-1. The j-th character of the i-th element of friends is '1' if i and j are friends, and '0' otherwise. Return the Approachable Score for personX and personZ

Constraints

Set of friends will contain exactly K (1 < K < 41) elements, where each element will contain exactly K characters. Each character will either be '0' or '1'

friends[i][j] will always be equal to friends[j][i] and friends[i][i] will always be equal to 0

friend[personX][personZ] will be equal to 0 and personX will never be equal to personZ

Input Format

Line 1: comma separated K elements representing friends

Line 2: Integer representing personX

Line 3: Integer representing personZ

Output Format

Integer representing Approachable Score

Sample Input

0100,1010,0101,0010

0

3

Sample Output

1

Explanation

Either remove person 1 or person 2 to get an Approachable Score of 1 for person 0 and 3| Report Duplicate | Flag | PURGE

unknown Software Developer - 0of 0 votes

AnswerAn instruction pipeline has the speedup factor 10 while operation with 80% efficiency. What could be the number of stages in the pipeline?

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Computer Architecture & Low Level - 0of 0 votes

AnswerConsider a four stage pipeline with the respective delays t1=60nSeconds, t2=70nSeconds, t3=100nSeconds, t4=80nSeconds and the latch delay of 10nSeconds. What is the approximate speedup when the very large number of instructions on pipeline?

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Computer Architecture & Low Level - 0of 0 votes

AnswersSuppose that a system taken 90% of the computation can be parallelized, What is the maximum speedup we can except from 8 processors according to the Amdahl’s law?

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Computer Architecture & Low Level - 0of 0 votes

AnswersWrite a C program to convert date from 24 hrs format to 12 hrd format? Ex: 23:10 = 11:10PM

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer C - 0of 0 votes

AnswersGiven a sorted (increasing order) array, write a program to create a binary tree with minimal height

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Data Structures - 0of 0 votes

AnswersWrite C program such that if an element in an MxN matrix is 0, its entire row and column is set to 0.

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer C - 0of 0 votes

AnswerConsider a system with three processes and four resources. Resource R1 and R3 with one instance, R2 with two instance, process P1 holding an instance of R2 and waiting for r1,process P2 is holding an instance of R1 and R2 and waiting for R3,process P3 is holding an instance of R3. Is it possible to apply the Resource allocation graph algorithm to avoid deadlock? Explain.

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Operating System - 0of 0 votes

AnswersConsider a disk drive with the specifications of 16 platters, 2 surfaces, 512 tracks, 2K sectors and 4KB page or sector size. What is the capacity of the disk drive in terms of bytes?

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Operating System - 0of 0 votes

AnswerConsider a system where counting semaphore initialized to +17, on this semaphore variable the various operations like 23P, 18V, 16P, 14V and 1P are performed. Then what is the final value of semaphore?

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Operating System - 0of 0 votes

AnswersLet the average process size be s bytes and the page size be p bytes. Furthermore, assume that each page entry requires e bytes. Derive the optimal page size.

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Operating System - 0of 0 votes

AnswersProcess ID Arrival Time Burst

- D PRAVEEN KUMAR September 26, 2016 in India

P1 arrived at 0 and need10 units burst time, P2 is arrived at 1 and need 8 units of burst time, process P3 is arrived at 2 and need 6 units of burst time and process P4 arrived at 3 and need 4 units of burst time.

Assume that context switch takes one unit of time. Draw that gant chart and find the average waiting time, turnaround time using SJF scheduling.| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Operating System - 0of 0 votes

AnswersFive jobs are waiting to be run. Their expected run times are 9, 6, 3, 5, and X . In what order should they be run to minimize average response time?

- D PRAVEEN KUMAR September 26, 2016 in India| Report Duplicate | Flag | PURGE

Skill Subsist Impulse Ltd Software Developer Operating System - 0of 0 votes

AnswersProblem statement: You are given a maze with N cells. Each cell may have multiple entry points but not more than one exit (ie. entry/exit points are unidirectional doors like valves). The cells are named with an integer value from 0 to N-1. You need to find the following :

- sarthakbansal19 September 23, 2016 in India

Nearest meeting cell: Given any two cells - C1,C2, find the closest cell Cm that can be reached from both C1 and C2.

Note: Aim for O(Log(N)) solution.

INPUT FORMAT - First line has the number of cells N

Second line has list of N values of the edge[] array. edge[i] contains the cell number that can be reached from of cell ‘i’ in one step. edge[i] is -1 if the ‘i’th cell doesn’t have an exit.

Third line contains two cell numbers whose nearest meeting cell needs to be found. (return -1 if there is no meeting cell from the two given cells) .

OUTPUT FORMAT - Find nearest meeting cell (NMC).| Report Duplicate | Flag | PURGE

Juspay Software Developer Data Structures - 0of 0 votes

AnswersProblem statement: You are given a maze with N cells. Each cell may have multiple entry points but not more than one exit (ie. entry/exit points are unidirectional doors like valves). The cells are named with an integer value from 0 to N-1. You need to find the following :

- sarthakbansal19 September 23, 2016 in India

find Maximum number of entry points (incoming edges) for any cell in the maze

Note: Aim for O(N) solution.

INPUT FORMAT - First line has the number of cells N

Second line has list of N values of the edge[] array. edge[i] contains the cell number that can be reached from of cell ‘i’ in one step. edge[i] is -1 if the ‘i’th cell doesn’t have an exit.

OUTPUT FORMAT - Find max entry points in any cell.| Report Duplicate | Flag | PURGE

Juspay Software Developer Data Structures - 0of 0 votes

AnswersProblem statement: You are given a maze with N cells. Each cell may have multiple entry points but not more than one exit (ie. entry/exit points are unidirectional doors like valves). The cells are named with an integer value from 0 to N-1. You need to find the following :

- sarthakbansal19 September 23, 2016 in India

The length of the largest cycle in the maze. Return -1 if there are no cycles.

Note: Aim for O(N) solution.

INPUT FORMAT - First line has the number of cells N

Second line has list of N values of the edge[] array. edge[i] contains the cell number that can be reached from of cell ‘i’ in one step. edge[i] is -1 if the ‘i’th cell doesn’t have an exit.

OUTPUT FORMAT - length of the largest cycle.| Report Duplicate | Flag | PURGE

Juspay Software Developer Data Structures - 0of 0 votes

AnswersSuppose there is a social networking site like Facebook. Every user gets some friend recommendations (i.e. People you may know!). Now, if there is a user A and he has 100 friends and each of his friends has got 5 other friends,A can get these 500 recommendations. But the condition is that he should only get the top 10 recommendations with whom he has the maximum number of mutual friends(If A and B are friends and B and C are friends, then A and C have a mutual friend, B). Suggest an efficient data structure for this and how to implement it. The implementation should be flexible as at any moment, any user can make new friends and he may also unfriend someone!

- manidam07 September 19, 2016 in India| Report Duplicate | Flag | PURGE

Amazon Software Developer Algorithm - 0of 2 votes

Answershttp://www.geeksforgeeks.org/find-water-in-a-glass/

- vgupta.2119 September 18, 2016 in India| Report Duplicate | Flag | PURGE

Google Software Developer - 2of 4 votes

AnswersFind the minimum of every sub-array of size k in an array of size n.

- vgupta.2119 September 18, 2016 in India

O(n) solution required.| Report Duplicate | Flag | PURGE

Google Software Developer - -1of 1 vote

Answershttp://www.geeksforgeeks.org/find-water-in-a-glass/

- vgupta.2119 September 18, 2016 in India| Report Duplicate | Flag | PURGE

Google Software Developer - 1of 3 votes

AnswersFind the minimum of every sub-array of size k in an array of size n.

- vgupta.2119 September 18, 2016 in India

O(n) solution required.| Report Duplicate | Flag | PURGE

Google Software Developer - -1of 1 vote

AnswersSearching for a string in a DOM tree. A complete working solution was required. Assume you have any string matching algorithm available.

- vgupta.2119 September 18, 2016 in India

(Based on Ctrl+F search in chrome)| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - -1of 1 vote

AnswersSearching for a string in a DOM tree. A complete working solution was required. Assume you have any string matching algorithm available.

- vgupta.2119 September 18, 2016 in India

(Based on Ctrl+F search in chrome)| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm - 1of 1 vote

AnswersGiven a directed graph G, duplicate the graph using minimum space.

- vgupta.2119 September 18, 2016 in India| Report Duplicate | Flag | PURGE

Google Software Developer Algorithm

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window