Amazon Interview Questions

Amazon Interview Questions

Amazon is world's largest online retailer and cloud computing services, provider. Read Best interview questions and answers on Amazon. Following are the list of some Amazon's frequently asked questions for candidates who were preparing for amazon job interview.

Download Amazon Interview Questions PDF

Below are the list of Best Amazon Interview Questions and Answers

There is a number of ways to reverse a string in programming. Here we going to see how to reverse a string in C language.

Note: Below programs are written in C language. It takes a string as input from users and reverses it.

For example: if a user inputs hello then it outputs olleh

Different ways to reverse a string

Basic method to find a pair whose sum matches with given sum:

C program:

#include <iostream>
#include <algorithm>
 // Function to find a pair  using Sorting in an array with given sum
void findPair(int arr[], int n, int sum){
     std::sort(arr, arr + n);   // sort the array in ascending order
    int i = 0;
    int j = n - 1;
     while (i < j) {   // loop till i is less than j
        if (arr[i] + arr[j] == sum){  // sum found
       std::cout << "Pair found"<<”\n”<< arr[i]<<arr[j];
       return;}
       // decrement j if total is more than the sum
         // increment i  if total is less than the sum
      (arr[i] + arr[j] < sum)? i++: j--;}
    // No pair exists in an array with the desired sum
    std::cout << "Pair not found";}
// Main function from which find pair function is called
int main()
{ int arr[] = { 8, 7, 2, 5, 3, 1};
 int sum = 10;
 int n = sizeof(arr)/sizeof(arr[0]);
 findPair(arr, n, sum);
return 0;} 

Anagram strings are those strings which have same letters but in different orders. Method to check: First, sort the strings and then compare the sorted strings. If strings are equal then they are anagram strings otherwise not.

Program:

#include <stdio.h>
#include <string.h>
int main () { 
  char str1[] = "listen";   
char str2[] = "silent";
char temp;  
 int i, j;  
 int n1  = strlen(str1);  
 int n2 = strlen(str2);  
 //strings are not anagrams if they are of different length
  if( n1 != n2) {    
printf("%s and %s are not anagrams! \n", str1, str2);   
return 0; } 
for(i=0; i<n1-1; i++) {  // first sort both strings 
for (j = i+1; j < n1; j++) {     
if (str1[i] > str1[j]) {            
temp= str1[i];           
str1[i] = str1[j];       
str1[j] = temp;         }       
if (str2[i] > str2[j]) {  
temp  = str2[i];        
str2[i] = str2[j];           
str2[j] = temp;         }
}   }  
for(i = 0; i<n1; i++) {  // Compare character by character both strings
if(str1[i] != str2[i]) {         
printf("Strings are not anagrams \n", str1, str2);         
return 0;      
}}   
printf("Strings are anagrams! \n");   return 0;}

Memoization is the feature of AWS which occurs due to the huge amount of unnecessary requests which in result increases the time of execution. Due to a large number of requests for the same data your account can also get throttled, it also prevents your code from any irrelevant future changes. At present only EC2 APIs are supporting the Memoization. After the activation of the Memoization feature each response made to data will be stored in memory. In case of coached response Memoization response differently. SDK checks for every response before any request with the same credentials. If you disable the Memoization then it will discard all cached responses.

Amazon Lightsail, Amazon service provisions virtual servers that operate in the cloud and complements Amazon EC2 (Amazon Elastic Compute Cloud) for warehouse. Lightsail encompasses everything you require to launch a project; a virtual machine, SSD-based storage, data transfering, DNS management, and a static IP for a low, expected price. There are dozens of different Amazon services, many of them member of Amazon Web Services (or AWS). However, Lightsail is the service that companies rely on for operating applications without the issue of running your servers in a data center.

Amazon CloudWatch Events produces a real-time stream of system events that report changes in Amazon Web Services (AWS) resources, using predefined rules, where you can even events and route them more than single target functions or streams. CloudWatch Events matures conscious of operational changes as they occur and take remedial action by transmitting messages to reply to the environment and capturing status data.

An Amazon EBS volume is a permanent, block-level storage device that is attachable to more than one instance and can be used as central storage for data that demands frequent updates, as the system drive for an instance or area for a database application. Moreover, you can use them for throughput-intensive applications that deliver continuous disk scans and persist autonomously from the operating life of an EC2 instance.

Amazon Elastic MapReduce (EMR) is a web service that renders a managed structure to administer processing frameworks such as Apache Hadoop, Spark, and Presto in an effortless, cost-effective, and secure manner and is used for data analysis, website indexing, data warehousing, financial analysis, scientific simulation and a lot more.