AMCAT Automata Fix Sample Questions and Answers

AMCAT Automata Fix Sample Question Paper

On this page, you will find the Sample AMCAT Automata Fix Questions with Solutions.

In the Automata Fix segment of the AMCAT examination, you will be given a code snippet with an error and you will have to find and fix that error, and make sure that the code works.
This is an optional segment for AMCAT examination, candidates who have a background in CS/IT are more likely to opt for this segment.

AMCAT Automata Fix Sample Question Paper

AMCAT Automata Fix Sample Question Paper with Solution

What types of questions are asked in AMCAT Automata Fix Section

AMCAT Automata fix Sample Question Paper  typically involve identifying and correcting syntax errors, logical errors, or other issues in a given code snippet or algorithm. These questions may cover various programming concepts such as loops, conditionals, data types, functions, and algorithms. They may also require understanding and fixing common errors related to variable assignments, array indices, logic conditions, and function arguments, among others.

Detailed Syllabus:

  • Basic programming
  • Control Structures
  • conditional statements
  • Linear data structures
  • Advanced data structures
  • Sorting and searching algorithms

Some common type of questions that are asked in Automata Fix section are -:

  1. Given a code snippet that has a logical error, correct the code to produce the expected output.
  2. Identify and fix the syntax errors in a given code snippet.
  3. Given an algorithm with a logical flaw, correct the algorithm to produce the correct result.
  4. Identify and correct the error in a function that is supposed to sort an array in a specific way.
  5. Given a code snippet with incorrect variable assignments, fix the code to assign the correct values to the variables.

We are not saying that these are the only asked questions, but yes most of the questions come from these concepts only, but the questions are delivered in such a way, that students may find it a bit difficult to fix those codes.

AMCAT Automata Fix detailed Information:

Automata FixAMCAT
Number of Questions7 Questions
Time Limit20 mins
DifficultyModerate – High

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Sample Questions for AMCAT Automata Fix Question Paper

Question : 1

Check for syntax error/ logical error and correct the error to get the desired output.

The function/method add returns the sum of elements of the input matrix. The function/method add accepts three arguments rows, an integer representing the number of rows of the input matrix, columns an integer representing the number of columns of the input matrix a matrix, a two-dimensional array representing the input matrix
The function/method add compiles unsuccessfully due to syntactical error , your task is to debug the program
is to debug the program so that it passes all test case

int add (int rows, int columns, int[][]matrix)
{
  int i, j, sum = 0;
  for (i = 0; i < rows; i++)
    {
      for (j = i; j < columns; j++)
	{
	  sum += matrix (i) (j);

	}
    }
  return sum;
}
int add (int rows, int columns, int[][]matrix)
{
  int i, j, sum = 0;
  for (i = 0; i < rows; i++)
    {
      for (j = 0; j < columns; j++)
	add += matrix[i][j];
    }
  return add;
}

Question : 2

Check for syntax error/ logical error and correct the error to get the desired output.

Find the logical error in the below code.

expected output:

1 1 1 1 1 1

2 2 2 2 2

3 3 3 3

4 4 4

5 5

6

 

void main ()
{
int i, j, n = 6;
for (i = 1; i <= n, i++)
{
for (j = 1; j <= n; j++);
{
printf ("%d" + i);
}
printf ("\n");
}
}
void main ()
{
int i, j, n = 6;
for (i = 1; i <= n; i++)
{
for (j = i; j <= n; j++)
{
printf ("%d", i);
}
printf ("\n");
}
}

Question : 3

Check for syntax error/ logical error and correct the error to get the desired output.

Rahul always forgets his marriage anniversary which is on 8th of february . So develop a function which helps to remember his marriage anniversary.

The method/function returns an integer ‘1’ if it is the anniversary day else return ‘0’.the function/method takes two arguments , a string representing the month and an integer representing the day.

 The function/method Sum compiles unsuccessfully due to syntactical error , your task is to debug the program so that it passes all test case.

int checkDate (char *str, int n)
{
if (strcmp (str, "february") == 0 || n == 8)
{
return 1;
else
return 0;

}
}
int checkDate (char *str, int n)
{
if (strcmp (str, "february") == 0 && n == 8)
{
return 1;
}
else
{
return 0;
}
}

Question : 4

The function/method insertionSort sorting algorithm that works similar to the way you sort playing cards in your hands. The array is virtually split into a sorted and an unsorted part. Values from the unsorted part are picked and placed at the correct position in the sorted part.on the given input list which will be sorted in ascending order.

The function/method insertionSort accepts two arguments-n, an integer representing the length of the input list and arr, a list of integers representing the input list, respectively.

The function/method insertionSort compiles successfully but fails to get the desired result for some test cases due to logical errors. Your task is to fix the code so that it passes all the test cases.

void insertionSort (int arr[], int n)
{
int i, key, j;
for (i = 1; i < n; i++)
{
key = arr[i];
j = i - 1;

while (j >= 0 || arr[j] > key)
{
arr[j + 1] = arr[i];
j = j - 1;
}
arr[j + 1] = key;
}
}
void insertionSort (int arr[], int n)
{
int i, key, j;
for (i = 1; i < n; i++)
{
key = arr[i];
j = i - 1;

while (j >= 0 && arr[j] > key)
{
arr[j + 1] = arr[j];
j = j - 1;
}
arr[j + 1] = key;
}
}

Question : 5

The function/method isPalindrome check whether the integer is palindrome or not.
 The function/method isPalindrome takes integer x as input and returns true if x is a palindrome, and false otherwise.
The function/method isPalindrome compiles successfully but fails to get the desired result for some test cases due to logical errors. Your task is to fix the code so that it passes all the test cases.

bool isPalindrome (int x)
{
  long int y, rev = 0;
  for (int i = x; i > 0; i = i / 10)
    {
      y = i / 10;
      rev = rev * 10 + y;

    }
  if (rev == x)
    {
      return true;

    }
  else
    {
      return false;
    }

}
bool isPalindrome (int x)
{
  long int y, rev = 0;
  for (int i = x; i > 0; i = i / 10)
    {
      y = i % 10;
      rev = rev * 10 + y;

    }
  if (rev == x)
    {
      return true;

    }
  else
    {
      return false;
    }

}

FAQs on AMCAT Automata Fix Questions

Question 1: What type of Questions will be asked in Automata Fix Section of AMCAT Exam?

The Automata section of the AMCAT exam is a programming-based section that tests candidates’ knowledge and skills in programming concepts such as loops, conditionals, arrays, strings, and functions.

Question 2: How does AMCAT Automata Fix work?

AMCAT Automata Fix provides a code editor where candidates can write and test their code. The tool checks the code for errors and provides suggestions for fixing them. Candidates can also run their code on sample test cases provided by the tool to see if their code works correctly.