Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

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< }
}

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

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91609012
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in C/C++

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As