## Tuesday, August 25, 2015

### AMCAT COMPUTER PROGRAMMMING PREVIOUS QUESTIONS (PAPERS)-11

101. Which will be the input to second pass? If the list before starting the Radix sort is: 729, 150, 123, 931, 348, and 517?
A. 150,123,348,517,729,931                                       B. 150,931,123,517,348,729
C. 517,729,123,931,348,150                                       D. 123,150,348,517,729,931

102. Sorting is not possible by using which of the following methods?
A. Insertion     B. Selection     C. Exchange     D. Deletion

Ans D

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

104. Srishti writes a program to find an element in array A[5] with following elements In order 8 30 40 45 70.she runs the program to find number x. x is found in first Iteration of binary search. What is value of x?
A.  40                                  B. 8                      C. 70                   D. 30

105. Abhinav wants to find largest number in a given list of 20 numbers. Which of following is an efficient approach to do this?
A.      Use bubble sort to sort the list in ascending order and Then print first number of series
B.      Use selection sort to sort the list in descending order and Then printf first number of series
C.      Implement on iteration of selection sort for descending order and printf first number in series
D.      None of these.

106. Null function is also known as___________
A. Anonymous function                             B. Generic function      C. void function             D. Null operator

Ans D

107. In breath first rule which of the following option is true?
A.  Beginning from a node, first all its adjacent nodes are traversed.
B.  Beginning from a node, each adjacent node is fully explored before traversing next adjacent node.
C.  Beginning from a node, nodes are traversed in cyclical order.
D. None of these.

Ans B

108. Which one of following is lowest level format to which computer converts a higher Language program before execution?

A. English code               B. Machine code           C. Assembly language                 D. System language

Ans B

109. Choose the correct answer. Consider the statement
while (a < 10.0) {
a = a*a
}
Assuming a is positive, for what value of a will this code statement result in an infinite loop?
A. a < 1.0                       B. a < sqrt (10)                            C.  a > sqrt (10)                               D. a = 0

Solution: Answer will be Option A. Option 4 can’t be true as 0 is neither + ve, or –ve.

110. Choose the correct answer. Ankita takes as input 2 integer numbers, a and b, whose value can be between 0 and 31. He stores them as 5 bit numbers. He writes the following code to process these numbers to produce a third number c.
c = 2*(a - b)
In how many minimum bits should Ankita store c?
A. 6 bits                               B. 7 bits                         C. 8 bits                          D. 9 bits

Solution: Answer will be Option B.
c = 2*(a - b)
Lowest number will be generated when a=0 and b=31
c= 2*(0-31) = -64
Highest number will be generated when a=31 and b=0
c= 2*(31-0) = 64
range = -64 to 64
bits required = 7