CSC 134 Quiz 3

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Assume that a program has the following variable definition: char letter; Which of the following statements correctly assigns the character Z to the variable?

letter = 'Z';

Assume that a program has the following string object definition: string name; Which of the following statements correctly assigns a string literal to the string object?

name = "Jane";

A variable's __________ is the part of the program that has access to the variable.

scope

What is the output of the following statement? cout << 4 * (15 / (1 + 3)) << endl;

12

Look at the following program and answer the question that follows it. 1 // This program displays my gross wages. 2 // I worked 40 hours and I make $20.00 per hour. 3 # include <iostream> 4 using namespace std; 5 6 int main( ) 7 { 8 int hours; 9 double payRate, grossPay; 10 11 hours = 40; 12 payRate = 20.0; 13 grossPay = hours * payRate; 14 cout << "My gross pay is $" << grossPay << endl; 15 return 0; 16 } Which line(s) in this program cause output to be displayed on the screen?

14

In the C++ instruction, cookies = number % children; given the following declaration statement: int number = 38, children = 4, cookies; what is the value of cookies after the execution of the statement?

2

What will the value of x be after the following statements execute? int x; x = 18 / 4;

4

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 4 int main( ) 5 { 6 const int MY_VAL = 77; 7 MY_VAL = 99; 8 cout << MY_VAL << endl; 9 return 0; 10 }

7

What will the following code display? int number = 7; cout << "The number is " << "number" << endl;

The number is number

How would you consolidate the following declaration statements into one statement? int x = 7; int y = 16; int z = 28;

int x = 7, y = 16, z = 28;


Kaugnay na mga set ng pag-aaral

Protection of Information Assets

View Set

United States Foreign Relations midterm

View Set

Radiographic Image Quality - Chapter 10 Evolve

View Set

A-level Psychology; Psychopathology

View Set