Question
What is the output of the following recursive function
call func(3) ? int func ( int n) {Â Â Â Â Â Â Â Â Â Â if (n == 0 ) return 1 ; Â Â Â return n * func(n - 1 ); }Solution
This function computes the factorial of n . Factorial is defined as n!=n×(n−1)× ⋯ ×1 . For n=3 :
- func(3) calls 3 * func(2) .
- func(2) calls 2 * func(1) .
- func(1) calls 1 * func(0) .
- func(0) returns 1 (base case).
- Option A (1): Only the base case returns 1 . This does not account for recursive multiplication.
- Option B (3): This is the input but not the factorial result.
- Option D (9): This result might confuse with 3² , which is unrelated to factorial.
- Option E (27): This is 3^3 .
Offences against state is punishable under a separate chapter of IPC? If yes under which chapter?
According to the Bharatiya Nyaya Sanhita, 2023 what does petty organized crime mean?
Which of the following punishment is not for waging war against the government of India?
Sedition is an offence if anyone expresses disaffection towards the Government established by law in India by way of-
The documents that are not produced inspite of giving a notice to produce-
Which of the following is not an offence against public tranquility?
Reasonable Restrictions on freedom to assemble can be imposed
Which all companies are required to constitute the Stakeholders Relationship Committee under the Companies Act?
Is there any presumption as to genuineness of certified copies under Indian Evidence Act, 1872?
If yes, then under which section?      �...
Conspiracy to wage war against the government in India, is punishable under?