Showing posts with label Chapter 03. Show all posts
Showing posts with label Chapter 03. Show all posts

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