71. Which of the following algorithms solves the all-pairs shortest path problem?
(a) Dijkstra’s algorithm
(b) Floyd’s algorithm
(c) Prim’s algorithm
(d) Warshall’s algorithm
Show Answer
Hide Answer
72. Which of the following sorting algorithms has the worst time complexity of nlog(n)?
(a) Heapsort
(b) Quicksort
(c) Insertion sort
(d) Selection sort
Show Answer
Hide Answer
73. What is common in three different types of traversals (inorder, preorder and postorder)?
(a) Root is visited before right subtree
(b) Left subtree is always visited before right subtree
(c) Root is visited after left subtree
(d) All of the above
Show Answer
Hide Answer
74. Which of the following is correct recurrence relation for worst case of binary search?
(a) T(n)=2T(n/2)+O(1)
T(1)=T(0)=O(1)
(b) T(n)=T(n/2)+O(n)
T(1)=T(0)=O(1)
(c) T(n)= T(n/2)+O(1)
T(1)=T(0)=O(1)
(d) T(n)=2T(n/2)+O(log n)
T(1)=T(0)=O(1)
Show Answer
Hide Answer
75. Which of the following traversal techniques lists the nodes of a binary search tree in ascending order?
(a) Postorder
(b) Preorder
(c) lnorder
(d) None of the above
Show Answer
Hide Answer
76. A hash table of length 10 uses open addressing with hash function h (k)= k mod 10 and linear probing. After inserting 6 Values an empty hash table the table is shown below:
table
0 | |
1 | |
2 | 42 |
3 | 23 |
4 | 34 |
5 | 52 |
6 | 46 |
7 | 33 |
8 | |
9 |
Which of the following choices gives a possible order in which the key values could have been inserted in the table?
(a) 46, 42, 34, 52, 23, 33
(b) 34, 42, 23, 52, 33, 46
(c) 46, 34, 42, 23, 52, 33
(d) 42, 46, 33, 23, 34, 52
Show Answer
Hide Answer
77. C was primarily developed as a
(a) System Programming language
(b) General Purpose language
(c) Data processing language
(d) None of the above
Show Answer
Hide Answer
78. The minimum number of temporary variable needed to swap the contents of two variables is
(a) 1
(b) 2
(c) 3
(d) 0
Show Answer
Hide Answer
79. The program fragment
int a=5, b=2;
printf (“%d”, a++ + ++b);
A. Prints 7
B. Prints 8
C. Prints 9
D. None of the above
Show Answer
Hide Answer
80. Consider the following program segment in C programming language:
i=6720; j=4;
while ((i%j)==0)
{
i= i/j;
j = j + 1;
}
On termination, j will be have the value
A. 4
B. 8
C. 9
D. 6720
Show Answer
Hide Answer
81. Consider the following segment of C code:
int j, n;
j=1
while (j <=n)
j=j*2;
the number of comparisons made in the execution of the loop for any any n> 0 is
A. [log2n] +1
B. n
C. [log2n]
D. [log2n] +1
Show Answer
Hide Answer
82. What will be the output of the following?
main ()
{
int a = ‘A’;
printf (“%d”, a);
}
A. A
B. a
C. 65
D. Compilation error
Show Answer
Hide Answer
83. What will be the output of the following program?
int f (int x)
{
static int y;
y + = x
return (y);
}
main ()
{
int a, i ;
for (i = 0; i lt 6; i ++)
a = f (i);
printf (“%d”, a);
}
A. 6
B. 8
C. 10
D. 15
Show Answer
Hide Answer
84. Which of the following is not a storage class specifier in C programming language?
A. Register
B. Volatile
C. Extern
D. Typedef
Show Answer
Hide Answer
85. in C language
A. Parameters are always passed by values
B. Parameters are always passed by reference
C. Non-pointer variables are passed by value and pointers are passed by reference
D. Parameters are always passed by value result
Show Answer
Hide Answer
86. What does the following C statement mean?
scanf (“%4s”, str);
A. Read exactly 4 characters from console
B. Read maximum 4 characters from console
C. Read a string in multiples of 4
D. None of the above
Show Answer
Hide Answer
87. Assume the following C variable declaration:
int* A [10], B[10] [10];
Among the following expressions, which will not give compile time error if used as left-hand side of assignment statement in a C program?
I. A [2]
II. A [2] [3]
III. B [1]
IV. B [2] [3]
A. I, II and IV only
B. II, III and IV only
C. II and IV only
D. IV only`
Show Answer
Hide Answer
88. What is the output of the following C program?
# include
int main ()
{
int index;
for (index =1; index <=5; index ++)
{
printf (“%d”,index);
if (index ==3)
continue;
}
}
A. 1245
B. 12345
C. 12245
D. 12354
Show Answer
Hide Answer
89. What is the meaning of the following declaration in C programming language?
int (*p)[5];
A. It will result in compile error because there should not be any parenthesis, i.e “int*p[5]” is valid
B. p is a pointer to 5 integers
C. p is a pointer to integer array
D. p is a pointer to an array of 5 integers
Show Answer
Hide Answer
90. In the relation R={(1,2), (2,3)}, The minimum number of ordered pairs that must be added to this set, so that the enlarged relation is reflexive, symmetric and transitive, is
A. 4
B. 5
C. 6
D. 7
Show Answer
Hide Answer
Leave a Reply