Tuesday, August 25, 2015

AMCAT COMPUTER PROGRAMMMING PREVIOUS QUESTIONS (PAPERS)-8

71. 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 arrays                      D. use classes

Ans B

73. Shravanthi writes the following program:
                Integer i =0, j
                while(I<2)  {                                     
                             j=0;
                            while(j<=3*I )   {
                                     Print j
                                     Print blank space
                                     J=j+3
                             }
                            Print end-of-line //takes the cursor to the next line                                        
                            i=i+1                                       
                  }
 What will be the output of the program?

A.      0                        B.  0   3                       C. 0                 D.  0   3   6   
        0     3                      0   3   6                             0   3   6                       0   3   6   9   
                                                                                  0   3   6   9               0   3   6   9   12      
74. A destructor may be invoked in which of the following situations?
A. when the object is created                                    B. when the object is assigned value 0
C. only at the end of the code                                  D. when the scope of the object is over

Ans D

75. Consider the given statement for their correctness with respect to stacks data structure
  1. Stacks follow a LIFO approach
  2. Stacks are used to convert binary numbers to corresponding decimal numbers.                                 
  3. Stacks use two pointers for performing PUSH and POP respectively
A. TTF                                 B. TTT                                        C. TFF                                   D.FTF

Ans D

76. Integer a=40, b=35, c=20, d=10. Comment about the output of the following two statements:
 Print a*b/c-d
 Print a*b/(c-d)
 Choose the correct answer? Assume the following prescedence (high to low).operates in the same row have the same precedence: (.) */ + - AND OR. For operates with equal precedence is from left-to-right in expression.
A.      differ by 80    B.   same  C. differ by 50   D. differ by 160

Ans A

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

Ans C

78. Which of the following options gives the lower bound on running time for an algorithm?
A. Best case complexity of the algorithm   B. Average case complexity of the algorithm
C. Worst case complexity of the algorithm   D. Number of iterations taking place in the algorithm

Ans C

79. A queue is implemented as a (single linked) linked-list. Each node has an element and pointer to another node. Rear and Front contain addresses of the rear and front node respectively. If the condition (rear is equal front) is true and neither is null, what do we infer about the linked list?
A. It has no elements   B. It has one element   C. There is an error                       D. None of these

Ans B

80. Which of the following options describes a tree?

A.  An unconnected graph         B. A connected graph         C. A connected acyclic graph             D. A complete graph

Ans C