Sunteți pe pagina 1din 88

1) Null function is also known as ___________.

A. Anonymous Function
B. Generic Function
C. Void Function
D. Null Operator

2) A complete binary tree has a property that the value at each node is at least as large as the values at its
children nodes. What is this binary tree known as?

A. Binary Search Tree


B. AVL Tree
C. Completely Balanced Tree
D. Heap

3) Which of the following is NOT a data type?

A. Integer
B. Character
C. Boolean
D. Array

4) Which of the following sorting algorithms yields approximately the same worst-case and average-case running
time behavior in O(n long)?

A. Bubble sort and Selection sort


B. Heap sort and Merge sort
C. Quick sort and Radix sort
D. Tree sort and Median-of-3 Quick sort

5) A programmer is making a database of animals in a zoo along with their properties. The possible animals are
dog. Lion and zebra each one has attributes as herbivorous. Color and nocturnal. The programmer uses the object-
oriented programming paradigm for this. How will the system be conceptualized?

A. Class: Animal; objects: dog, lion and zebra: data members: herbivorous, color and nocturnal
B. Class: Animal; objects: herbivorous, color and nocturnal: data members: dog lion and Zebra
C. Classes: dog lion and zebra: objects: Animal; data members; herbivorous, color and nocturnal
D. Nome of the above

6) A stack is implemented as a linear array A[0…N-1] A programmer writes the function given below to
pop out an element from the stack

Function POP ( top, N)


{

if (X)

top = top -1

else

“Print Underflow”

return top

Which of the following should substitute the condition”X”?

A. top<N-1
B. top<N
C. top>1
D. top>= 0

7) A queue is implemented as a singly linked-list. Each node has an element and a pointer to another node. The
Rear and the Front contain the addresses of the rear and the front nodes, respectively. What can be inferred about
the linked list if the condition (rear isequal front) is true?

A. It has no elements
B. It has one element
C. There is an error
D. None of the above

8) Consider the code given below. Assume that “a” and “b” are passed reference. What will the output of the
program be when the function calculate() is executed?

function modify(b,a)

return a –b
}

function calculate()

integer a = 5, b = 12, c

c = modify(a,b):

print c

A. 7
B. -7
C. 8
D. Error

Passage

functionmyfunc()

constant integer i=5

if (i> 3)

print “i am smali”

if ( i-- > 5 )

print “i am iarge”

eise print “i am different”

A pseudo-coed is used which is self explanatory.

9) What will be the output of the given code?

A. I am small
B. I am small am large
C. I am small am different
D. This code will generate an error
10) A librarian has to rearrange the library books on a shelf in a proper order at the end of each day. Which of the
following sorting techniques should be the librarian’s ideal choice?

A. Bubble sort
B. Insertion sort
C. Selection sort
D. Heap sort

11) A tree has 5 levels and each node has either 4 or no children. All nodes on the same level have the same
number of children. How many nodes are there in the tree?

A. 341
B. 256
C. 1024
D. None of the above

12) Why is an algorithm designer concerned primarily about the run time and not the compile time while
calculating time complexity of an algorithm?

A. Run time is always more than the compile time.


B. Compile time is always more than the 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.

13. For which of the following is the stack implementation useful?

A. Radix search
B. Breadth fist search
C. Recursion
D. None of the above

14. Passage

Function print_me(integer n) // Statement 1

if ( n < 1 ) return // Statement 2


print n // Statement 3
print_me(n-1) //Statement 4
}

A pseudo-code is used which is self explanatory,


// in pseudo code refers to comment
Pooja has written the following code to print numbers from 0 to n in reverse order using the recursive
approach. Find if there exists any error in the given code.
A. Statement 1
B. Statement 2
C. Statement 3
D. There is no error

15. How can a call to an overloaded function be ambiguous?


A. The name of the function might have been misspelled
B. There might be two or more functions with the same name
C. There might be two or more functions with equally appropriate signatures
D. None of the above

16. What will the output of the following pseudocode statements be?
(Note: Assume that when two data types are processed through an operator. The answer maintains the same data
type as that of input. Also, all data types have enough range to accommodate any number. If two different data
types are operated upon, the result assumes the data type that is more expressive.)
Integer a = 456, b, c, d = 10
b = a/b
c=a–b
Print c
A. 410
B. 410.4
C. 411.4
D. 411

17. Passage
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
}

A. 0
03
B. 0 3
036
C. 0 3
036
0 3 69
D. 0 3 6
0369
036912

18. What does the following function do?


function operation (int a, int b)
{
if (a>b)
{ retum operation(b, a) }
else
{ retum a: }
}
A. Always returns the first parameter
B. Returns the min of (a,b)
C. Returns the max of (a,b)
D. Loops forever

19. What is the average time required to perform a successful sequential search for an element in an array
A(1: n)?

A. (n+1)/2
B. log2n
C. n(n+1)/2
D.
n2

20. How are protected members of a base class accessed in the derived class when inherited privately in
C++?
A. Privately
B. Publicly
C. Protectedly
D. Not inherited

21. How many nodes does a full binary tree with n” non-leaf nodes contain?
A. log n
B. n + 1
C. 2n + 1
D. 2n

22. A programmer mistakenly writes “gor” instead of the keyword “for” used in loops, while writing a
program in C++. What will this result in?
A. The code would not compile.
B. The code would give an error while execution.
C. The code may work for some inputs and not for the others
D. The code would not create any problem.

31. Choose the correct answer


23. Whi
ch
of the following options is an exception to being a part of composite date types?
A. Union
B. Array
C. Structure
D. Stack

24. Which characteristic of data does a binary search use and a linear search does not?
A. Order of the list
B. Length of the list
C. Maximum value of the list
D. None of the above

PAPER -2

25. A sorting algorithm iteratively traverses through a list to exchange the first element with any element less than
it. It then repeats with a new first element. What is this sorting algorithm called?
A. Insertion sort
B. Selection sort
C. Heap sort
D. Quick sort

26. In which of the following methods is sorting NOT possible?


A. Insertion
B. Selection
C. Exchange
D. Deletion

30) A programmer is making a database of animals in a zoo along with their properties. The possible animals are
dog. Lion and zebra each one has attributes as herbivorous. Color and nocturnal. The programmer uses the object-
oriented programming paradigm for this. How will the system be conceptualized?

A. Class: Animal; objects: dog, lion and zebra: data members: herbivorous, color and nocturnal
B. Class: Animal; objects: herbivorous, color and nocturnal: data members: dog lion and Zebra
C. Classes: dog lion and zebra: objects: Animal; data members; herbivorous, color and nocturnal
D. Nome of the above
Q is an empty queue. The following operations are done on it:
ADD 5
ADD 7
ADD 46
DELETE
ADD 13
DELETE
DELETE
ADD 10
What will be the content of Q after these operations. Front is marked by (F) and Rear is marked by (R).

Option 1 : 10(R) 13(F) Option 2 : 5(R) 10(F) Option 3 : 13(R) 10(F) Option 4 : 10(R) 5(F)

32. 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

33. 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

34. 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

35. 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.

36. Which of the following sorting algorithm yield approximately the same worst-case and average-
case running time behaviour in O (n log n)?
A. Bubble sort and Selection sort
B. Heap sort and Merge sort
C. Quick sort and Radix sort
D. Tree sort and Median-of-3 Quick sort

37. What is implied by the argument of a function?


A. Variables passed to it when it is called
B. The value is returns on execution
C. The execution code inside it D. Its return type

38. Which of the following statements is true regarding the sorting and searching algorithms?
A. Linear searching is faster than the most efficient sorting algorithm
B. Linear searching is slower than the most efficient sorting algorithm
C. Linear searching and the most efficient sorting algorithm take up almost same time
D. Their complexities cannot be compared

39. A sorting algorithm traverses through a list, comparing adjacent elements and switching them
under certain conditions. What is this sorting algorithm called?
A. Insertion sort B. Heap sort C. Quick sort D. Bubble sort

40. What is the space complexity of a 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 for the program to compile

41. Srishti writes a program to find an element in the array A[5] with the following elements in
order: 8 30 40 45 70. She runs the program to find a number X. Xis found in the first iteration of
binary search. What is the value of X? Choose the correct answer
A. 40 B. 8 C. 70 D. 30

42. Saloni writes the code for a function that takes as input n, an even integer and calculates the
sum of 1st n natural numbers
function sum (n)
{
if(n equals 2)
return 2
else
return ( n+ sum( n-1))
}
She then calls the function by the statement, sum(30). How many times will the function sum be
called to compute this sum? Choose the correct answer?
A. 1 B. 30 C. 15 D. 16

43. Shalini wants to programme to print the largest number out of 3 inputted numbers. She writes
the following programme
Int number 1, number 2, number 3, temp;
Input number 1, number 2, number 3;
If ( number 1 > number 2)
Temp = number 1
Else
Temp= number 2
End if
If ( ??) // statement 1
Temp = number 3
End if
Print temp
Fill in the ??in statement 1 ? Choose the correct answer?

A. Number 3> number 2 B. Number 3> temp C. Number 3< temp D. Number 3> number 1

44. How many pointers will have to be changed when a new node is to be added in a linear linked
list in the middle?
A. 0 B. 1 C. 2 D. All the pointers will be changed

45. A variable cannot be used? Choose the correct answer


A. Before it is declared B.After it is declared C. In the function it is declared in D. Can always be
used

46. In which area of a class are data and function directly accessible outside the class? Choose the
correct answer
A. Public B. Private C. Protected D. None

47. Which of the following options is true regarding inheritance in Object Oriented Programming ?
Choose the correct answer?
A. There is reduced interaction with the hardware
B. A class may are may not have any object
C. Two are more functions can have the same name and number and type of arguments in a
program
D. Class- object relation can be changed at run time
E. All of the above
48. Every element of a data structure has an address and a key associated with it. A search
mechanism deals with two or more values assigned to the same address by using the key. What is
this search mechanism?
A. Linear search B. Selection search C. Hash coded search D. Binary search E. None of this

49. Which of the following abstract data types can be used to represent many – to- many relations?
Choose the correct answer?
A. Tree B. Stack C. Graph D. Queue

50. Pragya sells footballs. She has a large container to store footballs which is closed from below.
Footballs are piled one on top of the other in the box. When new balls are supplied, Pragya puts the
balls in the box from the top. When a customer buys a ball, she delivers the ball at the top of the
pile to the customer. Each ball has a code. She wants to store the ball codes in the data structure to
keep track of her inventory. What data structure should she use? Choose the correct answer?
A. Queue B. Stack C. Array D. Graph

PAPER-3

52. For the given array, find the arrangement of the elements after 3rd pass of selection sort.
Assume that the array is being sorted in ascending order list ; 33,22, 11, 77, 66, 88, 55
A. 22, 11, 33, 66, 77, 55, 88 B. 11, 22, 33, 55, 66, 77, 88
C. 11, 22, 33, 55, 66, 88, 77 D. 11, 22, 33, 77, 66, 88, 55

53. For solving a problem, which of these in the 1st step in developing a working programme for it?
Choose the correct answer?
A. Writing the program in the programming language B. Writing the step by step algorithm to
solve the problem
C. Compiling the libraries required D. Code debugging

51. The algorithm design technique used in quick sort algorithm is? Choose the correct answer
A. Dynamic programming B. Back tracking C. Divide and conquer D. Greedy search

54. How can call to an overloaded function be ambiguous?


A. By misspelling the name
B. There might be two or more functions with the same name
C. There might be two or more functions with equally appropriate signatures
D. none of these

55. 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

56. 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

57. function main() {


integeri=0.7
static float m=0.7
if (m equals i)
print ”we are Equal”
else if( m>i )
print ”I am greater”
else
print ”I am lesser”
}
A. We are equal B. I am greater C. I am lesser
D. This code will generate an error

58. Consider an array on which bubble sort is used. The bubble sort would compare the element
A[x] to which of the following elements in a single iteration?
A. A[x+1] B. A[x+2] C.A[x+2x] D. All of these

59. Choose the correct answer. Consider the statement


while (a < 10.0) {
a = a*a
}
Assuming a is positive, for what value of a will this code statement result in an infinite loop?
A. a < 1.0 B. a <sqrt (10) C. a >sqrt (10) D. a = 0

60. Choose the correct answer. Ankita takes as input 2 integer numbers, a and b, whose value can
be between 0 and 31. He stores them as 5 bit numbers. He writes the following code to process
these numbers to produce a third number c.
c = 2*(a – b)
In how many minimum bits should Ankita store c?
A. 6 bits B. 7 bits C. 8 bits D. 9 bits

61. Recursive function is executed in a ___________________________


A. Last in First Out Order B. First in First Out Order C. Parallel Fashion
D. All of the above
62. Yukta created an interface to use it in different parts of the program by implementing it.
But she forgot to specify the access specifier for each contained method. What will be the
access specifier of the methods that will be inherited/implemented?
A. Public B. Private C. Protected D.
An error will be generated

63. Which of the following statements are true?


1)An Arithmetic left shift multiplies a signed number by two
2)An Arithmetic right shift divides a signed number by two
3)Mask operation is an AND micro-operation and insert is an OR micro-operation
4)In a logical shift, the serial input to the shift is one
A. Both 1 and 2 B. Both 3 and 4 C. 1, 2 and 3 D. 2, 3 and 4

64. Choose the correct answer. A Queue is implemented by a linear array of size 10 (and
not as a circularly connected array). Front and Rear are represented as an index in the
array. To add an element, the rear index is incremented and the element is added. To
delete an element, the front index is incremented. The following operations are done on an
empty queue.
ADD 1; DELETE; ADD 2; ADD 3; ADD 4; DELETE, DELETE.
After this set of operations, what is the maximum capacity of the queue?
A. 6 B. 7 C. 10 D. None of these

65. A 8-bit signed integer has the following range?


A. 0 to 255 B. -128 to 127 C. -255 to 254 D.
0 to 509

66. Pankaj makes a program to print the product of cubes of the first 10 whole numbers
She writes the following program:
integer x = 0 // statement 1
integer sum = 0 // statement 2
while ( x < 10 ) // statement 3
{
sum = x*x*x // statement 4
x = x + 1 // statement 5
}
print sum // statement 6
Is her program correct? If not, which statement will you modify to correct it?
A. No error, the program is correct B. Statement 1 C. Statement 4 D.
statement 6

67. Here is an infix notation: ((A+B)*C-(D-E))^(F+G) Choose the correct postfix notation of
the above from the given options?
A. AB+CD*E–FG+^ B. AB+C*DE–FG+^ C. AB+C*DE-FG-+^ D. A+BC*DE-FG-
+^

68. One of the following options is a form of access used to add and remove nodes from a
queue.
A. LIFO B. FIFO C. Both LIFO and FIFO D. None of these

44. What is the time complexity of adding three matrices of size NXN cell-by-cell?
A. O (N) B. O (N^2) C. O (N^3) D. None of these

69. What is the output of the pseudocode statements given below?

(Note: Assume that when two data types are processed through an operator, the answer maintains the same data
type as that of the input. Also, all data types have enough range to accommodate any number. If two different data
types are operated upon, the result assumes the data type that is more expressive.)

integer a=984, b=10


//float is a data type to store real numbers.
float c
c=a/b
print c
A. 984
B. 98.4
C. 98
D. Error

70.What will be the output generated when the given code is executed?A pseudo- code is used which is self
explanatory.

function main()
{
integer a=5
switch(a)
{
default: print “hello”
case 5: print “How are you?”
break

}
A. hello
B. How are you
C. HelloHow are you?
D. This code will generate a compile time error
71. A language has 28 different letters in total. Each word in the language consists of a maximum of 7 letters. A
programmer wants to create a data type to store a word of this language. She decides to store the word as an array
of letters. How many bits should she assign to the data type to store all kinds of words of the language?
A. 7
B. 35
C. 28
D. 196
72. How can the largest number in a list of twenty numbers be found?
A. Use bubble sort to sort the list in a descending order and the print the first number of the series
B. Use selection sort to sort the list in a descending order and the print the first number of the series
C. Implement one iteration of selection sort for descending order and print the first number in the
series
D. None of the above

73. A programmer writes an efficient program to sum two square diagonal matrices (matrices with elements
only on the diagonal positions). The size of each matrix is nXn. What is the time complexity of the algorithm?

A. O(n2)

B. O(n)

C. O(n*log(n))

D. None of the above

74. How many nodes does a full binary tree with “n” leaves contain?
A. 2n + 1 nodes
B. log2n nodes
C. 2n – 1 nodes
D. 2n nodes

74. Refer to the pseudocode given in the ‘Passage’. The code is similar to that in C++ and is self-explanatory. An
accessible member function and a data member for an object are accessed by the statements objectname.
functionname andobjectname. datamembername, respectively. Which statement should be deleted from the code
to rectify the error in it ?
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4

75. The following values are to be stored in a hash Table-15,22,41,19,102,18,37


Using the division method of hashing with a table size of 10 (use sequential method of resolving collision),give the
contents of Hash Table.
A. 41,22,102,15,37,18,19,Null, Null, Null
B. Null, Null, Null,41,22,102,15,37,18,19
C. 41,22,102,15,37,18,19
D. Null,41,22,102,Null, 15,Null, 37,18,19

76. Consider the code given below. How many times will “Hello” be printed if m<n and exactly one of (m,n) is
even?

fori= m to n increment 2

{ print “Hello!” }

A. (n – m + 1)/2

B. 1 + (n –m)/2

C. 1 + (n – m)/2 if m is even, (n – m + 1)/2 if m is odd

D. (n – m + 1 )/2 if m is even,1 + (n – m )/2 if m is odd

COMPUTER PROGRAMMING

Choose the correct answer.


1.Q) What will the output of the following pseudo code statements be?
(Note: Assume that when two data types are processed through an operator, the answer maintains
the same data type as that of the input. Also, all data types have enough range to accommodate any
number. If two different data types are operated upon, the result assumes the data type that is more
expressive.)
Integer a = 456, b, c, d = 10
b = a/d
c=a–b
print c
A. 410
B. 410.4
C. 411.4
D. 411
Choose the correct answer.
2.Q) The function given below takes a number “n” as the input and calculates the sum of first “n”
natural numbers. Which of the following statements should be inserted in place of “??” to get the
required output?
function sum(n)
{
if (??)
return 1
else
return (n + sum(n-1))
end
}
A. n equals 1
B. n equals 2
C. n>= 1
D. n>1
Choose the correct answer.
3.Q) Which of the following implies that there are two loops that are nested?
A. Two loops, one after the other
B. Two loops, one inside the other
C. One loop with two different iteration counts
D. Two loop with the same iteration count

Choose the correct answer.


Passage
function main()
{
static integer abc = 5
print abc—
if ( abc )
main() // calling main function
}
Choose the correct answer:
A pseudo-code is used which is self explanatory.
// in pseudo code refers to comment
4.Q) What will be the output of the given code?
A. 43210
B. 54321
C. This code will enter an infinite loop
D. This code will generate an error
Choose the correct answer.
5.Q) The function given below takes an even integer “n” as the input and calculates the sum of first
“n” even natural numbers. The function is called by the statement “sum (30)”. How many times will
the function “sum” be called to compute the sum?
function sum(n)
{
if (n equals 2)
return 2
else
return (n + sum(n-2)
end
}
A. 1
B. 30
C. 15
D. 16
Passage
Class rocket
{
private:
integer height, weight
public: \\statement 1
function input a, int b)
{
height = a;
weight = b;
}
}
function main( )
{
Rocket rocket1, rocket2
}
Choose the correct answer.
6.Q) Refer to the pseudocode given in the ‘Passage’. The code is similar to that in C++ and is
self-explanatory. An accessible member Funcction and a data member for an object are
accessed by the statements objectname. Functionname and objectname. Datamemnername,
respectively.
What can be inferred from this code?
A. “rocket” is a class with “rocket1” and “rocket2” as its objects, with “height” and
“weight” as its attributes.
B. “rocket” is a class with “rocket1” and “rocket2” as its objects, with “height” and
“weight” as its objects.
C. “rocket” is a class with “rocket1” and “rocket2”, “height” and “weight” as its attributes.
D. “rocket” is a class with “rocket1” and “rocket2”, “height” and “weight” as its objects.
Choose the correct answer.
7.Q) In which of the following situations can a constructor be invoked?
A. When an object is created
B. When an object is assigned the value 0
C. Only at the end of the code
D. When the scope of the object is over
Choose the correct answer.
8.Q) What will happen if some indentations are made in some statements of a code written in
C++?
A. Faster execution of the code
B. Lower memory requirement for the code
C. Correction of errors in the code
D. Better readability of the code.
Choose the correct answer.
9.Q) In an implementation of a linked list, each node contains data and address. Which of the
following can the address field possibly contain?
A. Address of the next node in sequence
B. Its own address
C. Address of the last node
D. Address of the first node
Choose the correct answer.
10.Q) Consider the structure of a queue as given below –
FRONT = 2, REAR = 4
Queue: _, L, M, N, _
What will be the values of FRONT and REAR respectively after the insertion of an element ‘Q’
in the given queue?
A. 1,4
B. 2,5
C. 1,5
D. 2,4

Choose the correct answer.


12.Q) Which of the following can be inherited by a derived class from a base class?
A. Data members
A. Member functions
B. Constructors and destructors
C. Data members and member functions
Choose the correct answer.
13.Q) A programmer wants the program given below to print the largest number out of three
numbers entered by the user.
int number1, number 2, number 3, temp;
input number 1, number 2, number 3;
if (number1>number2)
temp = number 1
else
temp = number 2
end if
if (??) // Statement 1
temp = number 3
end if
print temp
Which of the following should be substituted in place of “??” in Statement 1 in the code?
A. number3> number2
B. number3> temp
C. number3> temp
D. number3> number1
Choose the correct answer.
14.Q) Which of the given function prototypes can be considered to be overloaded (no ambiguity)?
A. function my Func(integer Num, float me) // does not return anything
B. function my Func(integer Num, double me) // does not return anything
C. function my Func(character Num, float me) // does not return anything
D. function my Func(integer Num, float me) // return an integer
Passage
function moify(y,z)
{
y = y + 1;
z = z + 1;
return y – z
}
function calculate ( )
{
integer a = 5, b = 10, c
c = modify (a, b);
print a
print space
print c
{
15.Q) Consider the code given in the ‘Passage’. Assume that “a” and “b” are passed by value. What
will the output of the program be when the function clculate () is executed?
A. 11 -5
B. 10 -5
C. 6 -5
D. 5 -5
Passage
function preordertraverse(node)
{
print node value
if (condition x)
{ preoedertraverse(node left)}
if condition y)
{ preordertraverse(node right)}
return
}
Choose the correct answer.
16.Q) Consider a binary tree implementation. The root address is stored in the vatiable root. The
address of a node is given in the variable node. The value of the node and its right and left child
nodes can be accessed usina the statements given below.
node value,
node right,
node left.
A programmer writes the function given in the ‘Passage’ to do a preorder traversal of the tree.
What are Condition X and Condition Y ?
A. Condition X: node left isnotequal
Condition Y: node right isnotequal
B. Condition X: node right isnotequal
Condition Y: node left isnotequal
C. Condition X: node left isequal
Condition Y: node right isequal
D. Condition X: node right isequal
Condition Y: node left isequal
Choose the correct answer.
17. Q) The following operations are performed on an empity R “A”.
PUSH( 1)
PUSH (2)
POP
PUSH(5)
PUSH(6)
POP
What will the stack contain after these operations?
(Note: The top of the stack is underlined in the options below.)
A. 5 6
B. 1 5
C. 5 6
D. 1 5
Choose the correct answer.
18.Q) How may nodes does a full binary tree with “n” non-leaf nodes contain?
A. log n
B. n + 1
C. 2n + 1
D. 2n
Choose the correct answer.
19.Q) A programmer mistakenly writes “gor” instead of the keyword “for” used in loops. While
writing a program in C++. What will this result in ?
A. The code would not compile.
B. The code would give an error while execution.
C. The code may work for some inputs and not for the others.
D. The code would not create any problem.
Choose the correct answer.
20.Q) Every element of a data structure has an address and a key associated with it. A search
mechanism deals with two or more values assigned to the same address by using the key. What is
this search mechanism?
A. Linear search
B. Binary search
C. Hash coded search
D. None of the above
Choose the correct answer.
21.Q) Which of the following abstract data types can be used to represent a many-to-many relation?
A. Tree
B. Stack
C. Graph
D. Queue
Choose the correct answer.
22.Q) Why is an algorithm designer concerned primarily about the run time and not the compile
time while calculating time complexity of an algorithm?
A. Run time is always more than the compile time.
B. Compile time is always more than the 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.
Passage
Function main()
{
Automatic variable var
Print var
}
Choose the correct answer.
A pseudo-code is used which is self explanatory.
23.Q) What will be the output generated when the given code is executed?
A. 0
B. 1
C. Garbage Value
D. This code will generate a compile time error
Choose the correct answer.
24. Q) In which of the following methods is sorting NOT possible?
A. Insertion
B. Selection
C. Exchange
D. Deletion
Choose the correct answer.
25.Q) Which of the following algorithm design techniques is used in the quick sort algorithm?
A. Dynamic programming
B. Back tracking
C. Divide and conquer
D. Greedy search
Choose the correct answer.
26.Q) A programmer is making a database of animals in a zoo along with their properties. The possible
animals are dog, lion and zebra. Each one has attributes as herbivorous, color and nocturnal. The
programmer uses the object- oriented programming parasigm for this. How will the system be
conceptualized?
A. Class: Animal; objects: lion and zebra; data members: herbivorous, color and nocturnal
B. Class: Animal; objects: herbivorous, color and nocturnal; data members: dog, lion and zebra
C. Classes: dog, lion and zebra; objects: Animal;data members: herbivorous, color and nocturnal
D. None of the above
Choose the correct answer.
27.Q) The program to print the sum of all cubes that lie between 0 and 100 is given below. Does
this program have an error? If yes, which statement should be modified to correct the program?
integer i = 0,a // Statement 1
integer sum = 0;
a = (i * i * i)
while (1<100) // Statement 2
{
sum = sum + a // Statement 3
i=i+1
a = (i * i * i ) // Statement 4
}
Print sum
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
E. No error
Choose the correct answer.
28.Q) What is the output of the pseudocode statements given below?
(Note: Assume that when two data types are processed through an operator, the answer
maintains the same data type as that of the input. Also, all data types have enough range to
accommodate any number. If two different data types are operated upon, the result assumes the
data type that is ore expressive.)
integer a = 984, b=10
//float is a data type to store real numbers.
float c
c=a/b
print c
A. 984
B. 98.4
C. 98
D. Error
Choose the correct answer.
29.Q) Code a contains a set of eight lines that occur ten times in different points of the program.
This code is passed to a programmer who puts the set of eight lines in a function definition and
calls them at the ten points in the program. Assume this new code to be Code B. Which code will
run faster using an interpreter?
A. Code A
B. Code B
C. Both the codes would run at the same speed
D. None of the above
Passage
function MyFunc 1(integer n)
{
return n*2
}
function MyFunc2(integer n)
{
print “The value is “ n
}
Choose the correct answer.
A pseudo-code is used is used which is self explanatory.
30.Q) Which of the given two functions can be categorized as procedure?
A. My Func 1
B. My Func 2
C. Both MyFunc1 and MyFun2
D. A function cannot be a procedure
Choose the correct answer.
31.Q) Which of the following statements is TRUE about a breadth first search?
A. Beginning from a node, all the adjacent nodes are traversed first
B. Beginning from a node, each adjacent node is fully explored before traversing the next
adjacent node
C. Beginning from a node, the nodes are traversed in cyclic order
D. None of the above
Choose the correct answer.
32.Q) How does inheritance relate to abstraction?
A. A base class is an abstraction of all its derived classes.
B. A derived class is an abstraction of all its base classes.
C. Base and derived classes are abstractions of each other.
D. Inheritance prevents abstraction.
Choose the correct answer.
33.Q) Consider the code given below. How many times will “Hello” be printed if m<n and exactly
one of (m,n) is even?
For i= m to n increment 2
{ print “Hello!”}
A. (n – m + 1)/2
B. 1 + (n – m)/2
C. 1 + (n – m )/2 if m is even, (n – m + 1)/2 if m is odd
D. (n – m + 1)/2 if m is even, 1 + (n – m )/2 if m is odd
Choose the correct answer.
34.Q) A data type is stored as a 6-bit signed integer. Which of the following cannot be represented
by this data type?
A. -12
B. 0
C. 32
D. 18
Choose the correct answer.
35.Q) Consider the code given below. Assume that “a” and “b” are passed by reference. What will
the output of the program be when the unction calculate() is executed?
function modify(b,a)
{
return a – b
}
function calculate ()
{
Integer a = 5, b = 12, c
c = modify(a,b);
print c
}
A. 7
B. -7
C. 8
D. Error
Fill in the blank
36.Q) Each bucket in a Hash Table is the head of ______________.
A. A Heap
B. A Stack
C. An Array
D. A Queue
Choose the correct answer.
37.Q) A programmer implements a queue as a singly-linked list. He queue has “n” elements. What
will be the time complexity to ADD an element to the queue?
A. O(1)
B. O(log2n)
C. O(n)
D. O(n log2n)
passage
class entity
{
private:
integer a,b
public:
integer c
function entity () {a= 0; b=0}
function compare ( )
{if (a>b) return 1;
return 0
}
}
function main( )
{
entityn black
int value 2 = 5
value = black. compare() // Statement 1
black.c = value02 // Statement2
print black a // Statement 3
38.Q) Refer to the pseudocode given in the ‘Passage’. The code is similar to that in C++ and is self-
explanatory. An accessible member function and a data member for an object are accessed by the
statements objectname. functionname and objectname. datamemnername, respectively. Identify
the statement with an error.
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
E. None of the above
Choose the correct answer.
39.Q) What is the maximum number of edges in an undirected graph with “n” vertices?
A. n*(n-1)/2
B. n*(n+1)/2
C. n*n
D. 2*n
Choose the correct answer.
40.Q)What will be returned if f(a,b) is called in the following functions?
function g(int n)
{
if (n>0) return 1;
else return -1;
}
function f(int a, int b)
{
if (a>b) return g(a-b);
if (a<b) return g(-b+a);
return 0;
}
A. Always +1
B. 1 if a>b, -1 if a<b, 0 otherwise
C. -1 if a>b, -1 if a<b, 0 otherwise
D. 0 if a equals b, -1 otherwise
Choose the correct answer.
41.Q) In the execution process of a program, this technoque involves the intermediate
representation to be compiled to native machine code at runtime. What is the name of this
technique?
A. Static compilation
B. Run time interpretation
C. Static interpretation
D. Just in time compilation
42.Q)Choose the correct answer.
A sorting mechanism uses the binary tree concept such that any number in the tree is larger than
all the numbers in the sub-tree below it. What is this method called?
A. Selection sort
B. Insertion sort
C. Heap sort
D. Quick sort
Choose the correct answer.
43. Q) The following operations are performed on an empty stack “A”.
PUSH( 1)
PUSH (2)
POP
PUSH(5)
PUSH(6)
POP
What will the stack contain after these operations?
(Note: The top of the stack is underlined in the options below.)
E. 5 6
F. 1 5
G. 5 6
H. 1 5
Choose the correct answer.
44.Q) What will happen if some indentations are made in some statements of a code written in
C++?
A. Faster execution of the code
B. Lower memory requirement for the code
C. Correction of errors in the code
D. Better readability of the code

Choose the correct answer.


45.Q) Which of the following abstract data types can be used to represent a many-to-many
relation?
A. Tree
B. Stack
C. Graph
D. Queue
Choose the correct answer.
46.Q) A librarian has to rearrange the library books on a shelf in a proper order at the end of each
day. Which of the following sorting techniques should be the librarian’s ideal choice?
A. Bubble sort
B. Insertion sort
C. Selection sort
D. Heap sort
Choose the correct answer.
47.Q)Tricha needs to store a list of binary data. Which of the following data types should she use?
A. Integer
B. Float
C. Character
D. Boolean
Choose the correct answer.
48.Q) A programmer writes an efficient program to add two upper triangular 10X10 matrices with
the elements on the diagonals retained. How many total additions will the program make?
A. 100
B. 55
C. 25
D. 10
Choose the correct answer.
49.Q) A problem to be solved is broken into a sequence of smaller sub-problems until a stage
where the sub-problem can be easlved. What is this design approach called?
A. Top-Down approach
B. Bottom-Up approach
C. Procedural programming
D. None of the above
Choose the correct answer.
50.Q)Consider an array on which bubble sort is used. To which of the following elements will the
bubble sort compare the element A[X] with, in a single iteration?
A. A[x + 1]
B. A[x + 2]
C. A[x + 2x]
D. All of the above
Choose the correct answer.
51.Q) A programmer is making a daaase of animais in a zoo along with their properties. The possible
animals are dog, lion and zebra. Each one has attributes herbivors, colorand nocturnal. The programmer
uses the object-oriented programming paradigm for this. How will the system be conceptualized?
A. Class: Animal; objects: dog, lion and zebra; data members: herbivorous, color and nocturnal
B. Class: Animal; objects: herbivorous, color and nocturnal; data members: dog, lion and zebra
C. Class: dog, lion and zebra; objects: Animal; data members: herbivorous, color and nocturnal
D. None of the above
Choose the correct answer.
52.Q) A programmer writes a program to find an element in the array A[5] with the elements: 8:30
40 45 70. The program is run to find a number “X”, that is found in the first iteration of binary
search. What is the value of “X”?
A. 40
B. 8
C. 70
D. 30
Choose the correct answer.
53.Q) A stack is implemented as a linear array A[0…N-1]. A programmer writes the function given
below to pop out an element from the stack.
function POP( top,N )
{
if (X)
{
top = top -1
}
else
{
print”Underflow”
}
return top
}
Which of the following should substitute the condition “X”?
A. top<N-1
B. top<N
C. top>1
D. top>=0
Choose the correct answer.
54.Q) What is the difference between a function and a method?
A. Function is a named code unlike method which is a part of an object
B. Function contained in an object is called a method
C. Function cannot change variables outside its scope unlike method
D. There is no difference between the two
Choose the correct answer.
55.Q) Which of the following is the lowest level format to which the computer converts a program
in a higher language before execution?
A. English code
B. Machine code
C. Assembly language
D. System language
Passage
class brush
{
private:
integer size, c
rcode
function getdata( ) { …. }// Statement 1
public:
integer name // Statement 2
function putdata( ) { …. }
}
function main
{
brush b1, b2
print b1.name //Statement 3
b2.getdata( ) //Statement 4
}
Choose the correct answer.
56.Q) Refer to the pseudocode given in the ‘Passage’. The code is similar to that in C++ and is self-
explanatory. An accessible member Funcction and a data member for an object are accessed by
the statements objectname. Functionname and objectname. Datamemnername, respectively.
Which statement should be deleted from the code to rectify the error in it?
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
Choose the correct answer.
57.Q) A developer writes the program given below to print the sum of the squares of the first five
whole numbers(0…4). Is the program correct? If not, which statement should be modified to
correct the program?
integer i = 0 // Statement 1
integer sum = 0 // Statement 2
while (i<5) // Statement 3
{
sum = i*i // Statement 4
i = i + 1 // Statement 5
}
print sum // statement 6
A. No error, the program is correct
B. Statement 1
C. Statement 4
D. Statement 6
Choose the correct answer.
58.Q) The program to print the sum of all cubes that lie between 0 and 100 is given below. Does
this program have an error? If yes, which statement should be modified to correct the program?
integer i = 0, a // Statement 1
integer sum = 0;
a = (i * i *i)
while (i<100) // Statement 2
{
sum = sum + a // Statement 3
i=i+1
a = (i * i * i) // Statement 4
}
print sum
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
E. No error
Passage
integer i = 1 // Statement 1
while (i<= 3 )
{
int j // Statement 2
while ( j<= i ) // Statement 3
{
print j
print blank space
j = j + 1 // Statement 4
}
print end-of-line //takes the cursor to the next line
i=i+1
}
Choose the correct answer.
59.Q) A programmer writes the program given in the ‘Passage’ to print the following pattern on
the screen:
1
12
123
Will this program function properly? If not, which statement should be modified?
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
E. This program will function properly
Choose the correct answer.
60.Q) What is the output of the program given below?
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
}
A. 0
03
B. 0 3
036
C. 0
036
Choose the correct answer.
61.Q) An Array MyArr with 10 rows and 15 columns is stored in a row major fashion in the
memory. Given that the starting address of MyArr is 1000 and each element’s size is 1, find the
address of MyArr[6][11]. (Assume the lower bounds on columns and rows of this Array as 1 and 1
respectively)
A. 1105
B. 1060
C. 1160
D. 1085
Choose the correct answer.
62.Q) What is implied by the argument of a function?
A. The variables passed to the function when it is called
B. The value that the function returns on execution
C. The execution code inside function
D. Return type of the function
Choose the correct answer.
63.Q) How many nodes a full binary tree with “n” leaves contain?
A. 2n + 1 nodes
B. log2n nodes
C. 2n – 1 nodes
D. 2n nodes
Choose the correct answer.
64.Q)A sorting mechanism uses the binary tree concept such that any number in the tree is larger
than all the numbers in the sub-tree below it. What is this method called?
A. Selection sort
B. Insertion sort
C. Heap sort
D. Quick sort
Choose the correct answer.
65.Q) Preeti writes a program in low level language, now she wants to translate it into a higher
language without rewriting the program. What another program she must use for this purpose?
A. Compiler
B. Decompiler
C. Interpreter
D. Executer
E. Cross compiler
Choose the correct answer.
66.Q)A programmer prepares a questionnaire with “true or false” type of questions. He wants to
define a data type that stores the responses of the candidates for the questions. Which of the
following is the most suited data type for this purpose?
A. Integer
B. Boolean
C. Float
D. Character
Choose the correct answer.
67.Q) Which of the following is NOT a data type?
A. Integer
B. Character
C. Boolean
D. Array
Choose the correct answer.
68.Q)What is the maximum number of edges in an undirected graph with “n” vertices?
A. n*(n-1)/2
B. n*(n+1)/2
C. n*n
D. 2*n
Choose the correct answer.
69.Q)Which of the following data structures may produce an overflow error even though the
current number of elements in it lower than its size?
A. A queue implemented in a linear array
B. A queue implemented in a circularly connected array
C. A stack implemented in a linear array
D. None of the above
Choose the correct answer.
70.Q) X and Y are asked to write a program to sum the rows of a 2X2 matrix stored in an array A.
X writes the code (Code A) as follows:
For n = 0 to 1
sumRow1 [n] = A[n][1] + A[n][2]
end
Y writes the code (Code b) as follows:
Sum Row1[0] =A[0][1] + A[0][2]
Sum Row1[1] = A[1][1] + A[1][2]
Which of the following statements is correct about these codes if no loop unrolling is done by the
compiler?
A. Code A would execute faster than Code B.
B. Code B would execute faster than Code A.
C. Code A is logically incorrect.
D. Code B is logically incorrect.
Choose the correct answer.
71.Q)A programmer tries to debug a code of 10,000 lines. It is known that there is a logical error in
the first 25 lines of the code. Which of the following is an efficient way to debug the code?
A. Compile the entire code and check it line by line.
B. Use an interpreter on the first 25lines of code.
C. Compile the entire code and run it.
D. None of the above can be used to debug the code.
Choose the correct answer.
72.Q) For the given list of numbers, how many awaps will take place in Bubble Sort so that the list
becomes sorted?
(Assume that the list is being sorted in ascending order)
List 23, 56, 78, 3, 11, 65
A. 4
B. 5
C. 6
D. 7
Choose the correct answer.
73.Q) Which of the following sorting algorithms yields approximately the same worst-case and
average-case running time behavior in O(n logn)?
A. Bubble sort and Selection sort
B. Heap sort and Merge sort
C. Quick sort and Radix sort
D. Tree sort and Median-of-3 Quick sort
Choose the correct answer.
74.Q) A programmer writes a sorting algorithm that takes different of time to sort two different
lists of equal size. What is the possible difference between the two lists?
A. All numbers in one list are more than 100 while in the other are less than 100.
B. The ordering of numbers with respect to the magnitude in the two lists has different
properties.
C. One list has all negative numbers while the other has all positive numbers.
D. One list contains 0 as an element while the other does not.
Choose the correct answer.
75Q) A programmer is making a dase of animais in a zoo along with their properties. The possible animals
are dog, lion and zebra. Each one has attributes herbivors, colorand nocturnal. The programmer uses the
object-oriented programming paradigm for this. How will the system be conceptualized?
E. Class: Animal; objects: dog, lion and zebra; data members: herbivorous, color and nocturnal
F. Class: Animal; objects: herbivorous, color and nocturnal; data members: dog, lion and zebra
G. Class: dog, lion and zebra; objects: Animal; data members: herbivorous, color and nocturnal
H. None of the above
Choose the correct answer.
76Q) Which of the following gives the maximum number of nodes at level :I’ of a binary tree?
(Note: The root is at level 1.)
A. 2I-1
B. 3I-1
C. 2I
D. 2I -1
Passage
Integer num 1, num2
Input num1, num2
Integer k=0, final=num1
//missing statements
Print final
Choose the correct answer:
A pseudo-code is used which is self explanatory.
//in pseudo code refers to comment
77.Q)Reema wanted to multiply two numbers but the * key of her keyboard is broken. She
decides to write the program without using * operator. She writes the given code, where some
statements are missing.
What should be the missing statements in the given code?
A. While(k++ < num1)
final+=num1
B. While(k++ < num2-1)
final+=num1
C. While(k++ < num2)
final+=num1
D. While(k++ < num2)
final+=num2
Choose the correct answer.
78Q) The program to print the sum of all cubes that lie between 0 and 100 is given below. Does
this program have an error? If yes, which statement should be modified to correct the program?
integer i = 0,a // Statement 1
integer sum = 0;
a = (i * i * i)
while (1<100) // Statement 2
{
sum = sum + a // Statement 3
i=i+1
a = (i * i * i ) // Statement 4
}
printsum
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
E. No error
Choose the correct answer.
79.Q) For which of the following is the stack implementation useful?
A. Radix search
B. Breadth first search
C. Recursion
D. None of the above
Choose the correct answer.
80Q) A developer writes the program given below to print the sum of the squares of the first five
whole numbers(0…4). Is the program correct? If not, which statement should be modified to
correct the program?
integer i = 0 // Statement 1
integer sum = 0 // Statement 2
while (i<5) // Statement 3
{
sum = i*i // Statement 4
i = i + 1 // Statement 5
}
print sum // statement 6
A. No error, the program is correct
B. Statement 1
C. Statement 4
D. Statement 6
Choose the correct answer.
81.Q) Which of the following data structures may produce an overflow error even though the
current number of elements in it lower than its size?
E. A queue implemented in a linear array
F. A queue implemented in a circularly connected array
G. A stack implemented in a linear array
H. None of the above
Choose the correct answer.
82.Q)Which tree (s) from the given figure is/are Heap(s)?
A. Only 1
B. Only 2
C. Only 3
D. Both 1 and 2
E. Both 1 and 3
83.Q) What will be returned if f (a,b) is called in the following functions?
Function g (int n)
{
If (n>0)return 1;
Else return -1;
}
Function f(int a, int b)
{
If (a>b) return g(a-b)
If (a<b) return g(-b+a);
Return 0;
}
A. Always + 1
B. 1 if a>b, -1 if a<b, 0 otherwise
C. -1 if a >b, 1if a<b, 0 otherwise
D. 0 if a equals b, -1 otherwise
Passage
class entity
{
private:
integer a,b
public:
integer c
function entity () {a= 0; b=0}
function compare ( )
{if (a>b) return 1;
return 0
}
}
function main( )
{
entityn black
int value 2 = 5
value = black. compare() // Statement 1
black.c = value02 // Statement2
print black a // Statement 3
84.Q) Refer to the pseudocode given in the ‘Passage’. The code is similar to that in C++ and is self-
explanatory. An accessible member function and a data member for an object are accessed by the
statements objectname. functionname and objectname. datamemnername, respectively. Identify
the statement with an error.
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
E. None of the above
Choose the correct answer.
Passage
function modify(y,z)
{
y = y + 1;
z = z + 1;
return y – z
}
function calculate ( )
{
integer a = 5, b = 10, c
c = modify (a, b);
print a
print space
pirnt c
{
85.Q) Consider the code given in the ‘Passage’. Assume that “a” and “b” are passed by value. What
will the output of the program be when the function calculate () is executed?
A. 11 -5
B. 10 -5
C. 6 -5
D. 5 -5
Choose the correct answer.
86.Q) A programmer wants the program given below to print the largest number out of three
numbers entered by the user.
int number1, number 2, number 3, temp;
input number 1, number 2, number 3;
if (number1>number2)
temp = number 1
else
temd = number 2
end if
if (??) // Statement 1
temp = number 3
end if
print temp
Which of the following should be substituted in place of “??” in Statement 1 in the code?
A. number3> number2
B. number3> temp
C. number3> temp
D. number3> number1
Choose the correct answer.
87.Q) Which of the following options is not an instance of exponential complexities?
A. O(nn)
B. O(2n)
C. O(n!)
D. O(n3)
Choose the correct answer.
88.Q) A programmer prepares a questionnaire with “true or false” type of questions. He wants o
define a data type that stores the responses of the candidates for the questions. Which of the
following is the most suited data type for this purpose?
A. Integer
B. Boolean
C. Float
D. character
Choose the correct answer.
89.Q)A sorting mechanism uses the binary tree concept such that any number in the tree is larger
than all the numbers in the sub-tree belowit. What is this method called?
E. Selection sort
F. Insertion sort
G. Heap sort
H. Quick sort
Choose the correct answer.
90.Q) Which of the following can be inherited by a derived class from a base class?
A. Data members
B. Member functions
C. Constructors and destructors
D. Data members and member functions
Choose the correct answer.
91.Q) A sorting algorithm traverses through a list, comparing adjacent elements and switching
them under certain conditions. What is this sorting algorithm called?
A. Insertion sort
B. Heap sort
C. Quick sort
D. Bubble sort
Choose the correct answer.
92.Q) How many nodes does a full tree with “n” non-leaf nodes contain?
A. log n
B. n + 1
C. 2n + 1
D. 2n
Choose the correct answer.
93.Q) Why is an algorithm designer concerned primarily about the ren time and not the compile
time while calculating time complexity of an algorithm?
A. Run time is always more than the compile time.
B. Compile time is always more than the 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.
Choose the correct answer.
94.Q)A complete binary tree has a property that the value at each node is at least as large as the
values at its children nodes What is this binary tree known as ?
A. Binary Search Tree
B. AVL Tree
C. Completely Balanced Tree
D. Heap
Choose the correct answer.
95.Q) A librarian has to rearrange the library books on a shelf in a proper order at the end of each
day. Which of the following sorting techniques should be the librarian’s ideal choice?
A. Bubble sort
B. Insertion sort
C. Selection sort
D. Heap sort
Choose the correct answer.
96.Q) What will be the input to the second pass, if the list before starting the Radix Sort is: 729,
150, 123, 931, 348, 517?
A. 150, 123, 348, 517, 729, 931
B. 150, 931, 123, 517, 348, 729
C. 517, 729, 123, 931, 348, 150
D. 123, 150, 348, 517, 729, 931
Choose the correct answer.
97.Q) A programmer writes an efficient program to sum two square diagonal matrices (matrices
with elements only on the diagonal positions). The size of each matrix is nXn. What is the time
complexity of the algorithm?
A. Ɵ(n2)
B. Ɵ(n)
C. Ɵ(n*log(n))
D. None of the above
Choose the correct answer.
98.Q) For which of the following is the stack implementation useful?
A. Radix search
B. Breadth first search
C. Recursion
D. None of the above
Passage
class brush
{
private:
integer size, c
rcode
function getdata( ) { …. }// Statement 1
public:
integer name // Statement 2
function putdata( ) { …. }
}
function main
{
brush b1, b2
print b1.name //Statement 3
b2.getdata( ) //Statement 4
}
Choose the correct answer.
99.Q) Refer to the pseudocode given in the ‘Passage’. The code is similar to that in C++ and is self-
explanatory. An accessible member Function and a data member for an object are accessed by the
statements objectname. Functionname and objectname. datamembername, respectively. Which
statement should be deleted from the code to rectify the error in it?
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
Choose the correct answer.
100.Q) What will happen if some indentations are made in some statements of a code written in
C++?
A. Faster execution of the code
B. Lower memory requirement for the code
C. Correction of errors in the code
D. Better readability of the code
Choose the correct answer.
101.Q) Which of the following implies that there are two loops that are nested?
A. Two loops, one after the other
B. Two loops, one inside the other
C. One loop with two different iteration counts
D. Two loop with the same iteration count
Passage
Integer MyVar1=5
Function main().
{
Integer MyVar1=9
Print MyVar1
Print//missing code
}
Choose the correct answer:
A pseudo-code is used which is self explanatory.
// in pseudo code refers to comment
102.Q) Assuming that main() is the starting point of execution of program, which of the following
options should replace the //missing code so as to print the value of global MyVar1 (value = 5)?
A. MyVar1.MyVar1
B. MyVar1[0]
C. ::MyVar1
D. No local variable should have the same name as the global variable
Choose the correct answer.
103.Q) Assume the following precedence (high to low). Operators in the same row have the same
precedence.
( )
*/
+ -
AND
OR
The precedence is from left left to right in the expression for the operators with equal precedence.
Which of the following statements is TRUE about the output of the code statements given below?
integer a = 40, b = 35, c = 20, d = 10
print a *b / c – d
print a * b / (c – d)
A. The outputs differ by 80.
B. The outputs the same.
C. The outputs differ by 50.
D. The outputs differ by 160.
Choose the correct answer.
104.Q)In an implementation of a linked list, each node contains data and address. Which of the
following can the address field possibly contain?
A. Address of the next node in sequence
B. Its own address
C. Address of the last node
D. Address of the first node
Choose the correct answer.
105.Q) A programmer prepares a questionnaire with “true or false “ type of questions. He wants
to define a data type that stores the responses if the candidates for the questions. Which of the
following is the most suited data type for this purpose?
A. Integer
B. Boolean
C. Float
D. Character
Choose the correct answer.
106.Q) Which of the following properties states that any given key is equally likely to hash any of
the slots available in a Hash Table?
A. Uniform Hashing
B. Simple Uniform Hashing
C. Optimal Hashing
D. Minimal Hashing
Choose the correct answer.
107.Q)A programmer writes a program to find an element in the array A[5] with the elements: 8
30 40 45 70. The program is run to find a number “X”, that is found in the first iteration of binary
search. What is the value of “X”?
A. 40
B. 8
C. 70
D. 30
Choose the correct answer.
108.Q) A developer writes the program given below to print the sum of the squares of the first five
whole numbers(0…4). Is the program correct? If not, which statement should be modified to
correct the program?
integer i = 0 // Statement 1
integer sum = 0 // Statement 2
while (i<5) // Statement 3
{
sum = i*i // Statement 4
i = i + 1 // Statement 5
}
print sum // statement 6
A. No error, the program is correct
B. Statement 1
C. Statement 4
D. Statement 6
Passage
function modify (y,z)
{
y=y+1
z=z+1
return y - z
}
function calculate( )
{
integer na = 5, b = 10, c
c = modify (a,b);
print a
print space
print c
}
Choose the correct answer.
109.Q) Consider the code given in the ‘Passage”. Assume that “a” and ”b” are passed by value.
What will the output of the program be when the function calculate() is executed?
A. 11 – 5
B. 10 -5
C. 6 -5
D. 5 -5
Choose the correct answer.
110.Q) How can the largest number in a list of twenty numbers be found?
A. Use bubble sort to sort the list in a descending order and then print the first number of the
series
B. Use selection sort to sort the list in a descending order and then print the first number of
the series
C. Implement one iteration of selection sort for descending order and print the first number
in the series
D. None of the above
Choose the correct answer.
111.Q) A programmer wants the program given below to print the largest number out of three
numbers entered by the user.
int number1, number2, number3, temp;
input number1, number2, number3;
if (number1> number2)
temp = number1
else
temp = number2
end if
if (??) // statement 1
temp = number3
end if
print temp
Which of the following should be substituted in place of “?” in Statement 1 in the code?
A. number3> number2
B. number3> temp
C. number3<temp
D. number3> number1
Choose the correct answer.
112.Q) Which of the following options is not an instance of exponential complexities?
A. O(nn)
B. O(2n)
C. O(n!)
D. O(n3)
Choose the correct answer.
113.Q) A sorting algorithm traverses through a list, comparing adjacent elements and switching
them under certain conditions. What is this sorting algorithm called?
A. Insertion sort
B. Heap sort
C. Quick sort
D. Bubble sort
Choose the correct answer.
114.Q) Which of the following can be inherited by a derived class from a base class?
A. Data members
B. Member functions
C. Constructors and destructors
D. Data members and member functions
Choose the correct answer.
115.Q) The following operations are performed on an empty stack “A”.
PUSH( 1)
PUSH (2)
POP
PUSH(5)
PUSH(6)
POP
What will the stack contain after these operations?
(Note: The top of the stack is underlined in the options below.)
A. 5 6
B. 1 5
C. 5 6
D. 1 5
Choose the correct answer.
116.Q)Which of the following best describes the space complexity of a 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 for the program to run
D. Amount of memory required for the program to compile
Choose the correct answer.
117.Q) Which of the following members of a class cannot be inherited?
A. Public
B. Private
C. Private and Protected
D. Protected
Choose the correct answer.
118Q) How many nodes does a full tree with “n” non-leaf nodes contain?
A. log n
B. n + 1
C. 2n + 1
D. 2n
Choose the correct answer.
119.Q) For the given list of numbers, how many swaps will take place in Bubble Sort so that the list
becomes sorted?
(Assume that the list is being sorted in ascending order)
List 23, 56, 78, 3, 11, 65
A. 4
B. 5
C. 6
D. 7
Choose the correct answer.
120.Q) A programmer mistakenly writes “gor” instead of the keyword “for” used in loops, while
writing a program in C++. What will this result in?
A. The code would not compile.
B. The code would give an error while execution.
C. The code may work for some inputs and not for the others.
D. The code would not create any problem.
Choose the correct answer.
121.Q)Which of the following data structures may produce an overflow error even though the
current number of elements in it is lowers than its size?
A. A queue implemented in a linear array
B. A queue implemented in a circularly connected array
C. A stack implemented in a linear array
D. None of the above
Choose the correct answer.
122.Q) Which of the following sorting algorithms yields approximately the same worst-case and
average-case running time behavior in O (n logn)?
A. Bubble sort and Selection sort
B. Heap sort and merge sort
C. Quick sort and radix sort
D. Tree sort and median- of-3 Quick sort
PAPER - II
Choose the correct answer.
123Q) For which of the following is the stack implementation useful?
E. Radix search
F. Breadth first search
G. Recursion
H. None of the above
Passage
class brush
{
private:
integer size, c
rcode
function getdata( ) { …. }// Statement 1
public:
integer name // Statement 2
function putdata( ) { …. }
}
function main
{
brush b1, b2
print b1.name //Statement 3
b2.getdata( ) //Statement 4
}
Choose the correct answer.
124Q) Refer to the pseudocode given in the ‘Passage’. The code is similar to that in C++ and is self-
explanatory. An accessible member Function and a data member for an object are accessed by the
statements objectname. Functionname and objectname. datamembername, respectively. Which
statement should be deleted from the code to rectify the error in it?
E. Statement 1
F. Statement 2
G. Statement 3
H. Statement 4
Choose the correct answer.
125Q) What will happen if some indentations are made in some statements of a code written in
C++?
E. Faster execution of the code
F. Lower memory requirement for the code
G. Correction of errors in the code
H. Better readability of the code
Choose the correct answer.
126.Q) Which of the following implies that there are two loops that are nested?
E. Two loops, one after the other
F. Two loops, one inside the other
G. One loop with two different iteration counts
H. Two loop with the same iteration count
Passage
Integer MyVar1=5
Function main().
{
Integer MyVar1=9
Print MyVar1
Print//missing code
}
Choose the correct answer:
A pseudo-code is used which is self explanatory.
// in pseudo code refers to comment
127.Q) Assuming that main() is the starting point of execution of program, which of the following
options should replace the //missing code so as to print the value of global MyVar1 (value = 5)?
E. MyVar1.MyVar1
F. MyVar1[0]
G. ::MyVar1
H. No local variable should have the same name as the global variable
Choose the correct answer.
128.Q) Assume the following precedence (high to low). Operators in the same row have the same
precedence.
( )
*/
+ -
AND
OR
The precedence is from left left to right in the expression for the operators with equal precedence.
Which of the following statements is TRUE about the output of the code statements given below?
integer a = 40, b = 35, c = 20, d = 10
print a *b / c – d
print a * b / (c – d)
A. The outputs differ by 80.
B. The outputs the same.
C. The outputs differ by 50.
D. The outputs differ by 160.
Choose the correct answer.
129.Q)In an implementation of a linked list, each node contains data and address. Which of the
following can the address field possibly contain?
A. Address of the next node in sequence
B. Its own address
C. Address of the last node
D. Address of the first node
Choose the correct answer.
130.Q) A programmer prepares a questionnaire with “true or false “ type of questions. He wants
to define a data type that stores the responses if the candidates for the questions. Which of the
following is the most suited data type for this purpose?
A. Integer
B. Boolean
C. Float
D. Character
Choose the correct answer.
131.Q) Which of the following properties states that any given key is equally likely to hash any of
the slots available in a Hash Table?
A. Uniform Hashing
B. Simple Uniform Hashing
C. Optimal Hashing
D. Minimal Hashing
Choose the correct answer.
132.Q)A programmer writes a program to find an element in the array A[5] with the elements: 8
30 40 45 70. The program is run to find a number “X”, that is found in the first iteration of binary
search. What is the value of “X”?
A. 40
B. 8
C. 70
D. 30
Choose the correct answer.
133.Q) A developer writes the program given below to print the sum of the squares of the first five
whole numbers(0…4). Is the program correct? If not, which statement should be modified to
correct the program?
integer i = 0 // Statement 1
integer sum = 0 // Statement 2
while (i<5) // Statement 3
{
sum = i*i // Statement 4
i = i + 1 // Statement 5
}
print sum // statement 6
A. No error, the program is correct
B. Statement 1
C. Statement 4
D. Statement 6
Passage
function modify (y,z)
{
y=y+1
z=z+1
return y - z
}
function calculate( )
{
integer na = 5, b = 10, c
c = modify (a,b);
print a
print space
print c
}
Choose the correct answer.
134.Q) Consider the code given in the ‘Passage”. Assume that “a” and ”b” are passed by value.
What will the output of the program be when the function calculate() is executed?
A. 11 – 5
B. 10 -5
C. 6 -5
D. 5 -5
Choose the correct answer.
135Q) How can the largest number in a list of twenty numbers be found?
A. Use bubble sort to sort the list in a descending order and then print the first
number of the series
B. Use selection sort to sort the list in a descending order and then print the first
number of the series
C. Implement one iteration of selection sort for descending order and print the first
number in the series
D. None of the above
Choose the correct answer.
136.Q) A programmer wants the program given below to print the largest number out of three
numbers entered by the user.
int number1, number2, number3, temp;
input number1, number2, number3;
if (number1> number2)
temp = number1
else
temp = number2
end if
if (??) // statement 1
temp = number3
end if
print temp
137.Q)Which of the following should be substituted in place of “?” in Statement 1 in the code?
A. number3> number2
B. number3> temp
C. number3<temp
D. number3> number1
Choose the correct answer.
138.Q) Which of the following options is not an instance of exponential complexities?
A. O(nn)
B. O(2n)
C. O(n!)
D. O(n3)
Choose the correct answer.
139.Q) A sorting algorithm traverses through a list, comparing adjacent elements and switching
them under certain conditions. What is this sorting algorithm called?
A. Insertion sort
B. Heap sort
C. Quick sort
D. Bubble sort
Choose the correct answer.
140.Q) Which of the following can be inherited by a derived class from a base class?
A. Data members
B. Member functions
C. Constructors and destructors
D. Data members and member functions
Choose the correct answer.
Q) The following operations are performed on an empty stack “A”.
PUSH( 1)
PUSH (2)
POP
PUSH(5)
PUSH(6)
POP
141.Q)What will the stack contain after these operations?
(Note: The top of the stack is underlined in the options below.)
A. 5 6
B. 1 5
C. 5 6
D. 1 5
Choose the correct answer.
142.Q)Which of the following best describes the space complexity of a 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 for the program to run
D. Amount of memory required for the program to compile
Choose the correct answer.
143Q) Which of the following members of a class cannot be inherited?
A. Public
B. Private
C. Private and Protected
D. Protected
Choose the correct answer.
144.Q) How many nodes does a full tree with “n” non-leaf nodes contain?
A. log n
B. n + 1
C. 2n + 1
D. 2n
Choose the correct answer.
145.Q) For the given list of numbers, how many swaps will take place in Bubble Sort so that the list
becomes sorted?
(Assume that the list is being sorted in ascending order)
List 23, 56, 78, 3, 11, 65
A. 4
B. 5
C. 6
D. 7
Choose the correct answer.
146.Q) A programmer mistakenly writes “gor” instead of the keyword “for” used in loops, while
writing a program in C++. What will this result in?
A. The code would not compile.
B. The code would give an error while execution.
C. The code may work for some inputs and not for the others.
D. The code would not create any problem.
Choose the correct answer.
147.Q)Which of the following data structures may produce an overflow error even though the
current number of elements in it is lowers than its size?
A. A queue implemented in a linear array
B. A queue implemented in a circularly connected array
C. A stack implemented in a linear array
D. None of the above
Choose the correct answer.
148.Q) Which of the following sorting algorithms yields approximately the same worst-case and
average-case running time behavior in O (n logn)?
A. Bubble sort and Selection sort
B. Heap sort and merge sort
C. Quick sort and radix sort
D. Tree sort and median- of-3 Quick sort

Fill in the blanks


149.Q) _________ returns a value unlike _____________.
A. Procedure, Subroutine
B. Procedure, Function
C. Function, Method
D. Function, Procedure
Choose the correct answer.
150.Q) How can a call to an overloaded function be ambiguous?
A. The name of the function might have been misspelled
B. There might be two or more functions with the same name
C. There might be two or more functions with equality appropriate signature
D. None of the above
Choose the correct answer.
151.Q) In har graph, Yelena has included 10 nodes. Which of the following options will help her
know if there exists a path between node 4 and node 9?
A. Best First Search
B. Topological Sort
C. Eulerian Tour
D. Floyd-Warshall’s algorthm
Choose the correct answer
152.Q) Nalanda wants to implement Virtual Functions. Which of the following options will she
have to follow in order to bring out the same?
A. Dynamic Dispatching
B. Static Dispatching
C. Static Binding
D. Anonymous Class
Choose the correct answer
153.Q) What does the following function do?
Function operation ( int a, Int b)
{
If (a>b)
{return operation(b, a)}
Else
{return a;}
}
A. Always returns the first parameter
B. Returns the min of (a,b)
C. Returns the max of (a, b)
D. Loops forever
Choose the correct answer
154.Q) Which of the following abstract data types can be used to represent a many-to-many
relation?
A. Tree
B. Stack
C. Graph
D. Queue
Choose the correct answer.
155.Q) Which of the following sorting techniques has the worst case functioning time less than
O(n*n)?
A. Heap Sort
B. Quick Sort
C. Insertion Sort
D. Selection Sort
Choose the correct answer.
156.Q) A stack is implemented as a linear array A[0…N-1]. A programmer writes the function give below to
pop our an element from the stack.
function pop(top,n)
{
if (x)
{
top = top – 1
}
else
{
return top
}
Which of the following should substitute the condition "X"?
A. top<n-1
B. top<n
C. top>1
D. top>=0
Passage
function main ()
{
integer a=5, b=7
switch(a)
{
case 5:print”i am 5”
break
case b:print”i am not 5”
break
default: print “i am different”
}
}
157.Choose the correct answer:
A pseudo-code is used which is self explanatory.
Q) What will be the output generated when the given code is executed?
A. I am 5
B. I am not 5
C. Iam different
D. This code will generate an error
Passage.

Choose the correct answer:


158.Q) What will be the Postorder traversal of the given Binary tree?
A. DCIHFBGEA
B. DEBIFHAEG
C. DCIFBGEA
D. ABCDFIHGE
Choose the correct answer:
159.Q)A sorting mechanism uses the concept such that any number in the tree is larger than all the
numbers in the sub-below it. What is this method called?
A. Selection sort
B. Insertion sort
C. Heap sort
D. Quick sort
Choose the correct answer:
160.Q) Which of the following items may or may not have its methods' implementations?
A. Interface
B. Abstract Class
C. Generic Class
D. Anonymous Class
Choose the correct answer:
161.Q)In an implementation of a linked list, each node contains data and address. Which of the
following can the address field possibly contain?
A. Address of the next node in sequence
B. Its own address
C. Address of the last node
D. Address of the fist node
Choose the correct answer
162.Q) The function given below computes the factorial of the number “n” entered by a user. What
should be the “MISSING STATEMEN” in order to make the code work properly?
Function factorial(n)
{
If (n equals 1)
Return 1
Else
--MISSING STATEMENT –
End
}
A. return factorial(n-1)
B. return n*factorial(n)
C. return n*(n-1)
D. return n*factorial(n-1)
Choose the correct answer.
163.Q) Two programmers X and Y are asked to write a code to evaluate the following expression:
a – b + c/(a-b) + (a-b)2
x writes the following code statements (code a):
print (a-b) + c/(a-b) + (a-b)*(a-b)
y wites the following code statements (code b):
b = (a-b)
print d + c/d + d*d
Which of the following is TRUE if the time taken to load a value in a variable for addition,
multiplication or division between two operands is the same?
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.
Fill in the blank
164.Q) Merge Sort requires O(n) space when implemented using ____________ .
A. Array
B. Linked List
C. Both Array and Linked List
D. Merge Sort can be implemented using constant space irrespective of the implementing data
structure
Choose the correct answer
165.Q)A programmer writes a sorting algorithm that takes different amount of time to sort two
different lists of equal size. What is the possible difference between the two lists?

A. All numbers in one list are more than 100 while in the other are less than 100.
B. The ordering of numbers with respect to the magnitude in the two lists has different
properties.
C. One list has all negative numbers while the other has all positive numbers.
D. One list contains 0 as an element while the other does not.

Choose the correct answer.


166.Q) A function in the base class is redefined in the inherited class. What is the term used to describe this
situation?
A. Inheritance
B. Overriding
C. Overloading
D. Encapsulation
Choose the correct answer.
167.Q)A programmer writes a program to find an element in the array A[5] with the elements: 8 30 40 45
70. The program is run to find a number “X”, that is found in the first iteration of binary search. What is the
value of “X” ?
A. 40
B. 8
C. 70
D. 30
Choose the correct answer.
168.Q)How can a call to an overloaded function be ambiguous?
A. The name of the function might have been misspelled
B. There might be two or more functions with the same name
C. There might be two or more functions with equality appropriate signature
D. None of the above
Choose the correct answer.
169.Q) Assuming that main() is the starting point of execution of program, which of the following options
should replace the //missing code so as to print the value of global MyVar1 (value = 5)?
A. MyVar1.MyVar1
B. MyVar1[0]
C. ::MyVar1
D. No local variable should have the same name as the global variable
170Q) A developer writes the program given below to print the sum of the squares of the first five whole
numbers(0…4). Is the program correct? If not, which statement should be modified to correct the program?
integer i = 0 // Statement 1
integer sum = 0 // Statement 2
while (i<5) // Statement 3
{
sum = i*i // Statement 4
i = i + 1 // Statement 5
}
print sum // statement 6
A. No error, the program is correct
B. Statement 1
C. Statement 4
D. Statement 6
Choose the correct answer.
171.Q)Which of the following is the lowest level format to which the computer converts a program in a
higher language before execution?
A. English code
B. Machine code
C. Assembly language
D. System language
Passage
integer i = 1 // Statement 1
while (i<= 3 )
{
int j // Statement 2
while ( j<= i ) // Statement 3
{
print j
print blank space
j = j + 1 // Statement 4
}
print end-of-line //takes the cursor to the next line
i=i+1
}
Choose the correct answer.
172.Q) A programmer writes the program given in the ‘Passage’ to print the following pattern on the
screen:
1
12
123
Will this program function properly? If not, which statement should be modified?
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
E. This program will function properly
Choose the correct answer.
173.Q) How many nodes a full binary tree with “n” leaves contain?
A. 2n + 1 nodes
B. log2n nodes
C. 2n – 1 nodes
D. 2n nodes
Choose the correct answer.
174.Q) The program to print the sum of all cubes that lie between 0 and 100 is given below. Does this
program have an error? If yes, which statement should be modified to correct the program?
integer i = 0,a // Statement 1
integer sum = 0;
a = (i * i * i)
while (1<100) // Statement 2
{
sum = sum + a // Statement 3
i=i+1
a = (i * i * i ) // Statement 4
}
printsum
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
E. No error
Choose the correct answer.
175.Q) Assuming that the given varien variables have their usual meanings, which of the following options
refer to an empty Linked List?
A. HEAD->NEXT = NULL
B. HEAD= NULL
C. HEAD->PREV = NULL
D. HEAD->NEXT ->NEXT= NULL
E. HEAD->NEXT = HEAD->PREV
Choose the correct answer.
176.Q) What will be returned if f (a,b) is called in the following functions?
Function g (int n)
{
If (n>0)return 1;
Else return -1;
}
Function f(int a, int b)
{
If (a>b) return g(a-b)
If (a<b) retun g(-b+a);
Return 0;
}
A. Always + 1
B. 1 if a>b, -1 if a<b, 0 otherwise
C. -1 if a >b, 1if a<b, 0 otherwise
D. 0 if a equals b, -1 otherwise
Passage
function modify(y,z)
{
y = y + 1;
z = z + 1;
return y – z
}
function calculate ( )
{
integer a = 5, b = 10, c
c = modify (a, b);
print a
print space
print c
{
Choose the correct answer.
177.Q) Consider the code given in the ‘Passage’. Assume that “a” and “b” are passed by value. What will the
output of the program be when the function calculate () is executed?
A. 11 -5
B. 10 -5
C. 6 -5
D. 5 -5
Choose the correct answer.
178.Q) Yukta created an interface to use it in different parts of the program by implementing it. But she
forgot to specify the access specifier for each contained method. What will be the access specifier of the
methods that will be inherited/implemented?
A. Public
B. Private
C. Protected
D. An error will be generated
Choose the correct answer.
179.Q)A sorting mrchanism uses the binary tree concept such that any number in the tree is larger than all
the numbers in the sub-tree below it. What is this method called?
A. Selection sort
B. Insertion sort
C. Heap sort
D. Quick sort
Choose the correct answer.
180.Q)A programmer prepares a questionnaire with “true or false” type of questions.He wants to define a
data type that stores the responses of the candidates for the questions. Which of the following is the most
suited data type for this purpose?
A. Integer
B. Boolean
C. Float
D. Character
Choose the correct answer.
181.Q) Which of the following is NOT a data type?
A. Integer
B. Character
C. Boolean
D. Array
Choose the correct answer.
182.Q) What is the minimum number of stacks of size "n" required to implement a queue of size "n"?
A. 1
B. 2
C. 3
D. 4
Choose the correct answer.
183.Q)What is the maximum number of edges in an undirected graph with “n” vertices?
A. n*(n-1)/2
B. n*(n+1)/2
C. n*n
D. 2*n
Choose the correct answer.
184.Q) A programmer mistakenly writes “gor” instead of the keyword “for” used in loops. While writing a
program in C++. What will this result in ?
A. The code would not compile.
B. The code would give an error while execution.
C. The code may work for some inputs and not for the others.
D. The code would not create any problem.
Choose the correct answer
185.Q) In an implementation of a linked list, each node contains data and address. Which of the following
can the address field possibly contain?
A. Address of the next node in sequence
B. Its own address
C. Address of the last node
D. Address of the first node
E. Choose the correct answer.
186.Q) Which of the following options is an exception to being a part of composite data types?
A. Union
B. Array
C. Structure
D. Stack
Choose the correct answer.
187.Q) Why is an algorithm designer concerned primarily about the run time and not the compile time while
calculating time complexity of an algorithm?
A. Run time is always more than the compile time.
B. Compile time is always more than the 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.
Choose the correct answer.
188.Q) Which of the following sorting algorithms yields approximately the same worst-case and average-
case running time behavior in O(n logn)?
A. Bubble sort and Selection sort
B. Heap sort and Merge sort
C. Quick sort and Radix sort
D. Tree sort and Median-of-3 Quick sort
Choose the correct answer.
189.Q) A librarian has to rearrange the library books on a shelf in a proper order at the end of each day.
Which of the following sorting techniques should be the librarian’s ideal choice?
A. Bubble sort
B. Insertion sort
C. Selection sort
D. Heap sort

1. How can a call to an overloaded function be ambiguous?


A. The name of the function might have been misspelled
B. There might be two or more functions with the same name
C. There might be two or more functions with equality appropriate signature
D. None of the above
2. A programmer is making a database of animals in a zoo along with their properties. The possible
animals are dog, lion and zebra. Each one has attributes as herbivorous, color and nocturnal. The
programmer uses the object-oriented programming paradigm for this. How will the system be
conceptualized?
A. class: Animal; objects: dog, lion and zebra; data members: herbivorous, color and nocturnal
B. class: Animal: objects: herbivorous, color and nocturnal; data members: dog, lion and zebra
C. classes: dog, lion and zebra; objects: Animal; data members: herbivorous, color and
nocturnal
D. None of the above
3. Which of the following is the lowest level format to which the computer converts a program in a
higher language before execution?
A. English code
B. Machine code
C. Assembly language
D. System language
4. Passage
function mybinarysearch(array arr, integer low, integer high, integer item)
{
If( low>high)
{
Return -1
}
Integer mid = (low + high)/2
If ( arr [mid] equals item )
{
Return mid
}
Else if( arr [mid] > item )
{
Return // missing statement 1
}
Else
{
Return // missing statement 2
}
}
Harshul uses the given code to implement binary search recursively. Find the statement that will
replace missing statement 2 in the given code such that it works efficiently.
A. Mybinarysearch (arr, mid+1, high, item )
B. Mybinarysearch (arr, low+1, mid-1, item )
C. Mybinarysearch (arr, low, mid-1, item )
D. Mybinarysearch (arr, mid+1, high-1, item )
5. Which of the following implies that there are two loops that are nested?
A. Two loops, one after the other
B. Two loops, one inside the other
C. One loops with two different iteration counts
D. Two loops with the same iteration count
6. A programmer writes a code snippet in which a set of three lines occurs ten times in different parts
of the program. What programming concept should be used to shorten the code length?
A. For loops
B. Functions
C. Arrays
D. Classes
7. In an implementation of a linked list, each node contains data and address. Which of the following
can the address field possibly contain?
A. Address of the next node in sequence
B. Its own address
C. Address of the last node
D. Address of the first node
8. Assume the following precedence (high to low). Operators in the same row have the same
precedence.
() */ + - AND OR
The precedence is from left to right in the expression for the operators with equal precedence.
Which of the following statements is TRUE about the output of the code statements given below?
Integer a = 40, b = 35, c = 20, d = 10
Print a*b/c-d
print a * b / (c - d)
A. The outputs differ by 80.
B. The outputs are the same.
C. The outputs differ by 50.
D. The outputs differ by 160.
9. What is the output of the program given below?
Integer i=0, j
While (j<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
}
A. 03 036
B. 03 036 0369
C. 036 0369 036912
D. 0 03

10. what is the degree of the three shown in the figure?

A. 1
B. 3
C. 4
D. 5
11. A programmer prepares a questionnaire with “true or false” type of questions. He wants to define
a data type that stores the response of the candidates for the questions. Which of the following is
the most suited data type for this purpose?
A. Integer
B. Boolean
C. Float
D. character
12. A programmer wants the program given below to print the largest number out of three numbers
entered by the user.
int number!, number 2, number3, temp;
input number!, number2, number3;
if (number1>number2)
temp = number1
else
temp = number2
end if
if (??) // Statement 1
temp = number3
end if
print temp
Which of the following should be substituted in place of "??" in Statement 1 in the code?
A. number3>number2
B. number3>temp
C. number3<temp
D. none of the above
13. a function in the base class is redefined in the inherited class. What is the term used to describe
this situation?
A. Inheritance
B. Overriding
C. Overloading
D. Encapsulation
14. What will be returned if f(a,b) is called in the following functions?
function g(int n)
{
if (n>0) return 1;
else
return -1;
}
function f(int a, int b)
{
if (a>b) return g(a-b);
if (a<b) return g(-b+a);
return 0;
}
A. Always +1
B. if a>b, -1 if a<b, 0 otherwise
C. -1 if a>b, 1 if a<b. 0 otherwise
D. if a equals b, -1 otherwise
15. which of the following options is not an instance of exponential complexities?
A. O(nn)
B. O(2n)
C. O(n!)
D. O(n3)
16. A programmer writes a program to find an element in the array A[5] with the elements: 8 30 40
45 70. The program is run to find a number “X”, that is found in the first iteration of binary search.
What is the value of “X” ?
A. 40
B. 8
C. 70
D. 30
17. A programmer writes a program to find an element in the array A[5] with the elements: 8 30 40 45
70. The program is run to find a number "X", that is found in the first iteration of binary search.
What is the value of "X"?
A. 40
B. 3 8
C. 70
D. 30
18. Which of the following gives the maximum number of nodes at level “I” of a binary tree?
2I-1
3I-1
2I
2I-1
19. The program to print the sum of all cubes that lie between 0 and 100 is given below. Does this
program have an error? If yes, which statement should be modified to correct the program?
integer i = 0, a // Statement 1
integer sum = 0;
a =(i*i*i)
while (i<100) // Statement 2
{
sum = sum + a // Statement 3
i=i+1
a = (i*i*i) // Statement 4
}
print sum
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
20. Aparajita wants to make a function that is not bound to any identifier. Which of the following
functions should she incorporate in her program?
A. Anonymous function
B. Friend function
C. Null function
D. Global function
21. How can the largest number in a list of twenty numbers be found?
A. Use bubble sort to sort the list in a descending order and then print the first number of the
series
B. Use selection sort to sort the list in a descending order and then print the first number of
the series
C. Implement one iteration of selection sort for descending order and print the first number
in the series
D. None of the above
22. A programmer writes an efficient program to sum two square diagonal matrices (matrices with
elements only on the diagonal positions). The size of each matrix is nXn. What is the time
complexity of the algorithm?
A. Ɵ (n)
B. Ɵ (n)
C. Ɵ (n*log(n))
D. None of the above
23. How can a call to an overloaded function be ambiguous?
A. The name of the function might have been misspelled
B. There might be two or more functions with the same name
C. There might be two or more functions with equally appropriate signatures
D. None of the above
24. Which of the following statements is TRUE about a breadth first search?
A. Beginning from a node, all the adjacent nodes are traversed first
B. Beginning from a node, each adjacent node is fully explored before traversing the next
adjacent node
C. Beginning from a node, the nodes are traversed in cyclic order
D. None of the above
25. What is the time taken to insert an element at position k(1<k<n) in an Array with n elements?
A. (n-k)
B. (k)
C. (n)
D. (1)
26. Code A contains a set of eight lines that occur ten times in different points of the program. This
code is passed to a programmer who puts the set of eight lines in a function definition and calls
them at the ten points in the program. Assume this new code to be Code B. Which code will run
faster using an interpreter?
A. Code A
B. Code B
C. Both the codes would run at the same speed
D. None of the above
27. A complete binary tree has a property that the value at each node is at least as large as the values
at its children nodes. What is this binary tree known as?
A. Binary search tree
B. AVL tree
C. Completely balanced tree
D. Heap
28. A function in the base class is redefined in the inherited class. What is the term used to describe
this situation?
A. Inheritance
B. Overriding
C. Overloading
D. Encapsulation
29. What will be returned if f(a,b) is called in the following functions?
function g(int n)
{
if (n>0) return 1;
else
return -1;
}
function f(int a, int b)
{
if (a>b) return g(a-b);
if (a<b) return g(b-a);
return 0;
}
A. if a>b, -1 if a<b, 0 otherwise
B. Always +1
C. None of the above
30. Which of the following terms is given to the errors that do not stop the execution but yield wrong
results and happen due to the misunderstanding of the program?
A. Logical error
B. Syntax error
C. Semantic error
D. Latent error
31. The function given below takes an even integer "n" as the input and calculates the sum of first "n"
even natural numbers. The function is called by the statement "sum(30)". How many times will the
function "sum" be called to compute the sum?
function sum(n)
{
if (n equals 2)
return 2
else
return(n + sum(n-2))
end
}
A. 1
B. 30
C. 15
D. 16
32. Which of the following is the lowest level format to which the computer converts a program in a
program in a higher language before execution?
A. English code
B. Machine code
C. Assembly language
D. System language
33. Passage
class rocket
{
private:
integer height. Weight
public: // Statement 1
function input( int a, int b)
{
height = a;
weight =b
}
}
function main ( )
{
rocket rocket1, rocket2
}
Refer to the pseudocode given in the 'Passage'. The code is similar to that in C++ and is self-
explanatory. An accessible member function and a data member for an object are accessed by the
statements objectname.functionname and objectname.datamembername, respectively. What can
be inferred from this code?
A. "rocket" is a class with "rocket1'' and "rocket2" as its objects, with "height" and "weight" as
its attributes.
B. "rocket" is a class with "rocket1”' and "rocket2" as its objects, with "height" and "weight"
as its objects.
C. "rocket" is a class with "rocket1’' , "rocket2" ,”height” and “weight” as its attributes.
D. “rocket” is a class with “rocket1”,"rocket2", "height" and "weight" as its objects.
34. For the given array, find the arrangement of elements after 3rd pass of selection Sort. Assume that
the array is being sorted in ascending order. List 33, 22, 11, 77, 66, 88, 55
A. 22, 11, 33, 66, 77, 55, 88
B. 11, 22, 33, 55, 66, 77, 88
C. 11, 22, 33, 55, 66, 88, 77
D. 11, 22, 33, 77, 66, 88, 55
35. A programmer prepares a questionnaire with “true or false” type of questions. He wants to define
a data type that stores the responses of the candidates for the questions. Which of the following is
the most suited data type for this purpose?
A. Integer
B. Boolean
C. Float
D. Character
36. X and Y are asked to write a program to sum the rows of a 2X2 matrix stored in an array A.
X writes the code (Code A) as follows:
for n = 0 to 1
sumRow1[n] = A[n][1] + A[n][2]
end
Y writes the code (Code B) as follows:
sumRow1[0] = A[0][1] + A[0][2]
sumRow1[1] = A[1][1] + A[1][2]
Which of the following statements is correct about these codes if no loop unrolling is done by the
compiler?
A. Code A would execute faster than Code B.
B. Code B would execute faster than Code A.
C. Code A is logically incorrect.
D. Code B is logically incorrect.
37. A librarian has to rearrange the library books on a shelf in a proper order at the end of each day.
Which of the following sorting techniques should be the librarian’s ideal choice?
A. Bubble sort
B. Insertion sort
C. Selection sort
D. Heap sort
38. A programmer writes a sorting algorithm that takes different amount of time to sort two different
lists of equal size. What is the possible difference between the two lists?
E. All numbers in one list are more than 100 while in the other are less than 100.
F. The ordering of numbers with respect to the magnitude in the two lists has different
properties.
G. One list has all negative numbers while the other has all positive numbers.
H. One list contains 0 as an element while the other does not.

PART-2
39. Passage

Integer I, k, j, n=5
for i =n to 1 decrement 1
{
for j=n to j+1 decrement 1
{
Print blank space
}
for k=1 to ((2*i)-1) increment 1
{
Print “*”
}
Print end-of-line //takes the cursor to the next line
}
What will be the output when the given code is executed?
A. *****
****
***
**
*
B. *****
****
***
**
*
C. *****
****
*****
****
*****
40. How many nodes does a full binary tree with “n” leaves contain?
A. 2n+ 1 nodes
B. Log2n nodes
C. 2n-1 nodes
D. 2n nodes
41. Passage
Class brush
{
Private:
Integer size, c
rcode
function getdata () {……..} //statement 1
public :
integer name // statement 2
function putdata() {…….}
}
function main
{
Brush b1, b2
Print b1.name //statement 3
B2. Getdata() // statement 4
}
Refer to the pseudocode given in the ‘passage’. The code is similar to that in C++ and is self-
explanatory. An accessible member function and a data member for an object are accessed by the
statements. Objectname.functionname and objectname.datamembername, respectively. Which
statement should be deleted from the code to rectify the error in it?
A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
42. How many nodes in a tree with n nodes have no ancestors?
A. 0
B. 1
C. 2
D. Log n
43. A function in the base class is redefined in the inherited class. What is the term used to describe
this situation?
A. Inheritance
B. Overriding
C. Overloading
D. Encapsulation
44. The function given below takes a number “n” as the input and calculates the sum of first “n”
natural numbers. Which of the following statements should be inserted in place of “??” to get the
required output?
Function sum(n)
{
If (??)
Return 1
Else
Return (n+sum(n-1))
End
}
A. n equals 1
B. n equals 2
C. n>=1
D. n>1
45. the following operations are performed on an empty stack “A”
PUSH(1)
PUSH(2)
POP
PUSH(5)
PUSH(6)
POP
What will the stack contain after these operations?
A. 5 6
B. 1 5
C. 5 6
D. 1 5
46. In an implementation of a linked list each node contains data and address. Which of the following
can the address field possibly contain?
A. Address of the next node in sequence
B. Its own address
C. Address of the last node
D. Address of the first node
47. Which of the following accessibility modes can be the specifier of a top level class?
1. Private 2. Protected 3. Public 4. No modifier
A. Only 3
B. Only 4
C. Both 1 and 3
D. Both 2 and 3
E. Both 3 and 4
48. Which of the following implies that there are two loops that are nested?
A. Two loops, one after the other
B. Two loops, one inside the other
C. One loop with two different iteration counts
D. Two loops with the same iteration count
49. Which of the following best describes the space complexity of a 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 for the program to run
D. Amount of memory required for the program to compile
50. Every element of a data structure has an address and a key associated with it. A search mechanism
deals with two or more values assigned to the same address by using the key. What is this search
mechanism?
A. Linear search
B. Binary search
C. Hash coded search
D. None of the above
51. Why is an algorithm designer concerned primarily about the run time and not the compile time
while calculating time complexity of an algorithm?
A. Run time is always more than the compile time.
B. Compile time is always more than the 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.
52. A programmer tries to debug a code of 10,000 lines. It is known that there is a logical error in the
first 25 lines of the code. Which of the following is an efficient way to debug the code?
A. Compile the entire code and check it line by line
B. Use an interpreter on the first 25 lines of code.
C. Compile the entire code and run it.
D. None of the above can be used to debug the code.
53. In which of the following methods is sorting NOT possible?
A. Insertion
B. Selection
C. Exchange
D. deletion
54. Passage

Function MyDisplay (string MyStr ) //Statement 1

Print “Hello !”

Print MyStr

Return 1 //Statement 2

Function main() //statement 3

String str = “mickey”

MyDisplay (str ) //Statement 4

Consider the given code to print a name on the screen. Which statement will generate an error?

A. Statement 1
B. Statement 2
C. Statement 3
D. Statement 4
E. This code will run without any error
55. How can a call to an overloading function be ambiguous?
A. The name of the function might have been misspelled
B. There might be two or more functions with the same name
C. There might be two or more functions with equally appropriate signatures
D. None of the above
56. What is implied by the argument of a function?
A. The variable passed to the function when it is called
B. The value that the function returns on execution
C. The execution code inside the function
D. Return type of the function
57. Passage
Function preordertraverse(node)
{
Print nodevalue
If (Condition X)
{
Preordertraverse(node left)
}
If (condition Y)
{
Preordertraverse(noderight)
}
Return
}
Consider a binary tree implementation. The root address is stored in the variable root. The address
of a node is given in the variable node. The value of the node and its right and left child nodes can
be accessed using the statements given below.
Node value
Node right
Node left
A programmer writes the function given in the ‘passage’ to do a preorder traversal of the tree.
What are condition X and Condition Y?
A. Condition X: nodeleft is notequal
Condition Y: noderight is notequal

B. Condition X:noderight is notequal


Condition Y: node  left is noteqaul
58. Consider the given declarations-
integer (*arr1)[10]
integer rarr2[10]
Which of the following statements is true regarding the above?
A. Arr1 is pointer to an array of integers arr2 is array of integer pointers
B. Arr1 and arr2 both are pointers to array of integers
C. Arr1 and arr2 both are arrays of integer pointers
D. Arr1 is array of integer pointers arr2 is pointer to an array of integers
59. Which of the following implies that there are two loops that are nested?
A. Two loops, one after the other
B. Two loops, one inside the other
C. One loop with two different iteration counts
D. Two loops with the same iteration count
60. In which of the following situations can a constructor be invoked?
A. When an object is created
B. When an object is assigned the value 0
C. Only at the end of the code
D. When the scope of the object is over
61. A programmer prepares a questionnaire with “true or false” type of questions. He wants to define
a data type that stores the response of the candidates for the questions. Which of the following is
the following is the most suited data type for this purpose?
A. Integer
B. Boolean
C. Float
D. Character
62. In Object Oriented Programming, there should never be more than one reason for a class to
change. There should be only one reason for the existence of the class. Which of the following
principles states the same?
A. Unique responsibility reason
B. Single reason principle
C. Single responsibility principle
D. Unique reason principle
63. The following operations are performed on an empty stack "A":
PUSH(1)
PUSH(2)
POP
PUSH(5)
PUSH(6)
POP
What will the stack contain after these operations? (Note: The top of the stack is underlined in the
options below)
A. 5 6
B. 1 5
C. 5 6
D. 1 5
64. Which of the following sorting techniques has its best case performance done in (n log n) steps?
A. Insertion sort
B. Bubble sort
C. Selection sort
D. Merge sort
65. Why is an algorithm designer concerned primarily about the run time and not the compile time
while calculating time complexity of an algorithm?
A. Run time is always more than the compile time.
B. Compile time is always more than the 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.
66. Consider an array on which bubble sort is used. To which of the following elements will the bubble
sort compare the element A[x] with, in a single iteration?
A. A[x+1]
B. A[x=2]
C. A[x+2x]
D. All of the above
67. Passage
Function modify(y,z)
{
Y=y+1;
Z=z+1;
Return y-z
}
Function calculate ()
{
Integer a=5, b=10, c
C= modify (a,b);
Print a
Print space
Print c
}
Consider the code given in the ‘passage’. Assume that “a” and “b” are passed by value. What will
the output of the program be when the function calculate() is executed?
A. 11 -5
B. 10 -5
C. 6 -5
D. 5 -5
68. Consider the structure of a queue as given below –
FRONT = 2 , REAR = 4 Queue: _, L, M, N, _
What will be the values of FRONT and REAR respectively after the insertion of an element ‘Q’ in the
given queue?
A. 1, 4
B. 2, 5
C. 1, 5
D. 2, 4
69. Which of the following implies that there are two loops that are nested?
A. Two loops, one after the other
B. Two loops, one inside the other
C. One loop with two different iteration counts
D. Two loops with the same iteration count
70. In an implementation of a linked list, each node contains data and address. Which of the following
can the address field possibly contain?
A. Address of the next node in sequence
B. Its own address
C. Address of the last node
D. Address of the first node
71. Which of the following statements is TRUE about a variable?
A. A variable cannot be used before it is declared
B. A variable cannot be used after it is declared
C. A variable cannot be used in the function it is declared in.
D. A variable can always be used.
72. Which of the following can be inherited by a derived class from a base class?
A. Data members
B. Member functions
C. Constructors and destructors
D. Data members and member functions
73. The function given below computes the factorial of the number "n" entered by a user. What should
be the "MISSING STATEMENT" in order to make the code work properly?
function factorial(n)
{
if (n equals 1)
return 1
else
-- MISSING STATEMENT –
end
}
A. return factorial(n-1)
B. return n*factorial(n) C)
C. return n*(n-1)
D. return n*factorial(n-1)
74. An integer “X” is saved as an unsigned 8-bit number 00001011. What is X?
A. 22
B. 11
C. 10
D. None of the above
75. In object oriented programming, there should never be more than one reason for a class to change.
There should be only one reason for the existence of the class. Which of the following principles
states the same?
A. Unique responsibility reason
B. Single reason principle
C. Single responsibility principle
D. Unique reason principle
76. Every element of a data structure has an address and a key associated with it. A search mechanism
deals with two or more values assigned to the same address by using the key. What is this search
mechanism?
A. Linear search
B. Binary search
C. Hash coded search
D. None of the above
77. How many nodes does a complete binary tree with 5 levels have, if the root is considered to be at
level 1?
A. 15
B. 25
C. 63
D. 31
78. Which of the following abstract data types can be used to represent a many-to-many relation?
A. Tree
B. Stack
C. Graph
D. Queue
79. A sorting algorithm traverses through a list, comparing adjacent elements and switching them
under certain conditions. What is this sorting algorithm called?
A. Insertion sort
B. Heap sort
C. Quick sort
D. Bubble sort
80. A football seller stores all the footballs in a large container that is closed from the bottom. The
footballs are stacked on top of each other in the box. The new supply of balls is put in the box from
the top. When a customer buys a football, the one at the top of the stack is given to the customer.
Each football has a code. The seller wants to store the codes of all the footballs in a data structure
to keep track of the inventory. Which data structure should be used for this purpose?
A. Queue
B. Stack
C. Array
D. Graph
81. Consider the given list of sorting algorithms
1. Selection sort 2. Radix sort 3. Shell sort 4. Heap sort
Which of the above mentioned algorithms uses the selection method for bringing out the sorting?

A. Only 1
B. Only 3
C. Both 1 and 4
D. Both 2 and 3
E. Both 2 and 4
82. Why is an algorithm designer concerned primarily about the run time and not the compile time
while calculating time complexity of an algorithm?
A. Run time is always more than the compile time
B. Compile time is always more than the 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.
83. Two programmers independently write a program to find the mass of one mole of water. that
includes the masses of hydrogen and oxygen.
The first programmer defines the variables as:
integer hydrogen, oxygen, water // Code A
The second programmer defines three quantities as:
integer a, b, c // Code B
Which of the two is a better programming practice and why?
A. Code B is better because variable names are shorter.
B. Code A is better because the variable names are understandable and non-confusing.
C. Code A would run correctly while Code B would give an error.
D. Code B would run correctly while Code A would give an error.
84. What is the first step for developing a working program to solve a problem?
A. To write the program in the programming language
B. To write a step-by-step algorithm to solve the problem
C. To compile the required libraries
D. To debug the code
85. In which of the following methods is sorting NOT possible?
A. Insertion
B. Selection
C. Exchange
D. Deletion
86. The program to print the larger of the two numbers entered by a user is given below. Which of the
following should be substituted in place of “??” in Statement 1 of the code to get the desired
output?
int number1, number 2
input number1, number 2
if (??) /1 Statement 1
print number1
else
print number2
end if
A. number1>number2
B. nurnber2>number1
C. number2 equals number1
D. number1<= number2
87. Ayesha wants to place the elements of an Array in the form of a Heap. On which floor of the Heap
will she place the 6th element of the Array?
A. 2
B. 3
C. 4
D. 6
E. Data insufficient
88. What will happen if some indentations are made in some statements of a code written in C++?
A. Faster execution of the code
B. U Lower memory requirement for the code
C. Correction of errors in the code
D. Better readability of the code
89. Assume the following precedence (high to low). Operators in the same row have the same
precedence.
()
* /
+ -
AND
OR
The precedence is from left to right for the operators with equal precedence.
What will be the output of the following code statements?
integer a = 50, b = 25, c = 5
print a *b/c +c
A. 120
B. 125
C. 255
D. 250
90. In a linear list of elements, a deletion can be made from one end (front) and an insertion can be
made at the other end (rear). What is this linear list known as?
A. Queue
B. Stack
C. Tree
D. Branch
91. What is the first step for developing a working program to solve a problem?
A. To write the program in the programming language
B. To write a step-by-step algorithm to solve the problem
C. To compile the required libraries
D. To debug the code
92. Which of the following sorting techniques has the worst case functioning time less than O(n*n)?
A. Heap sort
B. Quick Sort
C. Insertion Sort
D. Selection Sort
93. Which of the following algorithm design techniques is used in the quick sort algorithm?
A. Dynamic programming
B. Back tracking
C. Divide and conquer
D. Greedy search

1. What is the output of the pseudocode statements given below?

(Note: Assume that when two data types are processed through an operator, the answer maintains the same data
type as that of the input. Also, all data types have enough range to accommodate any number. If two different data
types are operated upon, the result assumes the data type that is more expressive.)

integer a=984, b=10


//float is a data type to store real numbers.
float c
c=a/b
print c
E. 984
F. 98.4
G. 98
H. Error

2. What will be the output generated when the given code is executed? A pseudo- code is used which is
self explanatory.

function main()
{
integer a=5
switch(a)
{
default: print “hello”
case 5: print “How are you?”
break

}
E. hello
F. How are you
G. Hello How are you?
H. This code will generate a compile time error

3. A language has 28 different letters in total. Each word in the language consists of a maximum of 7 letters. A
programmer wants to create a data type to store a word of this language. She decides to store the word as an array
of letters. How many bits should she assign to the data type to store all kinds of words of the language?
E. 7
F. 35
G. 28
H. 196
4. How can the largest number in a list of twenty numbers be found?
E. Use bubble sort to sort the list in a descending order and the print the first number of the series
F. Use selection sort to sort the list in a descending order and the print the first number of the series
G. Implement one iteration of selection sort for descending order and print the first number in the
series
H. None of the above

5. A programmer writes an efficient program to sum two square diagonal matrices (matrices with elements only
on the diagonal positions). The size of each matrix is nXn. What is the time complexity of the algorithm?

A. O(n2)

B. O(n)

C. O(n*log(n))

D. None of the above

6. How many nodes does a full binary tree with “n” leaves contain?
E. 2n + 1 nodes
F. log2n nodes
G. 2n – 1 nodes
H. 2n nodes

7. A developer writes the program given below to print the sum of the squares of the first five whole numbers
(0…4). is the program correct? If not, which statement should be modified to correct the program?
integer i = 0 // Statement 1
integer sum = 0 // Statement 2
while (i<5) // Statement 3
{
Sum = i*i // Statement 4
i = i + 1 // Statement 5
}
print sum // statement 6
A. No error, the program is correct
B. Statement 1
C. Statement 4
D. Statement 6

8. What is the minimum number of stacks of size “n” required to implement a queue of size “n”?
A. 1
B. 2
C. 3
D. 4

Passage
class brush
{
Private:
integer size, colorcode
function getdata ( ) {….}// Statement 1
public:
integer name // Statement 2
function putdata ( ) { …. }
}
function main
}

function main
{
brush b1, b2
print b1.name // Statement 3
b2.getdata ( ) // Statement 4
}

9. Refer to the pseudocode given in the ‘Passage’. The code is similar to that in C++ and is self-explanatory. An
accessible member function and a data member for an object are accessed by the statements objectname.
functionname and objectname. datamembername, respectively. Which statement should be deleted from the code
to rectify the error in it ?
E. Statement 1
F. Statement 2
G. Statement 3
H. Statement 4

10. The following values are to be stored in a hash Table- 15,22,41,19,102,18,37


Using the division method of hashing with a table size of 10 (use sequential method of resolving collision),give the
contents of Hash Table.
E. 41,22,102,15,37,18,19,Null, Null, Null
F. Null, Null, Null,41,22,102,15,37,18,19
G. 41,22,102,15,37,18,19
H. Null,41,22,102,Null, 15,Null, 37,18,19
11. Consider the code given below. How many times will “Hello” be printed if m<n and exactly one of (m,n) is
even?

for i= m to n increment 2

{ print “Hello!” }

E. (n – m + 1)/2

F. 1 + (n –m)/2

G. 1 + (n – m)/2 if m is even, (n – m + 1)/2 if m is odd

H. (n – m + 1 )/2 if m is even,1 + (n – m )/2 if m is odd

12. The function given below takes an even integer “n” as the input and calculates the sum of first “n” even
natural numbers. The function is called by the statement “sum(30)”. How many times will the function sum” be
called to compute the sum?
function sum(n)
{
if (n equals 2)
retum 2
else
retum (n + sum(n-2))
end
}
A. 1
B. 30
C. 15
D. 16
13.. Two programmers, X and Y, are asked to write a code to evaluate the following expression:
a – b + c/(a-b) + (a-b)2
X writes the following code statements (Code A):
print (a-b) + c/(a-b) + (a+b)*(a-b)
Y writes the following code statements (Code B);
d = (a-b)
print d + c/d + d*d
Which of the following is TRUE if the time taken to load a value in a variable for addition, multiplicand or
division between two operands is the same?
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 lesser memory and is faster than Code B
D. Code A uses lesser memory and is slower than Code B

14. ___________ is the compile time binding whereas _________________ is run time binding of functions.
A. Function overriding. Function overloading
B. Abstraction, Encapsulation
C. Function overloading, Function overriding
D. Varies from program to program

15. Which of the following is the lowest level format to which the computer converts a program in a higher
language before execution?
A. English code
B. Machine code
C. Assembly language
D. System language

16. A programmer writes a code snippet in which a set of three lines occurs ten times in different parts of the
program. What programming concept should be used to shorten the code length?
A. For loops
B. Functions
C. Arrays
D. Classes

17. A sorting algorithm traverses through a list, comparing adjacent elements and switching them under certain
conditions. What is this sorting algorithm called?
A. Insertion sort
B. Heap sort
C. Quick sort
D. Bubble sort

18. The following operations are performed on an empty stack “A”


PUSH(1)
PUSH(2)
POP
PUSH(5)
PUSH(6)
POP
What will the stack contain after these operations?
(Note: The top of the stack is underlined in the options below.)
A. 5 6
B. 1 5
C. 5 6
D. 5 1

19. Which of the following will create an object named pigeon of the class Bird in C++?
A. pigeon bird
B. bird pigeon
C. Object pigeon of bird
D. None of the above
20. enum names {AMAR,AKBAR, ANTHONY}
function main()
{
print AMAR
print AKBAR
print ANTHONY
}
A pseudo-code is used which is self explanatory.
What will be the output generated when the given code is executed?
A. 000
B. 012
C. 123
D. 111

21. What is a function contained within a class called in c++?


A. A member function
B. An operator
C. A class function
D. A method

22. Which of the following abstract data types can be used to represent a many-to-many relation?
A. Tree
B. Stack
C. Graph
D. Queue

23. A programmer writes a sorting algorithm that takes different of time to sort two different lists of equal size.
What is the possible difference between the two lists?
A. All numbers in one list are more than 100 while in the other are less than 100
B. The ordering of numbers with respect to the magnitude in the two lists has different properties.
C. One list has all negative numbers while the other has all positive numbers.
D. One list contains 0 as an element while the other does not.

24) Null function is also known as ___________.

A. Anonymous Function

B. Generic Function
C. Void Function
D. Null Operator

25) A programmer writes a program to find an element in the array A[5] with the elements: 8 30 40 45 70.
The program is run to find a number “X”, that is found in the first iteration of binary search. What is the
value of “X”?

A. 40 B. 8 C. 70 D. 30
26) A complete binary tree has a property that the value at each node is at least as large as the values at its
children nodes. What is this binary tree known as?

A. Binary Search Tree


B. AVL Tree
C. Completely Balanced Tree
D. Heap

27) When a byte code is interpreted, how does it get affected in contrast with the compiled machine code?

A. It has the same running time as of the machine code


B. It runs faster than the compiled machine code
C. It runs slower than the compiled machine code
D. Interpretation does not make any difference in the byte code running time

28) Two programmers, X and Y, are asked to write a code to evaluate the following expression:
a – b + c/(a-b) + (a-b)2
X writes the following code statements (Code A);
print (a-b) + c/(a-b) + (a-b)*(a-b)
Y writes the following code statements (Code B);
d = (a-b)
print d + c/d + d*d
Which of the following is TRUE if the time taken to load a value in a variable for addition, multiplication or
division between two operands is the same?
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 lesser memory and is faster than Code B
D. Code A uses lesser memory and is slower than Code B

29) Which of the following is NOT a data type?

E. Integer
F. Character
G. Boolean
H. Array

30) Which of the following sorting algorithms yields approximately the same worst-case and average-case running
time behavior in O(n long)?

E. Bubble sort and Selection sort


F. Heap sort and Merge sort
G. Quick sort and Radix sort
H. Tree sort and Median-of-3 Quick sort

S-ar putea să vă placă și