## Saturday, August 22, 2015

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

1.  Null function is also known as
a.   Anonymous Function
b. Generic Function
c. Void Function
d. Null operator

Ans.D

2.  There are two loops which are nested. This implies which of the following
a.   Two loops, one after the other
b. Two loops, one inside the other
c. One loop two different iteration counts
d. Two loops with same iteration count

Ans.B

3.       Shravanti 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
Ans. C

4.        What is the term used to describe the situation,when a function in the base class is redefined in inherited class?

Ans.B

5.  Consider the given statements regarding Arrays-
1.Arrays provide a linear medium to store data.
2.Arrays provide a non indexed structure.
3.All the elements in Array depend on the location of the other elements of the Array.
Which of the above statements is/are true?
a.       Only 1     b. Both 1 and 2                  c. Both 1 and 3                   d. 1, 2 and 3

Ans.D

6.       Consider a binary tree implementation. The root address is stored in variable root. Given the address of a node is variable node, its value, right and root could node address can be accessed using the following statements respectively node-> value ,node ->  right, node-> left. Srikanth writes the following function to do a preorder traversal of the tree.
function preordertraverse(n0de)
{
print node -> value
if(Conditon X)
{
preordertraverse(node ->left)
}
if(Condition Y)
{
preordertraverse(node ->right)
}
return
}
What is the Condition X and Condition Y ?
a.       Condition X: node -> left is not equal null
b. Condition X: node -> right is not equal null,Condition Y:node -> right is not equal null,Condition Y:node -> left is not equal null
c.  Condition X: node -> left is equal null
d.   Condition X: node -> right is equal null, Condition Y:node -> right is equal null, Condition Y:node -> left is equal null.

Ans.A

7.       In breadth-first search,which of the following options 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
c.       Traversing the next adjacent node.
d.      Beginning from a node , nodes are traversed in cyclic order.
e.      None of these.

Ans.A

8.       Sruti is making a questionnaire of True-False question. She wants to define a data-type which stores the response of the candidate for the question. What is the most suited data type for this purpose?
a.       Integer   B. Boolean        c. float   d. character

Ans.B

9.       Which of these is not a data type?
a.       Integer   B. character   C. Boolean    D. array
Ans.D

10.   A full binary tree with n leaves contains
a.       2n+1 nodes        b. log2n nodes                  C. 2n-1 nodes                    D. 2n nodes

Ans.A

Name

Email *

Message *