1.4 Errors and warnings (All Questions)

Ace your homework & exams now with Quizwiz!

An experienced programmer writes 80 lines of code, and then compiles and runs. The programmer is probably _____ . 1. programming dangerously 2. following good practice

1

A new programmer writes 5 lines of code, compiles and runs, writes 5 more lines, and compiles and runs again. The programmer is _____ . 1. wasting time 2. following good practice

2

A compiler generates the following error messages: Line 7: Missing semicolon Line 9: numItems not defined Line 10: Expected '(' If the programmer does NOT find an error on line 7, the programmer should check line _______.

6

A compiler generates the following error messages: Line 7: Missing semicolon Line 9: numItems not defined Line 10: Expected '(' The programmer should start by examining line _______.

7

Find the syntax errors. Assume variable numDogs has been declared. Error or No Error? cout << "Dogs: " numDogs;

Error

Find the syntax errors. Assume variable numDogs has been declared. Error or No Error? cout < "Everyone wins.";

Error

Find the syntax errors. Assume variable numDogs has been declared. Error or No Error? cout << "Hello friends! << "\n";

Error

Find the syntax errors. Assume variable numDogs has been declared. Error or No Error? cout << NumDogs << "\n";

Error

Find the syntax errors. Assume variable numDogs has been declared. Error or No Error? cout << numDogs.

Error

Find the syntax errors. Assume variable numDogs has been declared. Error or No Error? cout >> numDogs >> "\n";

Error

Find the syntax errors. Assume variable numDogs has been declared. Error or No Error? int numCats numCats = 3; cout << numCats << "\n";

Error

True or False? A compiler warning by default will prevent a program from being created.

False

True or False? A compiler's default settings cause most warnings to be reported during compilation.

False

True or False? If a compiler generates a specific message like "missing semicolon", then a semicolon must be missing somewhere, though maybe from an earlier line.

False

True or False? If a compiler says that an error exists on line 90, the actual error may be on line 91, 92, etc.

False

True or False? When a compiler says that an error exists on line 5, that line must have an error.

False

Find the syntax errors. Assume variable numDogs has been declared. Error or No Error? cout << Amy // Michael" << "\n";

No error

True or False? Generally, a programmer should not ignore warnings.

True

A compiler generates the following error messages: Line 7: Missing semicolon Line 9: numItems not defined Line 10: Expected '(' If the programmer finds an error on line 7, the programmer should ______.

compile

Type the statements below and correct the one syntax error in each. cout << "Num: " << songnum << endl; cout << int songNum << endl; cout << songNum " songs" << endl;

cout << "Num: " << songNum << endl; cout << songNum << endl; cout << songNum << " songs" << endl;

Type the statements below and correct the one syntax error in each. cout << "Predictions are hard." << end; cout << "Especially '; cout << "about the future." << endl. cout << "Num is: " << userNum >> endl;

cout << "Predictions are hard." << endl; cout << "Especially"; cout << "about the future/" << endl; cout << "Num is: " << userNum << endl;


Related study sets

JS Arrays, Modern JavaScript & a little TypeScript Execute Program

View Set

Chapter 2 - Sets and Venn diagrams

View Set

RPA 2 - Ch. 3 Keogh & Small Employer Plans

View Set

Normal Distributions and Z-Score

View Set

Floral; Chapter 19; History of Floral Design

View Set

Photography for Games: Final Exam Study Guide

View Set

Blood, Toil, Tears and Sweat !!!!ANSWER KEY!!!!

View Set