The AMCAT Automata Test is designed to assess your programming skills beyond basic code correctness. It evaluates your understanding of key concepts like algorithms, data structures, recursion, dynamic memory allocation, and modular programming. A good performance in this test can greatly enhance your chances during the recruitment process, as many leading IT companies consider the Automata Test a benchmark for evaluating candidates’ coding proficiency. In this guide, we’ll explore some common AMCAT Automata questions, share solutions, and offer tips to help you prepare.
The AMCAT Automata Test typically consists of two programming questions:
a = 5, b = 10, c = 3
10
if-else
).n = 1234
10
(1+2+3+4)n = 15
Odd
%
)."hello"
"olleh"
n = 5
120
(5! = 5 × 4 × 3 × 2 × 1)n-1
numbers from 1 to n
with one number missing, find the missing number.[1, 2, 4, 5, 6]
3
"abcabcbb"
3
("abc"
)n
, find the element that appears more than n/2
times.[3, 3, 4, 2, 3, 3, 3, 1]
3
arr1 = [1, 4, 7, 8]
, arr2 = [2, 3, 5, 6]
[1, 2, 3, 4, 5, 6, 7, 8]
k
-th smallest element.arr = [7, 10, 4, 3, 20, 15]
, k = 3
7
Candidates can write the program in any programming language, as the Automata 2.0 software supports multiple languages. The test evaluates:
The code is evaluated based on its performance on basic, advanced, and boundary test cases.
Problem Statement: Given two arrays, print all the distinct elements from both arrays and the total count of distinct elements.
Input:
Arr1 = {1, 2, 3, 4, 5}
Arr2 = {2, 6, 8, 10}
Approach: This can be solved by checking for distinct elements in both arrays and printing them.
C Code Solution:
#include<stdio.h>
int Not_common(int *arr1, int *arr2, int l1, int l2) {
int count = 0, flag1, i, j;
for(i = 0; i < l1; i++) {
flag1 = 0;
for(j = 0; j < l2; j++) {
if(arr1[i] == arr2[j]) {
flag1 = 1; break;
}
}
if(flag1 == 0) {
count++;
printf("%d, ", arr1[i]);
}
}
for(i = 0; i < l2; i++) {
flag1 = 0;
for(j = 0; j < l1; j++) {
if(arr2[i] == arr1[j]) {
flag1 = 1; break;
}
}
if(flag1 == 0) {
count++;
printf("%d, ", arr2[i]);
}
}
return count;
}
int main() {
int len1 = 5, len2 = 4, result, i;
int arr1[] = {1, 2, 3, 4, 5}, arr2[] = {2, 6, 8, 10};
result = Not_common(arr1, arr2, len1, len2);
printf("\nTotal distinct elements: %d\n", result);
return 0;
}
Output:
1, 3, 4, 5, 6, 8, 10,
Total distinct elements: 7
Problem Statement: Remove all vowels from the given string using pointers in C.
Input:
FOCUS ACADEMY
Approach: This can be achieved by traversing the string with pointers and removing vowels.
C Code Solution with Pointers:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TRUE 1
#define FALSE 0
int check_vowel(char);
int main() {
char string[100], *temp, *pointer, ch, *start;
gets(string); // Input the string
temp = string;
pointer = (char*)malloc(100);
if (pointer == NULL) {
exit(EXIT_FAILURE);
}
start = pointer;
while (*temp) {
ch = *temp;
if (!check_vowel(ch)) {
*pointer = ch;
pointer++;
}
temp++;
}
*pointer = '\0'; // End the modified string
pointer = start;
strcpy(string, pointer); // Copy back the modified string
free(pointer);
printf("Modified string: %s\n", string);
return 0;
}
int check_vowel(char a) {
if (a >= 'A' && a <= 'Z') {
a = a + 'a' - 'A'; // Convert to lowercase if uppercase
}
if (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u') {
return TRUE;
}
return FALSE;
}
Output:
Modified string: FCS CDMY
To excel in the AMCAT Automata Test, follow these strategies:
The AMCAT Automata Test is a crucial part of the recruitment process for IT companies, assessing your coding skills and ability to solve real-world problems. By practicing coding problems, understanding core concepts, and following efficient problem-solving approaches, you can significantly improve your chances of acing the test.