You are here : Home >> All Company Study Materials >> Amcat Archive >> Amcat Technical Questions
Q21. Rajni wants to create a data-type for the number of books in her book case. Her shelf can accommodate a maximum of 75 books. She allocates 7 bits to the datatype. Later another shelf is added to her book-case. She realizes that she can still use the same data-type for storing the number of books in her book-case. What is the maximum possible capacity of her new added shelf?
A. 52
B. 127
C. 53
D. 75
Ans. A
Q22. There are two matrices A and B of size nXn. The data in both these matrices resides only at positions where both the indices are a perfect square. Rest all positions have 0 as the data. Manuj has available a third matrix initialized with 0’s at all positions. He writes an efficient code to put the sum of A and B in C. What is the time complexity of Manuj’s program?
A. THETA(n^2)
B. THETA(n)
C. THETA(n1/2)
D. THETA(log(n))
Ans. B
Q23. Ravi has to add an strictly upper triangular (no elements at diagonal) and a strictly lower triangular square matrix (no elements at diagonal) and put the result in a third matrix. What is the time complexity of Ravi’s algorithm? Assume that storing a value in a memory space takes negligible time, while each addition between values takes the dominating amount of time.
A. THETA(n^2)
B. THETA(n)
C. THETA(1)
D. None of these
Ans. C
Q24. We have two 100X3 (rowsXcolumn) matrices containing mid-term exam marks and end-term exam marks of 100 students. Each row refers to a particular student, while columns refer to marks in English, Social Sciences and Maths. The end-term and mid-term marks of each student in each subject have to be added to get his total score in each subject, to be put in a third matrix (100X3). Parinidhi writes a code (Code A), where the outer loop iterates over the rows, while the inner loop iterates over the columns. Shashi writes a code (Code B), where the outer loop iterates over the columns, while the inner loop iterates over rows. Which of the following is true with regard to their code ignoring any caching or memory storage effects?
A. Code A is faster than Code B
B. Code B is faster than Code A
C. Code A and Code B will run in the same amount of time
D. The comparison between the speed of the codes cannot be made.
Ans. B
Q25. A sorting algorithm traverses through a list, comparing adjacent elements and switching them under certain conditions. What is this sorting algorithm called?
A. insertion sort
B. heap sort
C. quick sort
D. bubble sort
Ans. D