Thanks for Visiting our website

Please check below of this page for latest AMCAT Question pattern

AMCAT Computer Programming-3

Somdeb Burman | 3:18 AM | 0 comments

21. Which of the following sorting algorithm yield approximately the same worst-case and average-case running time behaviour in O (n log n)?
A.  Bubble sort and Selection sort
B. Heap sort and Merge sort
C. Quick sort and Radix sort
D. Tree sort and Median-of-3 Quick sort


Ans. B

22. Sujan writes a sorting algorithm. The algorithm takes different amount of time to sort two different lists of equal size. What is the possible difference between the two lists?
A.      All numbers in one more list are more than 100, while in other are less than 100.
B.    The ordering of numbers with respect to magnitude in two lists has different properties.
C.    One list has all negative numbers, while the other has all positive numbers.
D.    One list contains 0 as element, while the other does not.

Ans. B

24. Mary is making a database of animals in a zoo and their properties.The possible animals are dog,lion and zebra.Each one has as attribute is Herbivorous,colour and isNocturnal.She uses the object-oriented programming paradigm for this.How will she conceptualise the system?
A.      Class: Animal; objects: dog, lion and zebra; data members : isHerbivorous, colour and is Nocturnal
B.      Class : Animal; objects : isHerbivorous, colour and isNocturnal; data members : dog, lion and zebra
C.      Classes: dog, lion and zebra: objects: Animal; data members: isHerbivorous, colour and is Nocturnal
D.      None of these

Ans. A

25. What is implied by the argument of a function?
A.      Variables passed to it when it is called                                    B. The value is returns on execution
C.    The execution code inside it                                                     D. Its return type

Ans. A

26. Tanuj writes the code for a function that takes as input n and calculates the sum of first n natural numbers.
function {
if(??)
                                                return 1
else
                                                 return(n+sum(n-1))
end }
Fill in?? in the code.
A.      n equals 1                            B. n equals 2                                       C. n>=1                                 D. n>1

Ans. A

27. 
integer i,k,j,n==5
for i=n to 1 decrement 1
{
    for j=n to i+1 decrement 1
      {
Print blankspace
      }
     for k=1 to ((2*i)-1)increment 1
     {
print “*”
      }
     print  end-of-line //takes the cursor to the nextline
}
What will be the output when the given code is executed?
A.  *****           B. *****     C. *****    D.           *
      ****                   ****          ****                   **
      ***                       ***          *****               ***
      **                           **           ****               ****  
      *                               *           *****           *****

Ans .C

28. Afzal writes a piece of code, where a set of three lines occur around 10 times in different parts of the program. What programming concept can he use to shorten his program code length?
A.  Use for loops
B. Use functions
C. Use array
D. Use classes

Ans. B

29. Which of the following statements is true regarding the sorting and searching algorithms?
A.      Linear searching is faster than the most efficient sorting algorithm
B.      Linear searching is slower than the most efficient sorting algorithm
C.      Linear searching and the most efficient sorting algorithm take up almost same time
D.      Their complexities cannot be compared

Ans. B

30. Stack is used for implementing
A.      Radix search               B. Breadth first search                         C. Recursion                       D. None of these

Ans. C

Category: ,

0 comments