# Top 20 AMCAT Programming Questions With Answers 2023

If you are a job seeker then you must be aware of AMCAT. It is one of the largest tests taken by job seekers every year. This exam helps students to exam their skills. This also helps them to get more recognition from companies and industries.
So it’s clear that there are thousands of candidates out there who would appear for AMCAT. This is what makes AMCAT hard. You will have to study hard and get enough marks to appear in the interviews.
Although the interview is likely to be the hardest part to crack in AMCAT. That’s why people need help with it. There are so many things that one can do to prepare for the interviews. Like recording or writing their answers, practicing with their friend, and take a mock interview. There are a lot of things but for every one of them, the candidates would require to know the common AMCAT interview questions. Where to find that? Well, we are here for that.
In this article, we have a collection of AMCAT interview questions that every candidate must know about. Go ahead and take a look at the following list of AMCAT Interview Questions and prepare yourself for the interview. [toc]

Q1. A is an empty stack. The following operations are done on it.
PUSH(1)
PUSH(2)
POP
PUSH(5)
PUSH(6)
POP
What will the stack contain after these operations?
a) 5 6
b) 1 6
c) 5 6
d) 1 5
Ans:  d
To an Empty Stack A,
PUSH(1): 1
PUSH(2): 1 2
POP: 1
PUSH(5): 1 5
PUSH(6): 1 5 6
POP: 1 5
By the end of all the operation, the elements remaining are 1 5.
Q2. What is implied by the argument of a function?
a) The variables passed to it when it is called
b) The value it returns on execution
c) The execution code inside it
d) Its return type
Ans:  a
The variables that are passed as inputs to a function in a function call are called arguments.
Q3. In a sequential programming language, code statements are executed in which order?
a) All are executed simultaneously
b) From top to bottom
c) From bottom to top
d) None of these
Ans:  b
In a sequential programming language code statements are executed from top to bottom.
Q4. A pseudo-code is used. Assume that when two data-types are processed through an operator, the answer maintains the same data-type as the input data-types. Assume that all data-types have enough range to accommodate any number. If two different data-types are operated on, the result assumes the more expressive data-type.
What will be the output of the following pseudo-code statements?
Integer a = 456, b, c, d =10
b = a/d
c = a – b
print c
a) 410
b) 410.4
c) 411.4
d) 411
Ans:  d
a/d = 456/10 = 45.6 =45 ( input data type and the output must be same) c = 456 – 45 = 411
Q5. Geeta takes as input 2 integer numbers, a and b, whose value can be between 0 and 31. She stores them as 5 bit numbers. She writes the following code to process these numbers to produce a third number c à c = 2*(a – b)
In how many minimum bits should Geeta store c?
a) 6 bits
b) 7 bits
c) 8 bits
d) 9 bits
Ans:  b
c = 2*(a – b)
For lowest number, when a=0 and b=31 à c= 2*(0-31) = -62
For highest number, when a=31 and b=0 à c= 2*(31-0) = 62
Range= -62 to 62, so It will fit on (-64 to 63) i.e., 2^7
Bits Required = 7
Q6. I have a problem to solve which takes as input a number n. The problem has a property that given the solution for (n-1), I can easily solve the problem for n. Which programming technique will I use to solve such a problem?
a) Iteration
b) Decision-making
c) Object Oriented Programming
d) Recursion
Ans:  d
Recursion means calling again and again. Therefore problem n can be solved with the solution n-1, by repeatedly calling it.
Q7. The memory space needed by an algorithm has a fixed part independent of the problem instance solved and a variable part which changes according to the problem instance solved. In general, which of these two is of prime concern to an algorithm designer?
a) Fixed part
b) Variable Part
c) Product of fixed part and variable part
d) None of these
Ans: b
Variable part, since it changes according to the problem instance solved.
Q8. Pankaj and Mythili were both asked to write the code to evaluate the following expression:
a – b + c/(a-b) + (a-b)^2
Pankaj writes the following code statements (Code A):
print (a-b) + c/(a-b) + (a-b)*(a-b)
Mythili writes the following code statements (Code B):
d = (a-b)
print d + c/d + d*d
If the time taken to load a value in a variable, for addition, multiplication or division between two operands is same, which of the following is true?
a) Code A uses lesser memory and is slower than Code B
b) Code A uses lesser memory and is faster than Code B
c) Code A uses more memory and is faster than Code B
d) Code A uses more memory and is slower than Code B
Ans: a
Code A uses lesser memory and it is slower than code B. Since code B uses another variable d it needs to have more memory than code A. But code B will execute faster.
Q9. A queue is implemented as a singly-linked-list for easy addition and deletion of elements. Each node has an element and a pointer to another node. Which node will point to empty/no location?
a) Rear
b) Front
c) Both
d) None
Ans:  a
The new node will always be added at the rear end, so the new/empty location will be pointed by Rear end.
Q10. Q is an empty queue. The following operations are done on it:
DELETE
DELETE
DELETE
What will be the content of Q after these operations? Front is marked by (F) and Rear is marked by (R).
a) 10(R) 13(F)
b) 5(R) 10(F)
c) 13(R) 10(F)
d) 10(R) 5(F)
Ans:  a
Queue follows FIFO principle, so performing the FIFO operation the Front will be pointing to 13 and Rear will be pointing to 10.

## Amcat Programming Questions Answers For Wipro

Q1. An array contains the following elements in order: 7 6 12 30 18. Insertion sort is used to sort the array in ascending order. How many times will an insertion be made?
a) 2
b) 3
c) 4
d) 5
Ans:  a
The insertion is made twice. First insertion is inserting 6 before 7. Second insertion is inserting 18 between 12 and 30.
Q2. Ragu writes a program to find an element in the array A with the following elements in order: 18 32 44 46 57. She runs the program to find a number X. X is found in the first iteration of binary search. What is the value of X?
a) 44
b) 18
c) 46
d) 32
Ans:  a
The array has 18 32 44 46 57 Binary search is performed only on sorted arrays. In this search the middle element is identified and if the element to be searched is lesser than the middle element then all the elements to the right of the middle value are neglected and again the middle value is obtained for the remaining elements. If the element to be searched is greater than the middle element then all the elements to the left of the middle value are neglected and again the middle value is obtained for the remaining elements. If the value is obtained in the first iteration itself, then the value should be the middle element of the array. Here the middle element is 44.
Q3. A stack is implemented as a linear array A[0…N-1]. Farhan writes the following functions for pushing an element E in to the stack.
function PUSH( top, E, N )
{
if(X)
{
top= top+1
A[top] = E
}
else
{
print “Overflow”
}
}
Fill in the condition X
a) top< N
b) top <N-1
c) top > 0
d) top > 1
Ans:  b
The array is 0,1,2,……,N-1. The maximum size of the array is N-1. To perform a PUSH operation, the stack should have free space. This is checked using the top pointer. If the top pointer is less than N1(maximum size) then PUSH operation can be done. If not the condition is called Stack Overflow. Hence X should be top<N-1.
Q4. A queue is implemented by a linear array of size 10 (and not as a circularly connected array). Front and Rear are represented as an index in the array. To add an element, the rear index is incremented and the element is added. To delete an element, the front index is incremented. The following operations are done on an empty queue.
After this set of operations, what is the maximum capacity of the queue?
a) 6
b) 7
c) 10
d) None of these
Ans:  b
The maximum size of the queue is 10. For every DELETE operation the front pointer is incremented and the space becomes useless. Here, there are three DELETE operations. So, the front pointer is incremented by three spaces and these three spaces become useless. Hence 10-3=7. Only 7 spaces are available which the maximum size of the array is.
Q5. Riyaz has a book of tickets and wants to store ticket numbers in a data structure. New tickets are added to the end of the booklet. Ticket at the top of the stack is issued to the customer. Which data structure should Riyaz use to represent the ticket booklet?
a) Queue
b) Stack
c) Array
d) Graph
Ans:  a
Tickets are added to the end and are removed from the top. This follows the logic of First In First Out. This logic can be represented using a queue data structure.
Q6. Which of the following data structures may give overflow error, even though the current number of elements in it is less than its size?
a) Queue implemented in a linear array
b) Queue implemented in a circularly connected array
c) Stack implemented in a linear array
d) None of these
Ans:  a
In a queue data structure implemented in a static linear array, for an enqueue operation the rear pointer is incremented. Similarly, for a dequeue operation the front pointer is incremented. When the front pointer is incremented, the memory space before front becomes useless. So even if the size is more the queue will end up showing an overflow error.
Q7. Number of possible ordered trees with 3 nodes A, B, C is
a) 16
b) 12
c) 13
d) 14
Ans:  b
Q8. Farhan writes a code to find the factorial of an inputted number. His code gives correct answers for some inputs and incorrect answers for others. What kind of error does his program have?
a) Syntactical error
b) Run-time Error
c) Logical Error
d) None of these
Ans:  c
Syntactical Error and Run-time error will not give any output. Logical error is a bug in a program that causes it to operate incorrectly, but not to terminate abnormally. A logic error produces unintended or undesired output, although it may not immediately be recognized as such. The problem to the given question can be Integer overflow. If int is 32 bits, then the largest value it can represent But 13 factorial is x If it is 64-bit integer type such a long  long, this can give up to 20 factorial.
Q9. As part of the maintenance work, you are entrusted with the work of rearranging the library books in a shelf in proper order, at the end of each day. The ideal choice will be Bubble Sort
a) Insertion Sort
b) Selection Sort
c) Heap Sort
d) None
Ans: b
Sorting of books in a library is an example of insertion sort. We pick a book and place it in its corresponding place as it is done in an insertion sort.
Q10. A hash table can store a maximum of 10 records. Currently there are records in locations 1, 3, 4, 7, 8, 9, 10. The probability of a new record going into location 2, with a hash function resolving collisions by linear probing is
a) 0.6
b) 0.1
c) 0.2
d) 0.5
Ans:  a
The probability is 6/10. Due to uniform distribution, the probability that the new record will be placed to any location X will be same for any X of (1,2,3,4,5,6,7,8,9,10) & will be equal to 1/10. Now if the hash function will try to place the new record in to any of the locations 1,7,8,9,10 the record will be redirected to location 2 due to collision resolution by linear probing. And if hash function will try to place the new record into 2, since location 2 is available, the record will go to location 2. So The probability of going new record into location 2, will be same as probability that the output of hash function is any one of (1,2,7,8,9,10) out of (1,2,3,4,5,6,7,8,9,10) where each location is equally likely. So the chances will be 6/10 i.e., 0.6

### Conclusion –

So these are some of the best AMCAT Interview questions that you needed to know about. If you are thinking about where did we found these questions then let us tell you that a team of professionals and experts who knows how the AMCAT interviews go, helped us to come up with these questions.
As we have said earlier that these are some of the most common AMCAt interview questions that are asked, so do prepare them. This way you will feel more confident and you will be able to answer confidently if they were asked in the interview. Thank you for being here and we are glad to help you out.
{"ft_lang_label":"__label__en","ft_lang_prob":0.8985671,"math_prob":0.9265179,"size":12344,"snap":"2022-40-2023-06","text_gpt3_token_len":3146,"char_repetition_ratio":0.11985413,"word_repetition_ratio":0.047879618,"special_character_ratio":0.25032404,"punctuation_ratio":0.10962567,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97754467,"pos_list":[0,1,2],"im_url_duplicate_count":[null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-02-07T15:50:00Z\",\"WARC-Record-ID\":\"<urn:uuid:8bf8a352-8ab8-46c1-b196-fd42800fd421>\",\"Content-Length\":\"86968\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:7c0620c1-23b6-4cf5-80e6-fa677a68415c>\",\"WARC-Concurrent-To\":\"<urn:uuid:4db65093-81fc-4725-a7cf-a9225a8839b8>\",\"WARC-IP-Address\":\"35.175.60.16\",\"WARC-Target-URI\":\"https://questionsgems.com/amcat-programming-questions/\",\"WARC-Payload-Digest\":\"sha1:EJW33A67TBZVZKCQW6X7UBKACV6MM5H3\",\"WARC-Block-Digest\":\"sha1:JYPTU44HKS5HCJPUPGOSYD5O7NQUNQH5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764500619.96_warc_CC-MAIN-20230207134453-20230207164453-00228.warc.gz\"}"}