## Saturday, August 22, 2015

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

Question 1
A code with θ(n) and θ(n^2). Which code will execute faster for a code of size J?
A. θ(n)
B. θ(n2)
C. Cant be said as size of K is unknown
D. Both will be equal

Correct Op: C
Cant be determined as the size of K is not known.

Question 2
In regards to time complexity which will perform better ω(n^4) or O(n^3)?
A. ω(n^4)
B. O(n^3)
C. Both Equally
D. Cant be said

Correct Op:A
ω(n^4) as it is omega is measured for best time complexity

Question 3
In case of the worst timing, which might be the worst to implement in sorting algorithm?
A. Quick
B. Merge
C. Tim
D. Heap

Correct Op: A
Quick sort has worse time complxity of O(n^2)

Question 4
The time required to insert in the Queue is?
A. O(n)
B. O(n^2)
C. O(1)
D. O(log n)

Correct Op: C

Question 5
Which of the following has the quickest average time complexity?
A. Quick
C. Bubble
D. Heap

Correct Op:B
Radix sort is quickest amongst these in average time

Question 6
There are 2 buildings and on each's window, a flower pot is kept. Ravi's mother tells him to multiply each cell/window to the other and store in a matrix? What would be time complexity if he writes a code to do so?
A. Omega(n)
B. Omega(n^2)
C. Theta (n)
D. Theta (n^2)

Correct Op:D
Two for loops thus, Theta (n^2)

Question 7
There are 2 buildings and on each's window, a flower pot is kept. Ravi's mother tells him to add each cell/window to the other and store in a matrix? What would be time complexity if he writes a code to do so?
A. Theta(n)
B. Theta( log n)
C. Theta(n^2)
D. Theta(n log n)

Correct Op: A
Theta(n) will be the answer

Question 8
What is space complexity of the program?
A. Amount of hard disk space required to store the program.
B. Amount of hard disk space required to compile the program.
C. Amount of memory required by the program to run.
D. Amount of memory required by the program to compile.

Correct Op: C