Chapter 4 Quiz Starting Out With C++ 002

What does x <= y mean?

a. x is less than y
b. x is less than or equal to y
c. assign the value of y to x if x less than
d. none of the above

Chapter 4 Quiz Starting Out With C++ 001

Which of the following is not a relational operator?

a. ==
b. >
c. <
d. =

Chapter 3 Quiz Starting Out With C++ 040

What is the purpose of flowcharting?

a. plan out the program before coding
b. Mr. Daniels likes pretty symbols
c. visual display of the program
d. all of the above

Chapter 3 Quiz Starting Out With C++ 039

How to you get a random number in C++?

a. x=rnd();
b. x=random();
c. x=rand();
d. x=randomNum();

Chapter 3 Quiz Starting Out With C++ 038

 C++ has a runtime library for performing math?

a. True
b. False

Chapter 3 Quiz Starting Out With C++ 037

 The cin.ignore function tells the cin object to skip one or more characters in the keyboard buffer.

a. True
b. False

Chapter 3 Quiz Starting Out With C++ 036

cin.get is used for reading in characters

a. True
b. False

Chapter 3 Quiz Starting Out With C++ 035

What does getline do?

a. reads an entire line including whitespaces
b. reads an entire line except whitespaces
c. a whole word
d. none of the above

Chapter 3 Quiz Starting Out With C++ 034

 What are whitespace characters?

a. spaces
b. spaces and tabs only
c. spaces, tabs, or line breaks
d. none of the above

Chapter 3 Quiz Starting Out With C++ 033

Which of the following statements will display the following result if x is 123.4?

123.400

a. cout << setprecision(6) << showpoint << x << endl;
b. cout << setw(6) << x << endl;
c. cout << showpoint << x << endl;
d. cout << showpoint(3) << x << endl;

Chapter 3 Quiz Starting Out With C++ 032

What do you use to print digits in fixed-point notation or decimal?

a. setprecision
b. setw
c. fixedpoint
d. fixed

Chapter 3 Quiz Starting Out With C++ 031

 You can control the number of significant digits with which floating-point values are displayed by using the

a. setw
b. significant
c. setprecision
d. cast

Chapter 3 Quiz Starting Out With C++ 030

setw

a. sets the width of the screen
b. establishes print fields of a specified width
c. sets the precision of the variable
d. None of the above

Chapter 3 Quiz Starting Out With C++ 029

 _____ provides a way to output data and _____ allows for input of data

a. cin, cout
b. input, output
c. cout, cin
d. output, input


Chapter 3 Quiz Starting Out With C++ 028

Will the following produce the same result?

x *= 5       x = x * 5

a. True
b. False

Chapter 3 Quiz Starting Out With C++ 027

 What does the value of x in the code fragment below?

c = 5;
x = 5 * (c++);

a. 6
b. 25
c. 30
d. 0 (since c++ has not been defined

Chapter 3 Quiz Starting Out With C++ 026

Is the following a valid assignment?

x = y = z = 10;

a. True
b. False

Chapter 3 Quiz Starting Out With C++ 025

Can multiple assignments be used in C++

a. True
b. False

Chapter 3 Quiz Starting Out With C++ 024

What is type casting in C++

a. manually promoting or demoting a value
b. forcing an integer to hold a double or float
c. making it possible to add two different type variables to be added
d. None of the above

Chapter 3 Quiz Starting Out With C++ 023

What is an Overflow

a. When you try to use a value larger the the data type of the variable
b. When the computer runs out of memory
c. When a variable is uninitialized
d. None of the above

Chapter 3 Quiz Starting Out With C++ 022

In C++, if you divide the integers 7 by 2 the answer will be

a. 3.5
b. 3
c. 2
d. undefined since the answer is a float

Chapter 3 Quiz Starting Out With C++ 021

 When the final value of an expression is assigned to a variable, it will be converted
to the data type of that variable.

a. True
b. False

Chapter 3 Quiz Starting Out With C++ 020

When an operator works with two values of different data types, the lower-ranking
value is promoted to the type of the higher-ranking value.

a. True
b. False

Chapter 3 Quiz Starting Out With C++ 019

chars, shorts, and unsigned shorts are automatically promoted to type int.

a. True
b. False

Chapter 3 Quiz Starting Out With C++ 018

What happens in C++ when operator's operands are of different types?

a. Nothing
b. C++ will convert to the same data type
c. C++ will convert to the largest data type
d. C++ will convert to the lowest data type

Chapter 3 Quiz Starting Out With C++ 017

 To calculate the average of two numbers in C++

a. x + y/2
b. (x + y)/2
c. x/2 + y
d. All of the above

Chapter 3 Quiz Starting Out With C++ 016

 How do you do exponents in C++ for 2.0 raised to 4.0

a. 2.0^4.0
b. pow(2.0, 4.0)
c. 2.0*4.0
d. None of the above

Chapter 3 Quiz Starting Out With C++ 015

How do you write the sum of X plus Y divided by Z in C++

a. x + y/z
b. (x +y)/z
c. X + Y/Z
d. (X + Y)/Z

Chapter 3 Quiz Starting Out With C++ 014

In the following expression what is the answer

6 * (2 + 4) - 5

a. 11
b. 31
c. 6
d. None of the above

Chapter 3 Quiz Starting Out With C++ 013

 What has the lowest precedence?

a. * (asterick)
b. / (division)
c. + (plus)
d. - (unary negation)

Chapter 3 Quiz Starting Out With C++ 012

What is operator precedence?

a. What numbers will be processed first.
b. What expressions are stored before others
c. Some types are stored higher in memory
d. Some operators are evaluated before others