Question
Consider the following C code snippet for calculating base raised to the power of exp: #include double power(double base, int exp) { if (exp == 0) { return 1; } // Missing handling for negative exponent return base * power(base, exp - 1); } int main() { printf("%.2f\n", power(2.0, -2)); return 0; } What will be the output or behavior of the program when power(2.0, -2) is called?
More IT Operating System Questions
- Which of the following protocol should be used for those websites which need login credentials for sending the data?
- What is the purpose of a FOREIGN KEY constraint?
- A developer is choosing between an array and a linked list to store a collection of elements. If the primary operations will be frequent insertions and del...
- Every host computer on the internet has a (n) :
- Complete the insert_at_beginning function for a singly linked list. Assume Node has data and next attributes. class Node: def __init__(self, data):...
- Consider a min-heap represented as an array: [1, 3, 5, 7, 9]. If the element 2 is inserted into this min-heap, what will be the state of the heap array aft...
- Which of the following is an example of unsupervised learning in AI?
- When tracing the execution of a for loop, what aspect of code flow are you primarily analyzing?
- Consider a Shape class with a method draw(), and Circle and Rectangle classes that inherit from Shape and override draw(). If you have a List containing Ci...
- What is the space complexity of a recursive implementation of Fibonacci (without memoization) to compute the nth Fibonacci number, considering the call sta...
Hey! Ask a query
Please enter email id
The email must be a valid email address.
Please enter Mobile Number
Please enter valid Mobile Number
Please enter your Doubt
Think You're Ready for RBI Grade B?
RBI Grade B 2026 Phase 1 Memory Based Paper
- 200 Questions with Detailed Solutions
- Section-wise Coverage (GA, English, Quant & Reasoning)