Question

In: Computer Science

True/False 1. An automatic storage class variable is stored in the runtime stack 2. When a...

True/False

1. An automatic storage class variable is stored in the runtime stack

2. When a value parameter is passed to a function, the function called utilizes a copy of that parameter which is internal to the function called

3. When a reference parameter is passed to a function, the function called receives the memory address of that parameter and does not make a copy of it

4. Debug flags often control extra output to be printed conditionally

Multiple choice

1. An interactive debugger can be used to

a. set statements at which to pause the running program and examine critical variables

b. observe the flow of control as the program runs

c. set the values of critical variables during the actual run, and change them to look at what happens

d. all of the above

2. Debug flags in a program

a. should be removed before the next version is worked on, as they will annoy the future programmers

b. should be left in for the next version to be worked on, as they will help the new programmers to do future testing; they can be deactivated and activated as needed

c. should never be used as they cause extra lines in the code and that is not efficient

3. Black box testing is

a. when a programmer tests the code they write as they work on it

b. when a program development manager tests the code after it has been completely written

c. when a possible user of the code tests it by running and using it, without being able to see the actual code at all

d. when a program is released to the public and a very large group of users all test it at once in real life

4. When a function is called during program execution

a. an activation record is allocated on the runtime stack to store data needed by the function to execute

b. the compiler generates a stack frame in the source code

c. copies will be created of value parameters, and addresses will be stored for reference parameters, in the activation record for the function called

d. both a and c

5. Given the following for loop body, the value of count when the loop exits is

for (int count = 0; count < 10; count++) cout << count << endl;

a. 0 b. 9 c. 10 d. 11

6. The srand function (A) should be called before each call to rand( ) (B) should be used instead of rand( ) to generate truly random numbers(C) is unnecessary in C++ (D) can use the actual time from the hardware clockas a seed value

7. Which statement about the rand( ) function is false?(A) a call to rand( ) generates a value between INT_MIN and INT_MAX (B) the expression rand( ) % 5 always produces a value between 0 and 4 (C) the range of values generated by rand( ) is not always what is needed in a particular program (D) the prototype for rand( ) is in cstdlib

8. Most serious program bugs are the result of a. syntax errors b. semantic errors c. runtime errors d. typographical errors

Solutions

Expert Solution

True/False

1. An automatic storage class variable is stored in the runtime stack

True

2. When a value parameter is passed to a function, the function called utilizes a copy of that parameter which is internal to the function called

True

3. When a reference parameter is passed to a function, the function called receives the memory address of that parameter and does not make a copy of it

True

4. Debug flags often control extra output to be printed conditionally

False

Multiple choice

1. An interactive debugger can be used to

a. set statements at which to pause the running program and examine critical variables

b. observe the flow of control as the program runs

c. set the values of critical variables during the actual run, and change them to look at what happens

d. all of the above

Answer: d. all of the above

2. Debug flags in a program

a. should be removed before the next version is worked on, as they will annoy the future programmers

b. should be left in for the next version to be worked on, as they will help the new programmers to do future testing; they can be deactivated and activated as needed

c. should never be used as they cause extra lines in the code and that is not efficient

Answer: b. should be left in for the next version to be worked on, as they will help the new programmers to do future testing; they can be deactivated and activated as needed

3. Black box testing is

a. when a programmer tests the code they write as they work on it

b. when a program development manager tests the code after it has been completely written

c. when a possible user of the code tests it by running and using it, without being able to see the actual code at all

d. when a program is released to the public and a very large group of users all test it at once in real life

Answer: c. when a possible user of the code tests it by running and using it, without being able to see the actual code at all

4. When a function is called during program execution

a. an activation record is allocated on the runtime stack to store data needed by the function to execute

b. the compiler generates a stack frame in the source code

c. copies will be created of value parameters, and addresses will be stored for reference parameters, in the activation record for the function called

d. both a and c

Answer: d. both a and c

5. Given the following for loop body, the value of count when the loop exits is

for (int count = 0; count < 10; count++) cout << count << endl;

a. 0

b. 9

c. 10

d. 11

Answer: c. 10

6. The srand function

(A) should be called before each call to rand( )

(B) should be used instead of rand( ) to generate truly random numbers

(C) is unnecessary in C++

(D) can use the actual time from the hardware clockas a seed value

Answer: (B) should be used instead of rand( ) to generate truly random numbers

7. Which statement about the rand( ) function is false?

(A) a call to rand( ) generates a value between INT_MIN and INT_MAX

(B) the expression rand( ) % 5 always produces a value between 0 and 4

(C) the range of values generated by rand( ) is not always what is needed in a particular program

(D) the prototype for rand( ) is in cstdlib

Answer: (C) the range of values generated by rand( ) is not always what is needed in a particular program

8. Most serious program bugs are the result of

a. syntax errors

b. semantic errors

c. runtime errors

d. typographical errors

Answer: b. semantic errors


Related Solutions

1)True or False: Ambiguity is a type of vagueness True False 2)True or False: When determining...
1)True or False: Ambiguity is a type of vagueness True False 2)True or False: When determining whether a report of an argument should be treated as an argument, it is important to consider the context in which the report is made. True True False 3) True or False: In a V argument with two premises, if one of the premises is false, then the argument is definitely weak True False 4) True or False: A report of an argument can...
1.) A class template can be derived from a non-template class True or False 2.) Inaccessible...
1.) A class template can be derived from a non-template class True or False 2.) Inaccessible pointer is a potential problem on simple linked list True or False 3.) Array based lists are faster in term of acing data True or False 4.) Simple linked lists use less space than double linked lists True or False 5.) For large lists "array based lists" are more efficient for insertion and deleting operational True or False 6.) We can remove data only...
1. True or False: Disaster Planning is not part of the BCP? 2. True or False:...
1. True or False: Disaster Planning is not part of the BCP? 2. True or False: you still need a BCP or DRP if you have business liability insurance, asset replacement insurance and natural disaster insurance 3. True or False: If a business cannot operate, the BCP assists in bringing the business back to life and operational readiness. 4. True or False: a BIA helps define the scope of the BCP itself. 5. True or False: The purpose of having...
1.Is the following statement true or false? For simple linear regression (i.e., when we predict variable...
1.Is the following statement true or false? For simple linear regression (i.e., when we predict variable Y only on the basis of variable X), the standardized regression coefficient (β) will be equal to the Pearson correlation coefficient (r). 2. Please consider the following values for the variables X and Y. Treat each row as a pair of scores for the variables X and Y (with the first row providing the labels "X" and "Y"). X Y 2 4 4 3...
Slack variable coefficients of 1 in the objective function. true or false
Slack variable coefficients of 1 in the objective function. true or false
True or False: a.) In a statistical study, the random variable X = 1, if the...
True or False: a.) In a statistical study, the random variable X = 1, if the house is colonial and X = 0 if the house is not colonial, then it can be stated that the random variable is continuous. b.) For a continuous distribution, P(X ≤ 10) is the same as P(X<10). c.) For a continuous distribution, the exact probability of any particular value is always zero. d.) For a binomial probability experiment, with n = 60 and p...
True or False Questions: Please answer true or false. 1. Even when care is free at...
True or False Questions: Please answer true or false. 1. Even when care is free at the point of service, we would expect low and high-income individuals with the same level of need to demand different quantities of health care. 2. We would expect the demand curve for physician visits to be more price elastic than the demand curve for inpatient hospital care. 3. A decision by the provincial governments to include counseling by psychologists within the public insurance plan...
1. True or false. The mass of a closed system cannot change. 2. True or false....
1. True or false. The mass of a closed system cannot change. 2. True or false. Fahrenheit scale cannot be used in thermodynamics relations. 3. True or false. An extensive property can be a function of time and location. 4. True or false. If a system is at steady state, then the density is uniform throughout the system. 5. True or false. All modes of heat transfer between two bodies must occur when the two bodies are in contact. 6....
1) TRUE OR FALSE: Parameters yield populations 2) TRUE OR FALSE: In a study entitled the...
1) TRUE OR FALSE: Parameters yield populations 2) TRUE OR FALSE: In a study entitled the relationship between study time and grades, study time is the predictor variable. 3) TRUE OR FALSE: Only experiments involve direct measurement by the researcher. 4) A response variable is also an outcome variable. 5) Statistical methods that use sample data to make statements about populations are called inferential statistics. 6) The IV is the variable that can be randomly assigned by the researcher.
2) True or False (If statement is false, correct it so that it is true) a)...
2) True or False (If statement is false, correct it so that it is true) a) Polymers make up an exciting class of biomaterials. Polyethylene is a wonderful example of a simple ceramic that can be used in multiple applications by modifying its chemical structure. It tends to be bioactive when used by itself as an implant, but it becomes even more bioactive when 10 vol% Calcium Carbonate is added to it. Teflon can be used as a vascular graft...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT