AMCAT Coding Questions and Answers

AMCAT Coding Questions with Solutions

In this page, you will find out AMCAT Coding Questions and Answers asked in Online Assessments and Technical Assessments of the AMCAT Exam conducted for Hiring in Several Companies. Generally, AMCAT asks only Aptitude Questions but for Technical Job Profiles in AMCAT Parterned Company, they ask Coding Questions also.

Go through this page to get all Sample AMCAT Coding Questions included in AMCAT Online Technical Assessment.

amcat-coding-questions

About AMCAT Employability Test

Some of the main features of AMCAT Exam are as follows:
  1. AMCAT is a computer adaptive test measuring job applicants in various areas: Communication, Logical reasoning, Quantitative skills, and Domain expertise.
  2. Unlike typical aptitude tests, AMCAT evaluates personality traits and domain-specific skills, enhancing job-candidate alignment.
  3. After the test, AMCAT suggests suitable jobs based on performance, and its Feedback report and Score Card highlight strengths and areas for improvement.
  4. AMCAT is becoming an interesting opportunity for getting entry-level roles in 700+ companies.
  5. Partnerships with industry leaders like Accenture, NTT Data, Mphasis, Cognizant, Wipro, Deloitte, ITC, JusPay, etc., across IT, Banking, Automobiles, and Telecom.
  6. At last, AMCAT is a Recruitment Exam that is the Best way to get multiple job opportunities in multiple companies by giving only its one Online Exam.

Steps involved in Hiring Through AMCAT

  1. Online Aptitude + Coding Test
  2. Performance Evaluation
  3. Technical & HR Interview

Prime Course Trailer

Related Banners

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

AMCAT Coding Questions With Solutions

Question 1: Fountain Installation

Fountains are installed at every position along a one-dimensional garden of length n. Array locations[] represents the coverage limit of these fountains. The ith fountain (where 1sisn) has a coverage limit of locations[i] that can range from the position max((i – locations[i]), 1) to min((i + locations[i]), n ). In other words, the h fountains do not reach outside the boundaries of the garden. In the beginning,all the fountains are switched off. Determine the minimum number of fountains that need to be activated to cover the n length garden by water.

Example

  • n = 3
  • locations[] = {0, 2, 13, then
    • For position 1: locations[1] = 0, max((1 – 0),
      • 1) to mini (1+0), 3) gives range = 1 to 1
    • For position 2: locations[2] = 2, max((2-2),
      • 1) to min( (2+2), 3) gives range = 1 to 3
    • For position 3: locations[3] = 1, max( (3-1),
      • 1) to min( (3+1), 3) gives range = 2 to 3

For the entire length of this garden to be covered, only the fountain at position 2 needs to be activated.

Function Description

Complete the function fountainActivation in the editor below.

fountainActivation has the following Parameter:

  • int locations[n]: the fountain locations

Returns

  • int: the minimum number of fountains that must be activated

Constraints

  • 1<_n<_ 10^5
  •  O<_locations[i] <_ mini (n,100) (where 1 <_1<_10^5)

► Input Format For Custom Testing

Sample Case 0

Sample Input For Custom Testing

  • 3 ->locations[] size n = 3
  • 1 ->locations[] [1, 1, 1
  • 1 ->Sample Output

Sample Output

  • 1

Explanation

Here, locations = {1, 1, 13

  • For position 1: locations[1] = 1, maxi (1 -1), 1) to min((1+1), 3) gives range = 1 to 2
  • For position 2: locations[2] = 1, max( (2 -1), 1) to min( (2+1), 3) gives range = 1 to 3
  • For position 3: locations[3] = 1, max((3 -1), 1) to min((3+1), 3) gyes range = 2 to 3

If the 2nd fountain is active, the range from position 7 to 3 will be covered. The total number of fountains needed is 1.

Question 2 : Collecting Candies

Problem Description

Question:- Krishna loves candies a lot, so whenever he gets them, he stores them so that he can eat them later whenever he wants to.

He has recently received  N boxes of candies each containing Ci candies where Ci represents the total number of candies in the ith box. Krishna wants to store them in a single box. The only constraint is that he can choose any two boxes and store their joint contents in an empty box only. Assume that there are an infinite number of empty boxes available.

At a time he can pick up any two boxes for transferring and if both the boxes contain X and Y number of candies respectively, then it takes him exactly X+Y seconds of time. As he is too eager to collect all of them he has approached you to tell him the minimum time in which all the candies can be collected.

Input Format:

  • The first line of input is the number of test case T
  • Each test case is comprised of two inputs
  • The first input of a test case is the number of boxes N
  • The second input is N integers delimited by whitespace denoting the number of candies in each box

Output Format: Print minimum time required, in seconds, for each of the test cases. Print each output on a new line.

Constraints:

  • 1 < T < 10
  • 1 < N< 10000
  • 1 < [Candies in each box] < 100009
S. No.InputOutput
11
4
1 2 3 4
19
21
5
1 2 3 4 5
34

Explanation for sample input-output 1:

4 boxes, each containing 1, 2, 3 and 4 candies respectively.Adding 1 + 2 in a new box takes 3 seconds.Adding 3 + 3 in a new box takes 6 seconds.Adding 4 + 6 in a new box takes 10 seconds.Hence total time taken is 19 seconds. There could be other combinations also, but overall time does not go below 19 seconds.

Explanation for sample input-output 2:

5 boxes, each containing 1, 2, 3, 4 and 5 candies respectively.Adding 1 + 2 in a new box takes 3 seconds.Adding 3 + 3 in a new box takes 6 seconds.Adding 4 + 6 in a new box takes 10 seconds.Adding 5 + 10 in a new box takes 15 seconds.Hence total time taken is 34 seconds. There could be other combinations also, but overall time does not go below 33 seconds.

Question 3: Class Monitor

Problem Statement :

After JEE Mains, some students got admission into an engineering college. Now there is a class consisting of such n students, and the HOD came to say it is time to select the class monitor. But He never gets all of them at one time. So he brought a register, every time he gets someone with less rank than the previous time he cut the name and wrote the name of the student and the rank.
For a given number of ranks he gets each time, you have to predict how many names are cut in the list.

Constraints:
Number of Visiting<=10^9
ranks <=10000

Input Format:
Number of Visiting N in their first line
N space separated ranks the HOD gets each time

Output Format:
Number of ranks cut in the list

Sample Input:
6
4 3 7 2 6 1

Sample Output:
3

Question 4 : Seating Arrangement in Exam Hall

Problem Statement  :

Semester exams are going on for university students. Examiners noticed that a group of people are trying to cheat. They marked students of that group as ‘1’ and students of another group ( who are not cheating ) as ‘0’ 

We can reduce cheating by not allowing students from group 1 to sit together, means no two students from group 1 can sit together. Seatings are marked using above conditions. Your task is to give the seating placement of nth possibility Possibility order from 1 to 10 is given below

[1  10  100  101  1000  1001  1010  10000  10001  10010]

Sample input :

3 → number of test cases

4

6

9

Sample output :

101

1001

10001

Explanation :

4th possibility is 101 

6th possibility is 1001

9th possibility is 10001

Question 5: Formatting large Products

Problem Statement: Rohan is weak in mathematics.He is giving mathematics  Olympiad , but he got stuck in one of the question .Help rohan to solve the question.In Question there are two positive integer A and B. You have to find the product of all integer between A and B which is represented in the form C=D*10^E , where  C is the product of numbers , D and E are non-negative integers and the last digit of D is non-zero.

Function Description 

  • Complete the function formatProducts in the editor below, formatProduct must return a string that represents C in the above described form.
  • Function has the following parameters
  • A: an integer
  • B: an integer

Constraints

  •    A will between 1 and 1,000,000 . Inclusive.
  •    B will be between A and 1,000,000. Inclusive.

Sample Input 0 

  • 1
  • 5

Sample Output 0

  • 12 * 10^1

Explanation 

  • 1*2*3*4*5=120 = 12 * 10^1

Sample Input 1

  • 3
  • 10

Sample Output 1

  • 18144 * 10^2

Explanation

  • 3*4*….*10=1814400 =18144 * 10^2

Question 6:  Left Rotation

Problem Statement

A left rotation operation on an array shifts each of the array’s elements unit to the left. For example, if 2 left rotations are performed on array [1, 2, 3, 4, 5], then the array would become [3, 4, 5, 1, 2].

Given an array of integers and a number, , perform left rotations on the array. Return the updated array to be printed as a single line of space-separated integers.

Function Description

Complete the function rotLeft in the editor below. It should return the resulting array of integers.

rotLeft has the following parameter(s):

  • An array of integers .
  • An integer , the number of rotations.

Input Format

The first line contains two space-separated integers and , the size of and the number of left rotations you must perform.

The second line contains space-separated integers a[i].

Constraints

  • 1 <= n <= 10^5
  • 1 <= d <= n
  • 1 <= a[i] <= 10^8

Output Format

Print a single line of space-separated integers denoting the final state of the array after performing d left rotations.

Sample Input
5 4
1 2 3 4 5

Sample Output
5 1 2 3 4

Explanation
When we perform d=4 left rotations, the array undergoes the following sequence of changes:

[1,2,3,4,5] → [2,3,4,5,1] → [3,4,5,1,2] → [4,5,1,2,3] → [5,1,2,3,4]

Test Case : 1

Input (stdin)

  • 5 4
  • 1 2 3 4 5

Expected Output

  • 5 1 2 3 4

Test Case : 2
Input (stdin)

  • 20 10
  • 41 73 89 7 10 1 59 58 84 77 77 97 58 1 86 58 26 10 86 51

Expected Output

  • 77 97 58 1 86 58 26 10 86 51 41 73 89 7 10 1 59 58 84 77

Question 7: Trapezium pattern

Anirudh is attending an astronomy lecture. His professor who is very strict asks students to
Write a program to print the trapezium pattern using stars and dots as shown below . Since Anirudh is not good at astronomy can you help him?

Sample Input:

  • N = 3

Output:

**.**
*…*
…..
*…*
**.**

Question 8: Vowel Encryption

Problem Statement  :

There is an encryption game going on. You will be given a number. If a digit is prime, it will take a vowel. Otherwise it will take a consonant value.
By this process, you have to make the string the lexicographically smallest possible. For a given number, print the output as a string.;

Input Format:
An integer n denoting the number.
Output Format:
The encrypted word.

Sample Input: 123421
Sample Output: baecab

Question 9: Array Sub Array

Problem Statement  :

You are given an array, You have to choose a contiguous subarray of length ‘k’, and find the minimum of that segment, return the maximum of those minimums.
Sample input 0 :
1 → Length of segment x =1
5 → size of space n = 5
1 → space = [ 1,2,3,1,2]
2
3
1
2

Sample output :
3
Explanation :
The subarrays of size x = 1 are [1],[2],[3],[1], and [2],Because each subarray only contains 1 element, each value is minimal with respect to the subarray it is in. The maximum of these values is 3. Therefore, the answer is 3

Question 10: Queries for Count

The task is to determine the number of elements within a specified range in an unsorted array. Given an array of size n, the goal is to count the elements that fall between two given values, i and j, inclusively.
Examples:

Input:
Array: [1, 3, 3, 9, 10, 4]
Range 1: i = 1, j = 4
Range 2: i = 9, j = 12

Output:
For Range 1: 4
For Range 2: 2

Explanation:
In the first query, the numbers within the range 1 to 4 are 1, 3, 3, and 4.
In the second query, the numbers within the range 9 to 12 are 9 and 10.

FAQs related to AMCAT Coding Questions

Question 1: What kind of questions are asked in AMCAT?

In AMCAT Exam Quants, Logical Reasoning, Verbal Ability and Domain Specific Question are included.

Question 2: What is minimum score in AMCAT exam?

There is no such minimum criteria for Qualifying AMCAT Exam.

Question 3: Does AMCAT test have coding questions?

Yes, AMCAT Exam Includes Coding Question, if the applicant has opted for the same. Along with Aptitude Section.

Following mentioned topics are included in AMCAT Coding Test:

  • Basic Programming
  • Conditional statements
  • Linear data structures
  • Advanced data structures
  • Sorting and searching algorithms
  • Control Structures Based Coding
Question 4: What questions are asked in AMCAT Coding Test?

Following mentioned topics are included in AMCAT Coding Test:

  • Basic Programming
  • Conditional statements
  • Linear data structures
  • Advanced data structures
  • Sorting and searching algorithms
  • Control Structures Based Coding

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription