Question

#data structures

Look at square numbers one more time:

square(1) = 1

square(N) = square(N-1) + 2N -1

Assume the definition has been implemented correctly. How many
stack frames for square() will be created on the computer memory
stack in RAM if main() calls square(5)?

A) 1

B) 3

C) 5

D) 6

Answer #1

**Answer :
Correct Option is Option(C) ie. 5.**

5 stack frames for square() will be created on the computer memory stack in RAM if main() calls square(5).

**Explanation
:**

When square(5) called from the main() , then the above recursive function works and it will go like this : square(5), then square(4), then square(3), then square(2), then square(1) and then stops as the base condition goes true.

**Hence total stacks frames created is 5.**

Hence,

**Option(A)** is Incorrect. The total stacks
created on computer memory is not 1.

**Option(B)** is Incorrect.The total stacks created
on computer memory is not 3.

**Option(C)** is Correct. The total stacks created
on computer memory is 5.

**Option(D)** is Incorrect. The total stacks
created on computer memory is not 6.

So,

**Correct Option is Option(C) ie. 5.**

QUESTION 1
For the following recursive function, find f(5):
int f(int n)
{
if (n == 0)
return 0;
else
return n * f(n - 1);
}
A.
120
B.
60
C.
1
D.
0
10 points
QUESTION 2
Which of the following statements could describe the general
(recursive) case of a recursive algorithm?
In the following recursive function, which line(s) represent the
general (recursive) case?
void PrintIt(int n ) // line 1
{ // line 2...

1. An operating system is
a. A resource manager
b. A user application such as turbo t
c. A collection of all software packages on the computer
d. Another name of my computer including both hardware and
software
2. X86 calling convention is about
a. How parameters are transferred through stack
b. How interrupt vectors are used to find handlers
c. How to make a phone call on an x86 computer
d. None of the above
3. Paging mechanisms helps...

Written in MASM Assembly
Problem Definition:
Write a program to calculate Fibonacci numbers.
• Display the program title and programmer’s name. Then get the
user’s name, and greet the user.
• Prompt the user to enter the number of Fibonacci terms to be
displayed. Advise the user to enter an integer in the range [1 ..
46].
• Get and validate the user input (n).
• Calculate and display all of the Fibonacci numbers up to and
including the nth...

1. The memory units that follow are specified by the number of
words times the number of bits per word. How many address lines and
input/output data lines are needed in each case? (a) 8K X 16 (b) 2G
X 8 (c) 16M X 32 (d) 256K X 64
2. Give the number of bytes stored in each memory unit in
question 1.
3. Word number 563 decimal in the memory shown in Fig. 7.3 (see
Mano-Ch7.pdf) contains the binary...

Microprocessor 8086 material.
Choose the correct answer.
1- For a (64K x 8) RAM, the number of address lines is:
*
17
19
16
15
20
14
18
2-Which of the following instructions requires (BYTE PTR)?
*
SHR [500H], 3h
LDS SI, [1000H]
LAHF
PUSH [9AAH]
ADD AX, [800H]
3-Where are the interrupt vectors located in the
microprocessor’s memory? *
in the first 64K byte
in the first 1K byte
in the first 256K byte
in the first 1M byte...

Math Methods:
The data in the accompanying table show the speed n
(in increments of 5 mph) of an automobile and the associated
distance in feet required to stop it when the brakes are applied.
For instance,n= 6 (representing 6x5 = 30 mph) requires a
stopping distance of 47 ft.
n
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
3
6
11
21
32
47
65
87
112
140
171
204
241...

Recall that Benford's Law claims that numbers chosen from very
large data files tend to have "1" as the first nonzero digit
disproportionately often. In fact, research has shown that if you
randomly draw a number from a very large data file, the probability
of getting a number with "1" as the leading digit is about 0.301.
Now suppose you are the auditor for a very large corporation. The
revenue file contains millions of numbers in a large computer data...

Recall that Benford's Law claims that numbers chosen from very
large data files tend to have "1" as the first nonzero digit
disproportionately often. In fact, research has shown that if you
randomly draw a number from a very large data file, the probability
of getting a number with "1" as the leading digit is about 0.301.
Now suppose you are the auditor for a very large corporation. The
revenue file contains millions of numbers in a large computer data...

1. Given an
n-element array A, Algorithm X executes an
O(n)-time computation for each even
number in A and an O(log n)-time computation for
each odd number in A.
What is the best-case running time of Algorithm X?
What is the worst-case running time of Algorithm X?
2. Given an array,
A, of n integers, give an O(n)-time algorithm that finds
the longest subarray of A such that all the numbers in that
subarray are in sorted order. Your algorithm...

Recall that Benford's Law claims that numbers chosen from very
large data files tend to have "1" as the first nonzero digit
disproportionately often. In fact, research has shown that if you
randomly draw a number from a very large data file, the probability
of getting a number with "1" as the leading digit is about 0.301.
Now suppose you are an auditor for a very large corporation. The
revenue report involves millions of numbers in a large computer
file....

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 20 minutes ago

asked 50 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 2 hours ago

asked 2 hours ago

asked 2 hours ago

asked 2 hours ago

asked 2 hours ago