Software Development Engineer Interview Questions

32,839 software development engineer interview questions shared by candidates

Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a special character '#'). For each character they type except '#', you need to return the top 3 historical hot sentences that have prefix the same as the part of sentence already typed. Here are the specific rules:
avatar

Software Development Engineer (SDE)

Interviewed at Twitch

3.7
Mar 11, 2021

Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a special character '#'). For each character they type except '#', you need to return the top 3 historical hot sentences that have prefix the same as the part of sentence already typed. Here are the specific rules:

13. What is the result of executing the code fragment below? // suitable #includes class Text { public: Text(const std::string &text) : data(new char[text.size() + 1000]) { std::copy(text.begin(), text.end(), data); } ~Text() { delete [] data; } void print() const { std::cout << data << std::endl; } private: char *data; }; int main(int, char *[]) { Text outer("hello"); { const Text inner("world"); outer = inner; } outer.print(); return 0; } a. prints "hello" b. prints "world", but there is a buffer overflow in the constructor c. prints "world", no problems anywhere d. none of the above 14. For some class Value, which of the following fragments is the preferred way of writing the declaration of the equality operator? a. extern bool operator==(const Value &lhs, const Value &rhs); b. class Value { public: bool operator==(const Value &other); }; c. class Value { public: bool operator==(const Value *other); }; d. class Value { public: bool operator==(const Value &other) const; }; 15. Consider the following line of code: C c1 = c2; What method is called ? a. Assignment operator b. Copy constructor c. Both d. None of the above 16. Consider the following code: struct A { int i; }; class B { int j; } a. A::i is publicly accessible b. B:i is publicly accessible c. both the above are true d. Neither the above are true
avatar

Software Development Engineer

Interviewed at Amadeus

4
Jul 18, 2013

13. What is the result of executing the code fragment below? // suitable #includes class Text { public: Text(const std::string &text) : data(new char[text.size() + 1000]) { std::copy(text.begin(), text.end(), data); } ~Text() { delete [] data; } void print() const { std::cout << data << std::endl; } private: char *data; }; int main(int, char *[]) { Text outer("hello"); { const Text inner("world"); outer = inner; } outer.print(); return 0; } a. prints "hello" b. prints "world", but there is a buffer overflow in the constructor c. prints "world", no problems anywhere d. none of the above 14. For some class Value, which of the following fragments is the preferred way of writing the declaration of the equality operator? a. extern bool operator==(const Value &lhs, const Value &rhs); b. class Value { public: bool operator==(const Value &other); }; c. class Value { public: bool operator==(const Value *other); }; d. class Value { public: bool operator==(const Value &other) const; }; 15. Consider the following line of code: C c1 = c2; What method is called ? a. Assignment operator b. Copy constructor c. Both d. None of the above 16. Consider the following code: struct A { int i; }; class B { int j; } a. A::i is publicly accessible b. B:i is publicly accessible c. both the above are true d. Neither the above are true

Viewing 1401 - 1410 interview questions

Glassdoor has 32,839 interview questions and reports from Software development engineer interviews. Prepare for your interview. Get hired. Love your job.