C++ Chapter 2

Ace your homework & exams now with Quizwiz!

Preprocessor directives begin with a A) # B) ! C) < D) * E) None of the above

A) #

What will the following programs print on the screen? A) #include <iostream> using namespace std; int main() { int freeze = 32, boil = 212; freeze = 0; boil = 100; cout << freeze << endl << boil << endl; return 0; } B) #include <iostream> using namespace std; int main() { int x = 0, y = 2; x = y * 4; cout << x << endl << y << endl; return 0; } C) #include <iostream> using namespace std; int main() { cout << "I am the incredible"; cout << "computing\nmachine"; cout << "\nand I will\namaze\n"; cout << "you."; return 0; } D) #include <iostream> using namespace std; int main() { cout << "Be careful\n"; cout << "This might/n be a trick "; cout << "question\n"; return 0; }

A) 0 100 B)8 2

Every complete statement ends with a

C) semicolon

A group of statements, such as the contents of a function, is enclosed in A) Braces {} B) Parentheses () C) Brackets <> D) All of the above will do

C) Brackets <>

Which of the following are not valid cout statements? (Circle all that apply.) A) cout << "Hello World"; B) cout << "Have a nice day"\n; C) cout < value; D) cout << Programming is great fun;

C) cout < value; D) cout << Programming is great fun;

Write assignment statements that perform the following operations with the variables a , b , and c .

A) B) C) D) E) F) G)

Every C++ program must have a A) cout statement B) function main C) #include statement D) All of the above

A) Function main

Which of the following statements is correct? A) #include (iostream) B) #include {iostream} C) #include <iostream> D) #include [iostream] E) All of the above

B) #include <iostream>

Which of the following are not valid assignment statements? (Circle all that apply.) A) total = 9; B) 72 = amount; C) profit = 129 D) letter = 'W';

B) 72 = amount;

The following data 72 'A' "Hello World" 2.8712 are all examples of A) Variables B) Literals or constants C) Strings D) None of the above

B) Literals or constants


Related study sets

LUOA 9th Grade Girls Health and PE Module 3 Midterm Exam Study Guide

View Set

Medical-Surgical Cardiovascular and Hematology

View Set

MKT Unit 11 (Distribution, Cust. Service & Logistics)

View Set

06-04 list-addition/retrieval/deletion

View Set

Which of the following common components of culture is the one that "gives away" or tells us so much more about a group's culture than any of the others? Question options: group identity symbols values language norms

View Set

Rosenthal NCE Practice Questions

View Set