AMCAT-Programming Ability -IV
AMCAT-Programming Ability -IV
Not answered
Select one:
Marked out of
1.00 a. 0 to 1025
b. 0 to 1024
c. 0 to 1000
d. 0 to 1023
Select one:
a. Implement one iteration of selection sort for descending order and
print the first number in the series.
c. None of these
d. Use bubble sort to sort the list in descending order and then print the
first number of the series.
The correct answer is: Implement one iteration of selection sort for
descending order and print the first number in the series.
8/21/2019 AMCAT-Programming Ability -IV
Question 3 In breadth-first search, which of the following is true?
Not answered
Select one:
Marked out of
1.00 a. None of these
c. Beginning from a node, first all its adjacent nodes are traversed.
The correct answer is: Beginning from a node, first all its adjacent nodes are traversed.
b. An object is deleted
c. A class is deleted
d. A class is declared
c. A class has both data and functions on the data in the class.
The correct answer is: Data in private and protected area of a class is not
directly accessible and can only be accessed through member functions in the
public area of class.
8/21/2019 AMCAT-Programming Ability -IV
Question 6 For a path to be Eulerian, which of the following conditions are necessary and
Not answered
sufficient?
Marked out of
1.00 Select one:
a. The graph should have even edges.
The correct answer is: Degree of each vertex in the graph should be even.
b. 2*n
c. n*n
d. n*(n+1)/2
Question 8 Lavanya wants to find the smallest number out of 26 inputted numbers.
Not answered How many minimum comparisons he has to make?
Marked out of
1.00 Select one:
a. 52
b. 13
c. 41
d. 25
b. It is never equivalent
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: c
8/21/2019 AMCAT-Programming Ability -IV
Question 12 What will be the output of the following pseudocode statement?
Not answered Integer a= 456, b, c,
Marked out of d=10 b = a /d
1.00
c = a‐b
print c
Select
one:
a. 411.4
b. 411
c. 410
d. 410.4
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: b
8/21/2019 AMCAT-Programming Ability -IV
Question 13 Seema writes the code for a function that takes as input n, and even integer
Not answered and calculates the sum of first n even natural numbers
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: d
8/21/2019 AMCAT-Programming Ability -IV
Question 14 Ashima wants to print a pattern which includes checking and changing a
Not answered variable’s value iteratively. She decides to use a loop/condition. Which of the
following options should she use such that the body of the loop/condition is
Marked out of
1.00 executed at least once whether the variable satisfies the entering condition or
not?
Select one:
a. Do While Loop
b. Switch Case
c. For Loop
d. While Loop
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: a
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: a
8/21/2019 AMCAT-Programming Ability -IV
Question 16 Tanuj writes the code for a function that takes as input n and calculates the
Not answered sum of first n natural numbers
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: c
8/21/2019 AMCAT-Programming Ability -IV
Question 17 Consider a Binary tree implementation. The root address is stored in the
Not answered variable root. Given the address of a node in variable node, its value, right
and root child node address can be accessed using the following statements
Marked out of
1.00 respectively: node> value, node> right, node> left. Sameer writes the
following function to do a preorder traversal of the tree
function preordertraverse(node)
{
print node‐
>value
if(Condition X)
{
preordertraverse(node‐>left)
}
if (Condition Y)
{
preordertraverse(node‐>right)
}
return 0;
}
What is condition X and
condition Y? Select one:
a. Condition X: node > left is equal null Condition Y: node > right is equal null
b. Condition X: node > right is equal null Condition Y: node > left is equal null
c. Condition X: node > left is not equal null Condition Y: node > right is not equal null
d. Condition X: node > right is not equal null Condition Y: node > left is not equal null
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: a
8/21/2019 AMCAT-Programming Ability -IV
Question 18 Following program is to print the sum of all cubes, where the value of the cubes
Not answered go from 0 to 100.
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: c
8/21/2019 AMCAT-Programming Ability -IV
Question 19 What will the Prefix equivalent for the given notation – (M+N)
Not answered
(O+P*Q)/R*S Select one:
Marked out of a. /+MN*+OPQ*RS
1.00
b. +MN*/+O*PQRS
c. +MN*/+OPQ*RS
d. /+MN*+O*PQRS
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: b
8/21/2019 AMCAT-Programming Ability -IV
Question 20 integer
Not answered
i=0, j while
Marked out of (i<2)
1.00
{j
=0
;
while (j<=3*i)
{
print j
print blank
space j=j+3
}
print end of the line // takes cursor to
next line i=i+1
}
What is the
output? Select
one:
a. 0 3
036
0369
b. 0 3
03
6
c. 0 3
03
6
0369
0 3 6 9 12
d. 0
0
3
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: d
8/21/2019 AMCAT-Programming Ability -IV
Question 21 What will be the output of the following pseudo code
Not answered
statements Integer a = 984, b=10
Marked out of Float
1.00
c
c=a/b
Print
c
Select one:
a. 98.0
b. 98.4
c. 984
d. Error
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: a
8/21/2019 AMCAT-Programming Ability -IV
Question 22 Sharma writes a piece of code, where a set of three lines occur around ten times
Not answered in different parts of the program. What programming concept can he use to
shorten his program code length?
Marked out of
1.00 Select one:
a. Use for loops
b. Use classes
c. Use arrays
d. Use functions
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: d
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: d
8/21/2019 AMCAT-Programming Ability
Question 24 Which of the following items may or may not have its methods
Not answered
implementations? Select one:
Marked out of a. Generic class
1.00
b. Abstract class
c. Anonymous class
d. Interface
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: b
Question 25 A queue is implemented as a single linked list. Each node has an element and
Not answered pointer to another node. Rear and Front contain the addresses of rear and front
node respectively. If the condition (rear is equal front) is true and neither is
Marked out of
1.00 NULL, What do we infer about the linked list?
Select one:
a. There is an error
b. It has one element
c. It has no elements
d. None
Select one:
a. a
b. b
c. c
d. d
Your answer is
incorrect. The correct
answer is: b