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

QUESTION 1 1. A function\'s type is the same as the type of its return value Tru

ID: 3833488 • Letter: Q

Question

QUESTION 1

1.     A function's type is the same as the type of its return value

True    False

1 points   

QUESTION 2

1.     It is possible to have functions that do not return any value

True    False

1 points   

QUESTION 3

1.     Every function needs to be supplied with at least one argument when it is invoked

True    False

1 points   

QUESTION 4

1.     There is a limit on the number of times a function can be called (invoked) during program execution.

True

False

1 points   

QUESTION 5

1.     All the elements of an array have the same name

True

False

1 points   

QUESTION 6

1.     The size of an array that contains at most ten items is 10.

True

False

1 points   

QUESTION 7

1.     The subscript of the first element of an array is 1.

True

False

1 points   

QUESTION 8

1.     If the array index/subscript of the studentID array ranges from 0 to 49, the second element of the studentID array is referred to as studentID[2].

True

False

1 points   

QUESTION 9

1.     If itemNum = 5 and elemNum = 5, then “cout << Scores[itemNum]” will output the same value as “cout << Scores[elemNum]”.

True

False

1 points   

QUESTION 10

1.     If the size of an integer array, intArr, is 5 then intArr[5] is a valid element of the array

True

False

1 points   

QUESTION 11

1.       If a function accepts two arguments of different types and a caller invokes the function by reversing the order of the arguments, then this results in a(n) ___________ error.

A.

logical

B.

syntax

C.

declaration

D.

type

1 points   

QUESTION 12

1.     If a function declaration specifies a list of three parameters, then the number of arguments that need to be passed to that function when it is called is ____.

A.

3

B.

2

C.

1

D.

0

2 points   

QUESTION 13

1.     The maximum number of values that a function can return is ____.

A.

1

B.

0

C.

3

D.

infinite

1 points   

QUESTION 14

1.     The position of an item within an array is indicated by its ____.

A.

index (or subscript)

B.

value

C.

order

D.

address

1 points   

QUESTION 15

1.            What What is the output of the following code segment?

int score[4] = {4, 5, 1, 8}

cout << score[3] – 2;

A.

6

B.

-1

C.

2

D.

5

2 points   

QUESTION 16

1.            How How many times does the following search loop execute when it looks for a value of 500 in the itemCode array?

int itemCode[5] = {50, 500, 1000, 2000, 2500}

int stop = 0;

index = 0;

while (index < 5 AND stop == 0)

{

if (itemCode[index] == 500)

     stop = 1

  endif

index = index + 1

}

A.

1

B.

3

C.

2

D.

5

3 points   

QUESTION 17

1.            If ind If index is an integer variable and intArray is an array of integers, then _______ is NOT a valid assignment.

A.

intArray[x] = index * 2

B.

intArray[x] = index

C.

index = intArray[x]

D.

intArray[x] = intArray

2 points   

QUESTION 18

1.     How many columns are there in an array that is declared as, integer intArray[5][6]?

30

5

6

11

1 points   

QUESTION 19

1.            The e The elements of a two-dimensional array, intTable, are initialized as follows. What is the initial value of intTable[1] [1]?

integer intTable[2][3] = {1, 0, 5}, {4, 5, 2}

A.

4

B.

5

C.

2

D.

0

3 points   

QUESTION 20

1.       When a copy of a variable is made and passed as an argument to a function, the variable is said to be passed by ____.

A.

pointer

B.

name

C.

value

D.

reference

1 points   

QUESTION 21

1.        When an object is passed by reference to a function, the invoked function receives ____.

A.

The memory address of the object

B.

the name of the object

C.

a copy of the object

D.

the value of the first data element in the object

2 points   

QUESTION 22

1.            The array element empSalary[X] stores the salary of an employee who is identified as X. Assume the following function call is made:  upgradeSalary(empSalary[X])

The code for the upgradeSalary( ) function is as follows.

void upgradeSalary(double salary)


   { bonus = 0.25 * salary


       salary = salary + bonus }


return



If empSalary[X] = $1000, what is the value of empSalary[X] after the function returns?

A.

1,000.00

B.

1,250.00

C.

1,002.50

D.

1,025.00

3 points   

QUESTION 23

1.       If intTable is a two dimensional array of integers and intVal is an integer variable, then the statement that assigns the value of intVal to the element occupying the second row and first column of intTable is ____.

A.

intTable[1][0] = intVal

B.

intTable[2][1] = intVal

C.

intTable[1][2] = intVal

D.

none of the above

2 points   

QUESTION 24

1.     Given a linear array (one-dimensional) consisting of 17 elements, what is the integer value of the initial index generated in order to perform a binary search on the array.

A.

0

B.

8

C.

9

D.

17

2 points   

QUESTION 25

1.     Given the followin array:

myArray [16] = {10, 20, 25, 30, 35, 40, 42, 46, 52, 55, 58, 60, 63, 67, 72, 75}

Using a linear search, how many searches are required to locate an element whose value is 30?.

A.

4

B.

3

C.

16

D.

5

2 points   

QUESTION 26

1.             Given the followin array:

myArray [16] = {10, 20, 25, 30, 35, 40, 42, 46, 52, 55, 58, 60, 63, 67, 72, 75}

Using a biary search, how many searches are required to locate an element whose value is 30?.

A.

5

B.

2

C.

16

D.

4

QUESTION 27

1.     In a function header definition, the list of formal parameters must conform to the actual parameters as follows:

A.

There must be exactly the same number of formal parameters as there are actual parameters

B.

Each formal parameter must be of the same data type as the corresponding actual parameter.

C.

None of the above (neither A nor B)

D.

A and B

2 points   

QUESTION 28

1.     What is the output from the following code segment?

...

...

int function01 (int a, int b)

{

return (function02( b) + 2*a);

}


function02 (int x)

{

return (x + 5);

}

main()

{

int a(3), b(5);

  cout << " a = " << function01 (a, b) << endl;

return 0;

}

A.

a = 3

B.

a = 8

C.

a = 16

D.

a = 6

3 points   

Click Save and Submit to save and submit. Click Save All Answers to save all answers.

A.

logical

B.

syntax

C.

declaration

D.

type

Explanation / Answer

1.    True
2.    True -> Void functions
3.    False
4.    False
5.   True
6.   True
7.   False -> First Subscript is 0
8.   False -> Second element should be referred to as studentID[1]
9.   True -> Both refers to same index 5
10.   False -> Valid are intArr[0] to intArr[4]
11.   D Type Error
12.   A 3 arguments needs to be passed
13.   A Only one value
14.   A
15.   A (8 - 2 = 6)
16.   C For index 0 and 1
17.   D intArray[x] accepts only integers but array is assigned
18.   Columns : 6
19.   A (4)
20.   C
21.   A
22.   A (Value is Passed not reference. So there is no update on value of empSalary[X] after function call)
23.   A (Second row is indicated by 1, first column by 0)
24.   C (Initial index is 9 (size/2))
25.    A (4 searches required)
26.   B (2)
27.   D
28.   C (16)

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