Akamai | Software Engineer Principal (Bangalore) | 25-29/sept/23 | Reject
1173
Oct 04, 2023
Round-1 (Coding)
Question-1: Write function for url encoding in c++, space is replace with %20, Input="/ with %2F"
Approach-1
std::string urlEncode(const std::string& input) {
std::string encoded;
for (char c : input) {
if (c == ' ') {
encoded += "%20";
} else if (c == '/') {
encoded += "%2F";
} else {
encoded += c;
}
}
return encoded;
}Interviewer asked: Can we make it better?
std::string urlEncode(const std::string& input) {
std::ostringstream encoded;
for (char c : input) {
if (c == ' ') {
encoded << "%20";
} else if (c == '/') {
encoded << "%2F";
} else {
encoded << c;
}
}
return encoded.str();
}Question-2: write a function to reverse words in a sentence
std::string reverseWordsInSentence(const std::string& sentence) {
// Create a stringstream to tokenize the sentence
std::stringstream ss(sentence);
std::string word;
std::vector<std::string> words;
// Tokenize the sentence into words
while (ss >> word) {
words.push_back(word);
}
// Reverse each word and build the reversed sentence
std::string reversedSentence;
for (auto it = words.rbegin(); it != words.rend(); ++it) {
reversedSentence += *it;
if (std::next(it) != words.rend()) {
reversedSentence += " ";
}
}
return reversedSentence;
}Followup question:
if there are multiple space how to tokenize
Round-2(Design)
1. SSL Client validating SSL Server Certificate & viceversa flow diagram
+-------------------+ +-------------------+
| SSL/TLS Client | | SSL/TLS Server |
+-------------------+ +-------------------+
| |
| |
| Hello (ClientHello) |
|----------------------------->|
| |
| |
| Server Hello (ServerHello) |
|<-----------------------------|
| |
| |
| Server Certificate |
|<---------------------------- |
| |
| |
| Client Certificate |
|----------------------------->|
| |
| Certificate Validation |
| (Verify Server's Cert) |
| (Verify Client's Cert) |
|<---------------------------- |
| |
| |
| Key Exchange |
| (ClientKeyExchange) |
| (ServerKeyExchange) |
|<---------------------------- |
| |
| |
| Finish (Finished) |
|----------------------------->|
| |
| |
| Application Data |
|<---------------------------->|
| |2. how client verifies server certificate and how server verifies client. Do they both get certificate from trusted CA explain in detail?
3. CA signs it does it mean CA calculates hash of server cert encrypts that hash with its pvt key and attaches to certificate it this digital signature?
Yes, that's correct. When a Certificate Authority (CA) signs a digital certificate, it does so by creating a digital signature using its private key.
4. Collector collects users,group,event logs from Active directory and pushes to server. In this solution how server scales?
Caching, load balancing, multipod.
5. There is a licensing server. A license to be deployed on client, How you will design this system? How about license expiry
Comments (1)


