1 if the following function is called with a value of 2 for n what is the resulting 5346606

1. If the following function is called with a value of 2 for n what is the resulting output?

void tapDance( int n)

                      if ( n> -1)

                      {

                         tap Dance (n-1);

                        cout

                      }

                      else

                            cout

                      }

A. ShuffleFlapFlapFlapFlap

B. FlapFlapFlapFlapShuffle

C. ShufleFlapFlap

D. FlapFlapShuffle

E. FlapShuffle

2. If the follwing is a valid statement:

      w->x->y->z = 12;

then:

A. x, y and az are structure variables

B. x, y and z are structure components

C. w, x and y are pointer variables

D. A and B statements are correct

E. B and C statements are correct

3. (*x). y-> = 5;

In the statement above

A. x is the structure variable

B. y is the structure variable

C. z is the structure variable

D. A and B statemnets are correct

E. B and C statemnets are correct

4. j.k.l = 30

In the statement aboce,

A. J is a structure component.

B. k is a structure component.

C. l is a structure component.

D. A and B statements are correct.

E. B and C statements are correct.

————————————————————————————

THE FOLLWING IS DEFINED FOR THE QUESTIONS 5-8 INCLUSIVE:

struct entry

{

    int num;

    entry * next;

};

entry * head, * cur, * pent;

int n = 5, cnt=0;

pent = new entry;

pent->num = 7

pent->next = NULL;

——————————————————-

5. for ( cur=head; cur!=NULL; curr= cur-> next)

{   if ( cur->num ==n)

                  cout

}

If entry, cur, head and n are defined as earlier and head points to a linked list of numbers, the above code dispalys “hi”,

A. Only for the first occurrence of the variable n in the linked list.

B. Only for the last occurrence of the variable n in the linked list.

C. For all occurrences of the viarable n in the linked list.

D. For each entry in the linked list.

——————————————————————————————————————————————

6. for ( cur=head; cur!=NULL; curr= cur-> next)

{   

         if ( cur->num >= n)

            break;

        cnt++;

}

cout

If entry cur,head, num and cnt are defined as earlier and head points to a linked list of numbers, the above code displays.

A. the total number of entris in the linked list if head is pointing to an order linked list.

B. the total number of entries which has a number greater than n.

C. The total number of entries which has a number greater than n if head is pointing to an order linked list.
D. the total nubmer of entries which has a nubmer less than n.

E. The otal number of entire which ahs a number less than n if head is pointing to an order linked list.

———————————————————————————————————————————

7. pent-> next=head;

head=pent;

If cur, head and pent are defined as earlier code above and head points to a linked list, the code fragment in this problem,

A. add an entry at the head.

B. Removes an entry from the head.

C. removes an entry fro mt he end of the list.

D. A and B statements are correct.

E. B and C statements are correct

8. head=head->next;

If cur, head and pent are defiend as earlier code above and head points to a linked list, the code fragment in this probelm,

A. Adds an entry at the head.

B. Removes an entry from head.

C. Both a and b statements are correct

D. Both a and b statements are inncorrect..

9. ALgorithm that finds the solution to a given probelm by reducing the probelm to smaller verisons of itself is called recursive algorithm.

A. True

B. False

10. Recurisve algorithm must have only one base case

A. True

B. False

11. Which of the follwing is true about he a base case

A. Is a case in whic hteh solution is obtained directly

B. Stops the recursion

C. Both A and B statemetns are correct

D. Both A and B statements are incorrect

12. Given the recursive function

void PrintArr ( con in arr [ ], int first, in last   0

   {

      if ( first > last)

        cout

     else

       {

           PrintArr( arr, first + 1, last);

           cout

       }

}

which code segment below proces the same output as the follwing fucntion call?

                            PrintArr(arr,  0,   5);

A.   for ( i=0; i

            cout

          cout

B. cout

         for (i = 0; i

            cout

C. for (i=0; i

        {

           cout

           cout

D. for (i=5; i >= 0; i–)

            cout

         cout

E. cout

           for (i=5; i >= 0; i–)

                cout

13. Infinite recurison is the case here every recursive call resutls in another recursive call.

A. True

B. False

14. The following recursive function is supposed to calculate factoral of a number. It has no errors and will execute correctly

int fact (int num)

{

   if (num ==))

     return 1;

else

          return fact (num -1);

}

A. True

B. False

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now