Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me check and correct these answers before I resubmit that test. Than

ID: 3553829 • Letter: P

Question

Please help me check and correct these answers before I resubmit that test. Thank you.


Problem #1:         []
-------------------------------
[Points = 2]

(T/F) Using a binary search, you are more likely to find an item than
if you use a linear search.

-------------------------------
Your Answer: F
------------------


Problem #2:         []
-------------------------------
[Points = 2]

A(n) ________ search is more efficient than a(n) ________ search.

    A) string, double
    B) integer, double
    C) binary, linear
    D) linear, binary
    E) None of the above; all searches are equally efficient.

-------------------------------
Your Answer: C
-----------------------


Problem #3:         []
-------------------------------
[Points = 2]

To determine that a value is not present in an unordered array of 50
items, linear search must examine an average of ________ values.

    A) 1
    B) 6
    C) 25
    D) 50
    E) 51

-------------------------------
Your Answer: D
---------------------------------


Problem #4:         []
-------------------------------
[Points = 2]

To find a value that is in an unordered array of 1000 items, binary
search must examine at most ________ values.

    A) 7
    B) 10
    C) 50
    D) 20
    E) 100

-------------------------------
Your Answer: B
-------------------------------


Problem #5:         []
-------------------------------
[Points = 2]

We can estimate the ________ of an algorithm by counting the number of
steps it requires to solve a problem.

    A) efficiency
    B) number of lines of code
    C) run time
    D) code quality
    E) result

-------------------------------
Your Answer: A
---------------------------


Problem #6:         []
-------------------------------
[Points = 3]

Write the statement to cause sptr to point to record You.


struct STUD
{
    int ID; string Name; float GPA;
};

STUD You = {1234,"Justice",0.00};
STUD * sptr;

_________________________________________________

---------------------------------------
Your Answer: STUD *SPTR = &YOU
-----------------------------------------



Problem #7:         []
-------------------------------
[Points = 4]

Consider the code below.

const float PI = 3.14159;
struct Q {int x; char a; float * f;};
Q myQ;

_______________________________
--------------------------
Answer: myQ->(*f)=Π
----------------------------


Problem #8:         []
-------------------------------
[Points = 5]

Declare a struct named FELINE with three fields:

fat (an int)
cat (a float)
sibling (pointer to a FELINE)

______________________________________

--------------------------------------------------------------------
Your Answer:   STRUCT FELINE { INT FAT; FLOAT CAT; FELINE*SIBLING;};
---------------------------------------------------------------------


Problem #9:         []
-------------------------------
[Points = 4]

Consider the code below.

struct Q {int x; char a; Q * nextQ;}
Q myQ;


_______________________________

-------------------------------
Your Answer: MYQ->(*NEXTQ)=NULL;
--------------------------------


Problem #10:         []
-------------------------------
[Points = 3]

The output produced by the code below:

   float * f;
   float m = 14.5;

   f = new float(m);
   cout << * f;
-----------------------------
Your Answer: 14.5
---------------------------




Problem #11:         []
-------------------------------
[Points = 3]

Consider the declaration below:

struct Circle
{
     float radius;
};


Directions: Write a statement to declare a pointer named Cp, that
            can point to a Circle.

        _____________________________ //HERE


-------------------------------
Your Answer: CIRCLE *CP;
-------------------------------

[12]

Rewrite the line that contains an error.

   int j = 3, * i = &j;
   float q, p=3.24, * f;
   f = & p;

   * p = * f;
   cout << i + f;

-------------------------------
Your Answer: F = &P;
---------------------------



Problem #13:         []
-------------------------------
[Points = 2]

When function A calls function B, which in turn calls A,
we have ________ recursion.

-------------------------------
Your Answer: INDERECT
---------------------------


Problem #14:         []
-------------------------------
[Points = 2]

The programmer must ensure that a recursive function not become ________.

    A) a static function
    B) a prototyped function
    C) trapped in an infinite chain of recursive calls
    D) a dynamic function
    E) None of the above



-------------------------------
Your Answer: C




Problem #15:         []
-------------------------------
[Points = 1]

(T/F) Any algorithm that can be coded with recursion can also be
coded using a loop.


-------------------------------
Your Answer: T




Problem #16:         []
-------------------------------
[Points = 2]

The function

        int fact(int k)
        {
           return k*fact(k-1);
           if (k==0) return 1;
        }

    A) computes the factorial of the integer parameter k parameter
    B) returns the value 1 if it is passed the value 0
    C) does not correctly handle its base (stopping) case
    D) works for non-negative values of k, but not for negative values
    E) None of the above



-------------------------------
Your Answer: A




Problem #17:         []
-------------------------------
[Points = 1]

(T/F) When sorting an array of structures, one must decide
which data item (field) to sort on.



-------------------------------
Your Answer: T




Problem #18:         []
-------------------------------
[Points = 1]

A ________ algorithm arranges data into some order.

    A) sorting
    B) searching
    C) ordering
    D) linear
    E) binary





-------------------------------
Your Answer: A



Problem #19:         []
-------------------------------
[Points = 3]


                       2
Algorithm A requires 2n + 22 basic operations to process an input of size n.

Algorithm B requires 3n * log2(n) basic operations to process the same input.

The less efficient algorithms is ____.


-------------------------------
Your Answer: A




Problem #20:         []
-------------------------------
[Points = 2]

To find a value that is in an unordered array of 100 items, linear
search must examine an average of ________ values.

    A) 7
    B) 10
    C) 50
    D) 100
    E) 101



-------------------------------
Your Answer: A




Problem #21:         []
-------------------------------
[Points = 2]

When sorting an array of objects using bubble sort, if the values in the
data members of two neighboring objects are out of order, it is
necessary to ________.

    A) examine a different data member
    B) swap these two data values
    C) swap the two objects
    D) swap one-by-one all data members in the two objects
    E) stop the sort

-------------------------------
Your Answer: B


Problem #22:         []
-------------------------------
[Points = 3]

A selection sort based on maximum value is being used to arrange the
following list of numbers into ascending order:

          8   6   4    9    3    7

After the second pass of the sort is completed, what order will the
data be in?

    A) 8   6   4    7    3    9
    B) 3   4   6    7    8    9
    C) 3   6   4    9    8    7
    D) 3   6   4    7    8    9
    E) None of the above


-------------------------------
Your Answer: E




Problem #23:         []
-------------------------------
[Points = 2]

The statement cout << &num1; will output ________.

    A) the value stored in the variable num1
    B) the memory address of the variable num1
    C) the number 1
    D) the string "&num1"
    E) None of the above


-------------------------------
Your Answer: B



Problem #24:         []
-------------------------------
[Points = 2]

Assuming that arr is an array identifier, the statement sum += *arr; ________.

    A) adds the value stored in arr[0] to sum
    B) is illegal in C++
    C) will always result in a compiler error
    D) adds the address of the pointer arr to sum
    E) None of the above


-------------------------------
Your Answer: B




Problem #25:         []
-------------------------------
[Points = 2]

With pointer variables, you can ________ manipulate data stored in
other variables.

    A) never
    B) seldom
    C) indirectly
    D) All of the above
    E) None of the above


-------------------------------
Your Answer: C


Explanation / Answer

I did work for all of them and got the same answers for all. I have a doctorate in mathmatical sciences.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote