gs gs128 Java Classes Methods - Java Recursion - Quiz No.1
gs gs128 Java Quiz
This quiz belongs to book/course code gs gs128 Java of gs organization. We have 136 quizzes available related to the book/course Java. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Java Classes Methods. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
Question 1: What is Recursion in Java?
Recursion is a class
Recursion is a process of defining a method that calls other methods repeatedly
Recursion is a process of defining a method that calls itself repeatedly
Recursion is a process of defining a method that calls other methods which in turn call again this method
Question 3: Which of these will happen if recursive method does not have a base case?
An infinite loop occurs
System stops the program after some time
After 1000000 calls it will be automatically stopped
None of the mentioned
Question 4: Which of these is not a correct statement?
A recursive method must have a base case
Recursion always uses stack
Recursive methods are faster than programmer’s written loop statement that calls the function iteratively
Recursion is managed by Java Runtime environment
Question 5: Which of these packages contains the exception Stack Overflow in Java?
java.lang
java.util
java.io
java.system
Question 6: What will be the output of the following Java program?
class recursion { int func (int n) { int result; result = func (n - 1); return result; } } class Output { public static void main(String args[]) { recursion obj = new recursion() ; System.out.print(obj.func(12)); } }
0
1
Compilation Error
Runtime Error