Question 98Asked in Bihar STET 2025 Paper II Computer Science, 3 Nov 2025, Shift 1 (9:00 AM)

Which of the following is the base case for a recursive factorial function?पुनरावर्ती फैक्टरियल फ़ंक्शन के लिए निम्नलिखित में से कौन सा आधार मामला है?

पुनरावर्ती फैक्टरियल फ़ंक्शन के लिए निम्नलिखित में से कौन सा आधार मामला है?
  1. An == 0n == 0
  2. Bn == 1n == 1
  3. Cn < 0n < 0
  4. Dn > 0n > 0
Show answerHide answer

Correct answer: (B) n == 1n == 1

Explanation

The key takes n == 1 as the base case, returning 1 and ending the recursion. Many implementations use n == 0 (or n <= 1) instead, since 0! = 1 as well.कुंजी n == 1 को base case मानती है, जो 1 लौटाकर रिकर्शन समाप्त करता है। कई कार्यान्वयन n == 0 (या n <= 1) लेते हैं, क्योंकि 0! = 1 भी है।

From Bihar STET 2025 Paper II Computer Science PYQ, 3 Nov 2025, Shift 1 (9:00 AM)

This is question 98 of Bihar STET 2025 Paper II Computer Science PYQ, 3 Nov 2025, Shift 1 (9:00 AM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.