MCQOPTIONS
Saved Bookmarks
This section includes 144 Mcqs, each offering curated multiple-choice questions to sharpen your Java knowledge and support exam preparation. Choose a topic below to get started.
| 101. |
If there is no base criteria in a recursive program, the program will ................ |
| A. | not be executed |
| B. | execute until all conditions match |
| C. | execute infinitely |
| D. | obtain progressive approach |
| Answer» D. obtain progressive approach | |
| 102. |
For implementing recursive function the data structure used is: |
| A. | Stack |
| B. | Queue |
| C. | Linked List |
| D. | Tree |
| Answer» B. Queue | |
| 103. |
Which of the following algorithm cannot be designed without recursion? |
| A. | Tower of Hanoi |
| B. | Fibonacci Series |
| C. | Tree Traversal |
| D. | All can be designed without recursion |
| Answer» E. | |
| 104. |
When a function is recursively called, all automatic variables |
| A. | Are initialized during each execution of the function |
| B. | Are retained from the last execution |
| C. | Are maintained in a queue |
| D. | None of these |
| Answer» B. Are retained from the last execution | |
| 105. |
An iterative function is preferred when its recursive equivalent is__________. |
| A. | Complex |
| B. | Simple |
| C. | Efficient |
| D. | None of the above |
| Answer» B. Simple | |
| 106. |
For certain problems, a recursive solution is ____________as in the case of factorial of a number. |
| A. | Straightforward |
| B. | Single |
| C. | Both (a) and (b) |
| D. | None of the above |
| Answer» D. None of the above | |
| 107. |
Infinite recursion leads to ............... |
| A. | Overflow of run-time stack |
| B. | Underflow of registers usage |
| C. | Overflow of I/O cycles |
| D. | Underflow of run-time stack |
| Answer» B. Underflow of registers usage | |
| 108. |
If an algorithm calls itself to do some part of work, it is said to be |
| A. | Self functioned |
| B. | Recursive |
| C. | Symmetric |
| D. | Self Sequenced |
| Answer» C. Symmetric | |
| 109. |
Recursion is memory-intensive because: |
| A. | Recursive functions tend to declare many local variables |
| B. | Previous function calls are still open when the function calls itself and the activation records of these previous calls still occupy space on the call stack |
| C. | Many copies of the function code are created |
| D. | It requires large data values |
| Answer» C. Many copies of the function code are created | |
| 110. |
What does the following function print for n = 25?void fun(int n){ if (n == 0) return; printf("%d", n%2); fun(n/2);} |
| A. | 11001 |
| B. | 10011 |
| C. | 11111 |
| D. | 00000 |
| Answer» C. 11111 | |
| 111. |
A subroutine can be coded so that it may call itself recursively, at___________, in order to perform its task. |
| A. | One or more places |
| B. | Two or more places |
| C. | More places |
| D. | None of the above |
| Answer» B. Two or more places | |
| 112. |
Part of a recursive algorithm that handles a simple input that can be solved without resorting to a recursive call, is known as |
| A. | Base case |
| B. | Recursive case |
| C. | Summation case |
| D. | Relational case |
| Answer» B. Recursive case | |
| 113. |
Running out of memory may occur due to |
| A. | Non-recursive call |
| B. | Recursive function call |
| C. | Use of more extern variable |
| D. | None of these |
| Answer» C. Use of more extern variable | |
| 114. |
Predict output of following programConsider the following recursive function fun(x, y). What is the value of fun(4, 3)int fun(int x, int y) { if (x == 0) return y; return fun(x - 1, x + y);} |
| A. | 13 |
| B. | 12 |
| C. | 9 |
| D. | 10 |
| Answer» B. 12 | |
| 115. |
An algorithm that calls itself directly or indirectly is known as |
| A. | Sub algorithm |
| B. | Recursion |
| C. | Polish notation |
| D. | Traversal algorithm |
| Answer» C. Polish notation | |
| 116. |
Tower of hanoi is a classic example of |
| A. | divide and conquer |
| B. | recursive approach |
| C. | B but not A |
| D. | Both A & B |
| Answer» E. | |
| 117. |
The following formula will produceFn = Fn-1 + Fn-2 |
| A. | Armstrong Number |
| B. | Fibonacci Series |
| C. | Euler Number |
| D. | Prime Number |
| Answer» C. Euler Number | |
| 118. |
What’s happen if base condition is not defined in recursion ? |
| A. | Stack underflow |
| B. | Stack Overflow |
| C. | None of these |
| D. | Both a and b |
| Answer» C. None of these | |
| 119. |
Recursion uses more memory space than iteration because |
| A. | it uses stack instead of queue. |
| B. | every recursive call has to be stored. |
| C. | both A & B are true. |
| D. | None of the above are true. |
| Answer» C. both A & B are true. | |
| 120. |
What about recursion is true in comparison with iteration? |
| A. | very expensive in terms of memory. |
| B. | low performance. |
| C. | every recursive program can be written with iteration too. |
| D. | all of the above are true. |
| Answer» E. | |
| 121. |
Which Data Structure is used to perform Recursion? |
| A. | Queue |
| B. | Stack |
| C. | Linked List |
| D. | Tree |
| Answer» C. Linked List | |
| 122. |
A procedure that calls itself is called |
| A. | illegal call |
| B. | reverse polish |
| C. | recursive |
| D. | none of the above |
| Answer» D. none of the above | |
| 123. |
If there's no base criteria in a recursive program, the program will |
| A. | not be executed. |
| B. | execute until all conditions match. |
| C. | execute infinitely. |
| D. | obtain progressive approach. |
| Answer» D. obtain progressive approach. | |
| 124. |
13?$ |
| A. | 7 |
| B. | Infinite loop |
| C. | 17 |
| Answer» C. 17 | |
| 125. |
3?$ |
| A. | 27 |
| B. | 3.0 |
| C. | None of the mentioned |
| Answer» D. | |
| 126. |
011$ |
| A. | 110 |
| B. | 3 |
| C. | Infinite loop |
| Answer» B. 3 | |
| 127. |
return$ |
| A. | printf(“%d “, n) |
| B. | if(n == 0) |
| C. | my_recursive_function(n-1) |
| Answer» C. my_recursive_function(n-1) | |
| 128. |
Prints the numbers from 10 to 1 |
| A. | Prints the numbers from 10 to 0 |
| B. | Prints the numbers from 1 to 10 |
| C. | Prints the numbers from 0 to 10 |
| Answer» C. Prints the numbers from 0 to 10 | |
| 129. |
9 time? |
| A. | 10 times |
| B. | 0 times |
| C. | Infinite number of times |
| Answer» D. | |
| 130. |
1? |
| A. | 1 |
| B. | 10 9 8 … 1 0 |
| C. | 10 9 8 … 1 |
| Answer» D. | |
| 131. |
Higher |
| A. | Higher-level-expt |
| B. | Lower |
| C. | Lower-level-expt |
| Answer» D. | |
| 132. |
++++2 |
| A. | +++++2 |
| B. | +++++ |
| C. | 2 |
| Answer» D. | |
| 133. |
What value will assigned, if there is no argument marked by a matching keyword? |
| A. | T |
| B. | NIL |
| C. | False |
| D. | Both NIL & False |
| Answer» C. False | |
| 134. |
In the absence of a exit condition in a recursive function, the following error is given __________ |
| A. | Compile time error |
| B. | Run time error |
| C. | Logical error |
| D. | No error |
| Answer» B. Run time error | |
| 135. |
Which can appear without an initial form? |
| A. | Parameter |
| B. | Block parameter |
| C. | Optional parameter |
| D. | Aux parameter |
| Answer» E. | |
| 136. |
In recursion, the condition for which the function will stop calling itself is ____________ |
| A. | Best case |
| B. | Worst case |
| C. | Base case |
| D. | There is no such condition |
| Answer» D. There is no such condition | |
| 137. |
The principle of stack is __________ |
| A. | First in first out |
| B. | First in last out |
| C. | Last in first out |
| D. | Last in last out |
| Answer» C. Last in first out | |
| 138. |
Which eliminate the need for many auxiliaries? |
| A. | Parameters |
| B. | Block parameters |
| C. | Optional parameters |
| D. | All of the mentioned |
| Answer» D. All of the mentioned | |
| 139. |
Recursion is similar to which of the following? |
| A. | Switch Case |
| B. | Loop |
| C. | If-else |
| D. | None of the mentioned |
| Answer» C. If-else | |
| 140. |
The data structure used to implement recursive function calls _____________ |
| A. | Array |
| B. | Linked list |
| C. | Binary tree |
| D. | Stack |
| Answer» D. Stack | |
| 141. |
Which allow procedures to use themselves again? |
| A. | Recursion |
| B. | Reuse |
| C. | Reintiate |
| D. | None of the mentioned |
| Answer» B. Reuse | |
| 142. |
Which of the following problems can be solved using recursion? |
| A. | Factorial of a number |
| B. | Nth fibonacci number |
| C. | Length of a string |
| D. | All of the mentioned |
| Answer» E. | |
| 143. |
Only problems that are recursively defined can be solved using recursion. True or False? |
| A. | True |
| B. | False |
| Answer» C. | |
| 144. |
Which of these data types is used by operating system to manage the Recursion in Java? |
| A. | Array |
| B. | Stack |
| C. | Queue |
| D. | Tree |
| Answer» C. Queue | |