Tuesday, August 25, 2015


11.  In an implementation of a linked list, each node contains data and address. Which of the following could the address field possibly contain?
A. Address of next node in sequence   B. It’s own address
C. Address of the last node                   D. Address of the first node

Ans. A

12.  Parthiv has included several classes and their subjects in his project. Now he wants to use something that will hold all these objects (of different classes). Which of the following options provides him with the best iterative?
A. Store them in database           B. Final class            C. Generic class       D. Anonymous class


13. Shristhi writes the code for a function that computes the factorial of the inputted number  n.

function factorial(n)
                                                if( n equals 1)
                                                                return 1
                                                                 - - MISSING STATEMENT - -
Fill the missing statement.
a.       return factorial(n-1)                     B. return n*factorial(n)     C. return n*(n-1)     D. return n*factorial(n-1)


14.       Shasi wants to make a program to print the sum of the first 10 multiples of 5. She writes the following program, where statement 5 is missing.
integer i=0
integer sum=0
while ( i <= 50)

                                 sum =sum+1
                                - - MISSING STATEMENT - -
print sum
Which of the following options will you use for statement 5?
A. i = 5                   B. i = 5 *I              C. i = i + 1                             D. i = i + 5


15.       Consider the following code:
if(condition 1)
                                if(condition 2)
// Statement A
                                 Elseif (condition 3)
//Statement B
 // Statement C
                                else if (condition 4)
 //Statement D
//Statement E

Which of the following conditions will allow execution of statement C?
A. condition1 AND condition 3
B. condition1 AND condition4 AND NOT (condition2)
C. NOT (condition2) AND NOT (condition3)
D. condition1 AND NOT(condition2) AND NOT(condition3)


16.A full binary tree with n non-leaf nodes contains
A. (log n) nodes                B.  n + 1 nodes                   C. 2n+1 nodes                   D. 2n nodes

Ans. C

17. Ravi is writing a program in C++. C++ uses the ‘for’ keyword for loops. Due to distraction Ravi writes ‘gor’ instead of ‘for’. What will this result to?
A. The code will not compile
B. The code will give an error while in execution
C. The code may work for some inputs and not for others
D. It will create no problems.


18. Aina wants to use a sorting technique to sort a list of numbers such that the running time of the sorting technique that she uses won’t affected by pre-order of the elements. Which of the following sorting techniques should she use?
A. Merge Sort                    B.  Bubble Sort                  C. Insertion Sort               D. Selection Sort
Ans. Not known please write into Comments and will be added here for students reference.

19. While calculating time complexity of an algorithm, the designer concerns himself/herself primarily with the run time and not the compile time. Why?
A. Run time is always more than compile time.      B. Compile time is always more than run time
C. Compile time is a function of run time                  D. A program needs to be compiled once but can be run several times.


20. Pankaj and Mythili were both asked to write the code to evaluate the following expression.
a-b + c/(a-b) + (a-b)2       
1.       Pankaj writes the following code statements (Code A)
print (a-b) + c/(a-b) + (a-b) * (a-b)
2.       Mythili writes the following code statements (Code B)
d = (a-b)
print d + c/d + d*d

If the time taken to load 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.