The following function to calculate the nth Fibonacci number is inefficient because _____.long fib (long num){ if (num == 0 || num == 1) return num; return (fib (num - 1) + fib (num - 2));}
A. it tests both base cases in the same line
B. it is tail recursive
C. it does not check if num is negative
D. it calculates each fib(n) twice: when called with fib(n+2) and when called with fib(n+1)
Answer: D
You might also like to view...
Which statement is false?
a. There’s overhead inherent in multithreading. b. Simply dividing a task into two threads and running it on a dual core system does not run it twice as fast, though it will typically run faster than performing the thread’s tasks in sequence on one core. c. Executing a multithreaded application on a single-core processor can actually take longer than simply performing the thread’s tasks in sequence. d. None of the above.
All of the following are input elements except
a. print b. radio button c. text box d. command button
Digital Equipment, Intel, and Xerox invented the first network in the mid-1970s and created what eventually became _______________.
A. Ethernet B. NetBEUI C. TCP/IP D. NetBIOS
IrDA links are direct ______________ and are susceptible to interference.
Fill in the blank(s) with the appropriate word(s).