C++

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Which of the following is not a valid assignment statement? a. bool isPositive = true; b. const double SALES_TAX_RATE = 0.06; c. string director = "Ron Howard"; d. char letter = "Z";

D

An array can store a group of values but the values must be: a. all of the same data type b. each of a different data type c. integers d. strings

A

Which of the following assignment statements generates only values that can be obtained by rolling a six-sided die? a.int dieValue = rand()%6+1; b.int dieValue = rand()%6; c.int dieValue=rand()%7; d.int dieValue=rand()%7+1;

A

Which of the following cout statements displays the floating-point variable averageGrade in a field of 6 spaces, in fixed point notation, with a precision of 1 decimal place? a. cout <<setw(6)<<setprecision(1)<<fixed<<averageGrade; b. cout<<setw(6)<<averageGrade<<setprecision(1)<<fixed; c.cout<<setprecision(1)<<fixed<<averageGrade<<setw(6); d.cout<<averageGrade<<setprecision(1)<<fixed<<setw(6)

A

Which of the following loops always executes at least once? a. do-while b. while c. for d. none

A

A(n)______________is like a variable, but its value is read-only and cannot be changed during the program's execution. a. secure variable b. named constant c. locked variable d. uninitialized variable

B

How many times will the following loop display "Happy Easter!"? for (int i = 0; i<20; i++) cout<<"Happy Easter!"<<endl; a. 19 b. 20 c. 21 d. infinite

B

What will the following C++ code output? int answer = 42; int *ptr = &answer; cout<<*ptr<<endl; a. The address of the answer variable. b. 42 c. an asterisk followed by 42 d. an asterisk followed by the address of the answer variable.

B

Which of the following assignment statements correctly computes the area of a circle using the constant and variables defined below? The formula for the area of a circle is A=pir2 a. area=PI*(radius^2); b. area=PI*pow(radius,2); c. area=PI*pow(2,radius); d. area=(PI*radius)^2;

B

A set of well-defined steps for performing a task or solving a problem is known as a(n): a. hierarchy chart b. instruction set c. algorithm d. statement

C

A(n)_____variable keeps track of the number of iterations a loop performs. a. uninitialized b. secure c. counter d. none of the above

C

For which of the following assignment statements does answer have a value of 17? a. int answer = 4+30/2; b. int answer = 17+6%3-2; c. int answer = 17 + 6/3-2; d. int answer = 3-4*5

C

The for loop is a(n)______loop. a. indefinite b. posttest c. pretest d. none

C

The while loop is a(n)_____loop. a. indefinite b. posttest c. pretest d. none

C

What will the C++ code display? int scores [] = {99,87,66,55,101}; for (int i = 1; i<4; i++) cout << scores[i] << endl; a. 99,87,66,55,101 b. 87,66,55,101 c. 87,66,55 d. 99,87,66

C

Which of the following is not a valid assignment statement? a. int ticketsPurchased=100; b. string star = "Chris Pine"; c. 1250.75=double totalRevenue; d. float ticketPrice = 9.25;

C

Which of the following is not a valid variable name? a. hoursInDay b. December2018 c. letter in alphabet d. exam_2_score

C

A recursive function is designed to terminate when it reaches its_______. a. return statement b. closing curly brace c. last parameter d. base case

D

For which of the following assignment statements does result have a value of 6? a. int result=4+8/2 b. int result = 12/10-8 c. int result = 17+6%3-2; d. int result = 6+17%3-2

D

Here is the header for a function named getRadius: double getRadius() Which of the following is a valid call to the function? a. getRadius() b. double getRadius() c. double radius = getRadius() d. double radius = getRadius();

D

What does the following C++ statement do? double *num2; a. Declares a double variable named num2. b. Declares and initializes a pointer variable named num2. c. Initializes a variable named *num2. d. Declares a pointer variable named num2.

D

Which of the following if statements correctly displays an addition problem when problemType is equal to 1? a.if(problemType=1) cout<<"How much is 8+15?"; b.if(problemType==1);cout<<"How much is 8+15?"; c.if(problemType!=1)cout<<"How much is 8+15?"; d.if(problemType+==1)cout<<"How much is 8+15?";

D

Which of the following is a valid C++ array definition? a. int numbers [0]; b. int odds [5] = {1,3,5,7,9,11}; c. int numbers []; d. int evens [] = {2,4,6,8,10,12};

D

Which of the following is a valid variable name? a. words in paragraph b. 3d_Model c. paymentAmount$ d. January_2019

D

Which of the following statements correctly determines if grade is outside the range of 0 through 100? a. if (grade < 0 || > 100) b. if (grade <= 0 || >= 100) c. if (grade < 0 && grade > 100) d. if (grade < 0 || grade > 100)

D

which of the following is a valid cout statement? a. cout << "\nHappy Valentine's Day!" b. cout << endl << "Welcome to the Phildelphia FLower Show!" c. cout << "\nHappy Valentine's Day!;" d. cout << "Welcome to the Phildelphia FLower show!" << endl;

D


संबंधित स्टडी सेट्स

Chapter 39: Management of Patients with Oral and Esophageal Disorders

View Set

Insurance for senior citizens (disability)

View Set

Meteorology Final (Chapters 8 - 15)

View Set

OB practice questions 13,14,21 and prep u

View Set

Quiz 5 Material [Tumor Invasion and Metastasis]

View Set

Chapter 30: Abdominal and Genitourinary injuries.

View Set

EXERCISE 5. STRUCTURE OF THE RIB CAGE

View Set