Software Applications Engineer Interview Questions | Glassdoor

Software Applications Engineer Interview Questions

95

Software applications engineer interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

Given a single-line text string and a maximum width value, write the function 'string justify(string text, int maxWidth)' that formats the input text using full-justification, i.e., extra spaces on each line are equally distributed between the words; the first word on each line is flushed left and the last word on each line is flushed right.

3 Answers

Be sure to handle case where the input text is shorter than a single line.

public void justify(String input, int lineLength) { String inputNoSpace = input.replace(" ", ""); int actualLength = inputNoSpace.length(); StringTokenizer stk = new StringTokenizer(input); int tknCount = stk.countTokens(); int emptySpace = lineLength - actualLength; if (emptySpace > tknCount) { int space = emptySpace / (tknCount - 1); System.out.println(tknCount); while (stk.hasMoreElements()) { System.out.print(stk.nextElement()); if (emptySpace / (tknCount - 1) > 0) { for (int i = 0; i < space; i++) { System.out.print(" "); emptySpace--; } } if (emptySpace / (tknCount - 1) == 0) { int remainingSpace=emptySpace; for (int j = 0; j < remainingSpace; j++) { System.out.print(" "); emptySpace--; } } } } }

import java.util.StringTokenizer; public class JustifyText { public static String justify(String s, int len) { if(s.length() == len) return s; if(s.length() > len) { System.out.println("length of string is greater than line-justify length"); return s; } int count = 0; StringTokenizer st = new StringTokenizer(s," "); count = st.countTokens() - 1; int totalSpacing = len - s.length() + count; int individualSpacing = totalSpacing/count; int padding = totalSpacing % count; StringBuilder sb = new StringBuilder(); while(st.hasMoreTokens()) { sb.append(st.nextToken()); if(st.hasMoreTokens()) { for(int i = 0; i 0) { sb.append(" "); --padding; } } return sb.toString(); } public static void main(String[] args) { // TODO Auto-generated method stub String test = "Hello this is a test string"; System.out.println(justify(test,40)); System.out.println(justify(test,32)); } }

How would you design an enhancement to the LinkedIn homepage that displays 24-hour trailing lists (5-minute, 1-hour, 1-day) of the top 5 URLs that users post onto the site?

1 Answer

all network concepts , C concepts , Python , resume walk through etc

1 Answer

They want me to design a scalable prototype of basic information retrieval system.

2 Answers

What is CSS specificity?

2 Answers

"Can you do what we are asking?"

1 Answer

What are the main hardware components of a computer?

1 Answer

Describe the difference between EJB 2.1 and EJB 3.0?

1 Answer

The first question was what data structures are used in Java. Then it's about whiteboard coding. I was asked to write a class to describe properties of a car. Some kind of sorting was asked, I didn't get it. Then several stuff about Android: like how to save user's settings; how to use the LocationManager... They expect whiteboard coding, I was only able to tell which API I usually call.

1 Answer

What are your salary / benifits requirements?

1 Answer
110 of 95 Interview Questions