What is the output of examplerecursion(3)

Assignment Help C/C++ Programming
Reference no: EM13938135

Question 1

In the backtracking algorithm, if it is determined that a partial solution would end in a dead end, then the algorithm ____.

1. terminates

2. restarts

3. removes the most recently added part and tries other possibilities

4. was designed incorrectly

Question 2

void decToBin(int num, int base)
{
if(num > 0)
{
decToBin(num/base, base);
cout<<num % base;
}
}

Question 3

Given the recursive function above, what is the result of decToBin(39, 2)?

1. 10111

2. 10011

3. 100111

4. 110111

Question 4

int func1(int m, int n) {
if (m==n || n==1)
return 1;
else
return func1(m-1,n-1) + n*func1(m-1,n);
}

Question 5

Which of the following function calls would result in the value 1 being returned?

1. func1(0, 1)

2. func1(1, 0)

3. func1(2, 0)

4. func1(1, 2)

Question 6

int func2(int m, int n) {
if (n == 0)
return 0;
else
return m + func2(m, n-1);

}

Question 7

What is the output of func2(2, 3)?

1. 2

2. 3

3. 5

4. 6

Question 8

int func2(int m, int n) {
if (n == 0)
return 0;
else
return m + func2(m, n-1);
}

Question 9

Which of the following statements about the code above is always true?

1. func2(m,n) = func2(n, m) for m >= 0

2. func2(m,n) = m * n for n >=0

3. func2(m,n) = m + n for n >=0

4. func2(m, n) = n * m for n >=0

Question 10

int func1(int m, int n) {
if (m==n || n==1)
return 1;
else
return func1(m-1,n-1) + n*func1(m-1,n);
}

Question 11

How many base cases are in the function above?

1. 0

2. 1

3. 2

4. 3

Question 12

int func3(int m, int n) {
if (m < n)
return 0;
else
return 1 + func3(m-n, n);
}

Question 13

What is the value of func3(9, 7), based on the code above?

1. 0

2. 1

3. 2

4. 7

Question 14

int rFibNum(int a,int b,int n)
{
if(n==1)
return a;
else if(n==2)
return b;
else
return rFibNum(a,b,n-1) + rFibNum(a,b,n-2);
}

Question 15

What is the limiting condition of the code above?

n >= 0

a >= 1

b >= 1

n >= 1

Question 16

int exampleRecursion (int n)
{
if (n==0)
return 0;
else
return exampleRecursion(n-1) + n*n*n;
}

Question 17

What does the code above do?

1. Returns the cube of the number n

2. Returns the sum of the cubes of the numbers, 0 to n

3. Returns three times the number n

4. Returns the next number in a Fibonacci sequence

Question 18

int exampleRecursion (int n)
{
if (n==0)
return 0;
else
return exampleRecursion(n-1) + n*n*n;
}

Question 19

What is the output of exampleRecursion(3) ?

1. 25

2. 32

3. 36

4. 42

Reference no: EM13938135

Questions Cloud

Identify and analyse the business global logistics : Your task is to identify and analyse the business's global logistics, supply chain channels, sustainability throughout the value chain and the associated linkages back to the theory you are studying in LB5230 - Managing Strategic Resources and Ope..
Independence using chi-squared distribution : In order to assess rates of faulty installation for home solar panel arrays, a sample of homes with recently installed arrays was examined by expert assessors and each array was graded as either "unsafe", "sub-standard" or "acceptable".
Prepare entries for yarnell electronic to record transaction : Yarnell Electronics sells computer systems to small businesses. Prepare entries for Yarnell Electronics to record these transactions.
Do you believe kohlbergs trends and findings are credible : Do you believe Kohlbergs trends and findings are credible? State whether you agree or disagree, and why. Offer your observation of where you think the moral barometer would hover in most large corporations in America today. Level 1, 2, or 3? Stage..
What is the output of examplerecursion(3) : Given the recursive function above, what is the result of decToBin(39, 2)
Accounting policies or estimates and impact thereof : You are required to collect the following information on your selected company for the most recent annual report you are able to obtain:
Discuss profiling as a legal tool of law enforcement : Discuss profiling as a legal tool of law enforcement. When might it be acceptable or even necessary to use race in forming a profile of a criminal or criminal activity
What is taxonomy : What is taxonomy? Explain in detail.
Why are some simple plants only found in damp places : Why are some simple plants only found in damp places. Why are flowering plants the most successful on this planet. What is the difference between reproduction in coniferous plants and in flowering plants.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c function that converts a character to upper case.

Write a C function that converts a character to upper case. The function should have the prototype char to_upper(char ch); The characters given as input to the function are assumed to be in the sets {'a', ..., 'z'} and {'A', ... , 'Z' }. Do not use a..

  Which manufactures electrical switches

Jake Company, which manufactures electrical switches, uses a standard cost system and carries all inventories at standard. The standard manufacturing overhead costs per switch are based on direct labor hours and are shown below:Variable overhead (5 h..

  Implement the simplified expression using and

Find the complement of F(A,B,C) = AB + (BC' * A) and reduce it. Show your work for the reduction using the axioms of Boolean Algebra. Then, implement the simplified expression using AND, OR, and NOT gates.

  Write a program to find how much time takes to travel

Write a program C. An object is traveling "x" miles/second after every 2 minutes its current and speed is decreased by 1.7%. How much time it takes to travel "y" kilometers from its origin

  Indexed addressing to reverse the elements

Use a loop with indirect or indexed addressing to reverse the elements of the integer array in place - Can you implement a program to indexed addressing to reverse the elements of an array?

  Csc302 make any dfa in jflap software and run for several

make any dfa in jflap software and run for several inputs. take a screen shot and include in your assignment. keep in

  Write a function integerpower

Write a function integerPower(base, exponent) that returns the value of base^exponent. For example, integerPower(3, 4) = 3* 3 * 3* 3. Do not use any math library functions.

  Please low is studentgrade class problem

1.Please low is StudentGrade class problem, please modify it so that all methods are marked const that can be. Make sure you have a constructor that accepts all data values. Create a simple main function that declares a constStudentGrade object and d..

  Create a procedure that returns the last n items in the list

Create a procedure that returns the last n items in the list lst. Create a procedure called (combine-four lst1lst2 lst3 lst4) that combines 4 lists into one list, in order of the given input lists.

  Program to find the factors of an integer

Write a C++ program to find the factors of an integer (entered by the user) which are themselves squares.

  Write a c++ program to first find ''n'' fibonacci numbers

Write a C++ program to first find 'N' Fibonacci numbers and then display only the "even" Fibonacci numbers in "descending order" as output.

  Write a c++ program to sort a list of number using vectors

Write a C++ program to sort a list of number using vectors. Output the values when the elements are inserted into its correct position. Assume the first element in the list is sorted.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd