1251. Two access specifers in c++ are
Public and private
1252. A data member holds a 1 or 0 depending on whether taxes have been paid. The best identifier for this member is _____
Paidtaxes
1253. Assume a class derv that is privately derived from class base. An object of class derv located in main() can access
Public members of base
1254. Which of the following is an access specifier?
Protected
1255. Machine code is _____
The 0s and 1s that the computer can understand
1256. The contents of two pointers that point to adjacent of type float differ by
Four bytes
1257. Which of the following is a valid condition for an if statement? (the condition should be both syntactically and logically valid.)
(sales > 100 && sales <= 1000)
1258. A pattern for creating an object is called a(n) _____
Class
1259. An asterisk placed after a data type means .
Pointer to
1260. An object is a(n) _____ of a class
Instance
1261. Which of the following statements creates and initializes a pointer named salesptr?
Float *salesptr = null;
1262. With communicational cohesion
The data are related; the tasks are not
1263. The function printdatamembers() is mot likely a(n) ________
Inspector functions
1264. The data type listed at the beginning of a value-returning function’s header indicates the type of data the function will _____
Return
1265. The code class descendant : virtual public ancestor indicates that
The members of ancestor will be included only once in descendant
1266. Inheritance is the principle that
Knowledge of a general category can be applied to more specific objects
1267. Which of the following formulas can be used to generate random integers between 1 and 10?
1 + rand() % (10 – 1 + 1)
1268. Format flags may be combined using the _____
Bitwise or operator(|)
1269. Which of the following will store the number 320000 as a float number?
Counpop = (float) 3.2e5;
1270. The arguments that determine the state of the cout object are called
Format flags or state flags
1271. If a class will serve as a base class, most often the base class data members are
Public
1272. You can use the c++ _____ function to assign a value to a string variable
Strcpy
1273. A measure of the strength of the connection between two functions is
Coupling
1274. The following statement where t is true and f is false t&&t||f&&t
Is true
1275. Which of the following statements declares a variable that can contain a decimal number?
Float hourlypay;
1276. The statement int num[2][3]={ {1,2}, {3,4}, {5, 6} };
Gives an error message
1277. A program will have one function prototype for each function defined in the programmer-defined section of the program. (assume that the programmer-defined section is located below the main function.)
True
1278. The standard input stream, which refers to the keyboard, is called
Cin
1279. If the code and fee arrays are parallel, the fee that corresponds to the code stored in the code[3] element is located in the _____ element
Fee[3]
1280. Access specifiers are followed by
A colon
1281. Elements in an array are identified by a unique _____
Subscript
1282. To include the double quotes as part of the control string we use the symbol
\”
1283. A c++ statement must end in a
; (semicolon)
1284. Constructor call with no arguments
Prototype for a function that returns a student object
1285. The statement int n[4] = {11, -13, 17, 105};
Assigns the value 17 to n[2]
1286. The comma operator (,) is primarily used in conjunction with
‘For’ statement
1287. To execute a c++ program, you first need to translate the source code into object code. This process is called
Compiling
1288. The rules of a programming language are called its _____
Syntax
1289. An array element is accessed using
An index number
1290. The program can access the private members of a class directly
Only through other public members of the class
1291. To hide a data member from the program, you must declare the data member in the _____ section of the class
Private
1292. External documentation includes
A printout of the program’s code
1293. A function that is called automatically each time an object is created is a(n)
Constructor
1294. A variable’s _____ indicates how long the variable remains in the computer’s memory
Lifetime
1295. The function whose prototype is void getdata(item *thing); receives
A pointer to a structure
1296. You may override the class access specifier for_____
Any specific class members you choose
1297. The null character needs a space of
One byte
1298. The number of structures than can be declared in a single statement is
Unlimited
1299. The cout << sales[0] + sales[1]; statement will______
Display 22000
1300. The most efficient data type for a variable that stores the letter c is the _____ data type
Character
1301. The c++ operator used to allocate memory is _________
New
1302. Assume that your version of c++ can recognize only the first 8 characters of an identifier name, through identifier names may be arbitrarily long. Which of the following identifier names is not distinct:
Identifier_l, identifier_2
1303. Object is to class as _____
Plato is to philosopher
1304. A derived class may also be called a
Subclass
1305. The c++ keyword for declaring a variable that contains a decimal point is _____
Float
1306. When you define an object that is a member of a class, such as student abby; _____
A block of memory is set aside
1307. A program can directly access the _____ members of a class
Public
1308. Any output manipulator function you create _____
Should take as an argument an instance of ostream as a reference
1309. To pass an array by reference, you
Do not have to do anything because arrays are automatically passed by reference
1310. The instructions you enter into the computer are called the _____
Source code
1311. The string data type is an extension of the _____ data type
Character
1312. An advantage of using local variables is that _____
The program does not become “crowded” with too many variable names
1313. The difference between a return and a throw is that _____
With a return, execution takes place at the location from which the function was called
1314. Which is a good reason for passing a variable’s address to a function?
The called function can change the value of the variable in the calling function
1315. The string hello world needs
11 bytes
1316. Library header files usually contain
Function prototypes for functions stored in other files
1317. A c++ term meaning “generic” is
Parameterized
1318. Before object-oriented exception handling was practiced, _____
The most popular error-handling method was to terminate the program
1319. The preprocessor directive always ends with
Neither a semicolon nor a comma
1320. A constructor initialization list produces similar results to
Assignment
1321. Which of the following stream manipulators advances the cursor to the next line on the computer screen?
Endl
1322. 6.5 is a _____ constant
Numeric literal
1323. The time and memory involved in calling a function represent the function’s _____
Overhead
1324. Which function is most likely to have procedural cohesion?
Main()
1325. A pointer is
A variable for storing addresses
1326. The instruction “if it’s raining outside, then take an umbrella to work” is an example of the _____ structure
Selection
1327. Which of the following statements will assign the address of the age variable to the ageptr pointer?
Ageptr = &age;
1328. The >> (extraction) operator stops reading characters from the keyboard as soon as the user _____
Presses the enter key
Types a character that is inappropriate for the variable’s data type
1329. In the statement template<class t>,
T is a scalar variable
1330. The null character is represented by
\0
1331. The break statement is
A keyword in the c++ language
1332. A variable w with a value 67 may be defined with _______
Int w = 67;
Int w(67);
1333. An expression contains relational, assignment and arithmetic operators. In the absence of parentheses, the order of evaluation will be
Arithmetic, relational, assignment
1334. The keyword virtual indicates that
A base class should be used only once in inheritance
1335. If you declare two objects as customer firstcust, secondcust; which of the following must be true?
Each object will store a separate copy of any nonstatic data members
1336. Which of the following are valid characters for a numeric literal constant?
A decimal point
The letter e
A minus sign
A plus sign
1337. Any #include files may contain
Constants
Variables
Functions
1338. When a break statement is used in a loop, the control skips the rest of the statements in the loop after it and jumps
To the next statement written after the body of the loop
1339. The function that takes arguments to set the bits of count is _____
Setf()
1340. When two types are used in a function template and one is labeled t, the other
Must also be named t
1341. Making class members inaccessible to nonmember functions is an example of
Data hiding
1342. Providing two or more constructors for the same class _____
Requires different argument lists
1343. 3 is a _____ constant
Numeric literal
1344. _____ variables remain in memory until the statement block ends
Local
1345. An address is a _____ , while a pointer is a _____
Variable, location
1346. Procedural cohesion is similar to sequential cohesion, except that with procedural cohesion _____
The tasks do not share data
1347. Which of the following creates an animal object named dog?
Animal dog;
1348. The extraction operator >> is a(n)
Overloaded function
1349. One drawback to returning an error code from a function is _____
A function can return only one value, so it can return only the error code
1350. Assuming the following three operators appear in an expression (without parentheses), which of the operators will be performed first?
!
1351. The code that you enter into a c++ program is called _____
Source code
1352. The statement double total = 0.0; performs _____
Initialization
1353. The two parts of a function are the
Header and body
1354. The general principle underlying object-oriented error handling is that a called function should __________
Check for errors but not be required to handle any detected
1355. Which of the following is false?
Assuming calcnewprice is the name of a value-returning function, calcnewpriceo; is a both logically and syntactically valid c++ statement
1356. Both void and value-returning functions can receive arguments. Reference variables and const class member
Must be initialized, rather than assigned values
1357. The actual arguments cannot be
Of a different type from the corresponding formal arguments
1358. The function stricmp(“jose”, “jose”) will return _____
0
1359. Which is true?
Logical cohesion is stronger than coincidental cohesion
1360. A predefined function that may be used to handle memory allocation errors is
Set_new_handler
1361. A function in a derived class that has the same name as a function in the parent class _____
Will override the base class function
1362. The _____ function returns the uppercase equivalent of a character
Toupper
1363. A constructor may be _____
Provided automatically by c++
1364. Software that can be used in applications other than the one for which it was originally written is called
Reusable
1365. Which of the following statements is false?
A class is considered an object
1366. Typing the function’s name as main, rather than main, is an example of
A syntax error
1367. When the compiler cannot differentiate between two overloaded constructors, they are called______
Ambiguous
1368. A function argument is
A value sent to the function by the calling program
1369. A function that is prototyped as double calculate(int num); may______
Receive an integer constant such as 5
1370. Passing a variable pointer as a constant _____
Protects the contents pointed to by the pointer from change
1371. Recursive functions
Necessary to solve a certain class of problems
1372. The purpose of a conditional operator is to
Select one of the two values depending on a condition
1373. Which of the following, if any, are valid names for variables?
Amt_sold
1374. Assume you want to compare the character stored in the initial variable to the letter a. Which of the following conditions should you use in the if statement? (be sure the condition will handle a or a.)
(toupper(initial) == ‘a’)
1375. You can override a class’s inherited access to make an individual member’s access more ______
Conservative
1376. A class hierarchy
Describes “is a kind of” relationships
1377. Which of the following c++ expressions is equivalent to the mathematical expression 53 ?
Pow(5, 3)
1378. The right shift operator is represented by the symbol
->
1379. In c++, class definitions are most often
Stored in a header file that is included in the programs that use them
1380. If no constructors can specified for a derived class, objects of the derived class will use the constructors in the base class
True
1381. The get() function returns _____
A reference to the object that invoked it
1382. The most efficient data type for a variable that the number 20000 is the _____ data type
Short integer
1383. The number 5.5e3 is a _____ constant
Numeric literal
1384. The compiler determines the type used in a template function via ___________
The type of the argument passed to the function
1385. Simple routines that programmers use as place holders while a system is being tested are called _____
Stubs
1386. You can place function templates
At the start of a program above main()
1387. The two operators && an || are
Logical operators
1388. The arguments that determine the state of the cout object are called _____
Format flags
1389. Static variables are sometimes called
Class variables
1390. The variables declared in a statement block or listed in a function header’s parameterlist are considered _____ variables
Local
1391. An expression
Is a collection of data objects and operators that can be evaluated to a single value
1392. In the c language, the character type of constant is delimited by using
Single quotes
1393. One way in which a structure differs from an array is that _____
A structure may have members of more than one type
1394. A default constructor _____
Takes no arguments
1395. The number 125.35 is a _____
Numeric literal constant
1396. When a class serves as a base class to others, _____
All of its members are inherited, except for any private members
1397. Storing a class definition in a separate file is an example of
Implementation hiding
1398. Which is true?
Sequential cohesion is slightly weaker than functional cohesion
1399. A class named student must have a constructor whose name is
Student
1400. The statement double val[15]={44.123456};
Assigns the value 44.123456 to val[0] and 0 to the rest of the members
1401. Which of the following c++ expressions will find the square root of the number 16?
Sqrt (16)
1402. It is illegal to make objects of one class members of another class
False
1403. Depends upon the kind of object catch blocks must _____
Appear immediately after try blocks
1404. An exception specification begins with the keyword _____
Throw
1405. You construct a class in two sections, known as the _____
Declaration and implementation
1406. It is sometimes useful to specify a class from which no objects will ever be created
True
1407. The statement i*=3 is equivalent to
I = i * 3
1408. The complement operator is represented by the symbol
I
1409. One of the relational operators in the c language is
!=
1410. Within a program, you can instantiate ________that have a class template type
Objects
1411. The rules to any programming language are its _______
Syntax
1412. Which of the following backslash codes used for bell?
A
1413. The last statement in a value-returning function is always _____
Return expression;
1414. One of the logical operators in the c language is represented by the symbol
&&
1415. Which of the following declares and initializes an integer variable named numltems?
Int numltems = 0;
1416. Which of the following tells c++ to display numbers in fixed notation?
Setiosflags(ios::fixed)
1417. The #include instruction is called a
Directive
1418. Another drawback to returning an error code from a function is that any error code returned by the function
Must be of the same type as return type of the function
1419. Classes hold _____
Both data and methods
1420. In c++, the address operator is the following symbol _____
&
1421. Which of the following is false?
Pointers are typically initialized to the empty string (“”)
1422. The function that takes arguments to set the bits of cout is _____
Setf()
1423. When you declare a pointer, you must give it a _____
Type and name
1424. You typically initialize short integer, integer, and long integer variables to
The number 0
1425. Assume that a variable will need to store only integers in the range of 1 through 20000. The most efficient data type for the variable is _____
Short integer
1426. Which of the following is true?
Ostream is derived from iostream
1427. You typically initialize a string variable to _____
A zero-length string
1428. The set of instructions for how to tie a bow is an example of the _____ structure
Sequence
1429. If no exception is thrown ________
Any catch blocks coded with be bypassed
1430. A program that predicts the exact sequence in which events will take place is said to be ________
Procedural
1431. A blueprint for creating an object in c++ is called _____
A class
1432. The prototype for a derived class constructor may include arguments for
Data members of the derived class
Data members of the base class
1433. Overloading involves writing two or more functions with ________
The same name and different argument lists
1434. You___________overload function templates
May, as long as each version has different arguments
1435. You typically initialize character variables to _____
A space enclosed in single quotes
1436. One way pointers are useful is to refer to a memory address that has no _____
Name
1437. A member function uses the correct object when you call it because
The address of the object is passed to the function
1438. Two access specifiers in c++ are
Public and private
1439. Which of the following is the fourth problem-solving step?
Code the algorithm
1440. Within parentheses, catch blocks can have _____
One argument
1441. The while loop is referred to as a(n) _____ loop because the loop condition is tested at the beginning of the loop
Pretest
1442. The word case used in the switch statement represents a
Keyword in the c++ language
1443. Function templates _____________
May have more than one parameter of any type
1444. The statement int num[2][3]={ {3,8,6}, {9,4,7}};
Assigns a value 7 to num[1][2]
1445. Private data can be accessed by
Class member functions
1446. The store of memory available to programs is the _____
Heap
1447. The most common operation used in constructors is _____
Assignment
1448. When a function performs tasks based on a decision, it has _____
Logical cohesion
1449. To create a template class, you begin with _________
The template definition
1450. Which of the following is a c++ object?
Cin
1451. A variable is _____
A memory location whose value can change while the program is running
1452. A function can
A, b, c above are all true
1453. The statement float values[]={3.14, -7.86, 36.96, 4.87};
Assigns 36.96 to values[2]
1454. A constructor initialization list is preceded by _____
A colon
1455. When the compiler places a copy of a small function’s statements directly into a program, the function is said to be _____
Inline
1456. A group of related fields that contain all of the data about a specific person, place, or thing is called a
Record
1457. To send output to a file, you need to include the _____ header file in your program
Fstream.h
1458. A c++ _____ is a program that runs in a dos window
Console application
1459. A difference, between reference variables and pointers is that
Reference variables are easier to use
1460. A ‘c function does not contain
Other ‘c’ functions
1461. _____ variables remain in memory until the program ends
Global
1462. The outline or the definition of a function is called its
Prototype
1463. A function stub typically contains
The two parts of a function are the
Header and footer
Declarations and statements
Legs and feet
1464. A variable’s _____ indicates which portions of the program can use the variable
Scope
1465. If an integer object is thrown with a throw statement, then a subsequent catch block has a usable match if the type of the catch argument is _____
Int &
1466. _____ variables are declared outside of any statement block
Global
1467. The end of string is recognized by
The null character
1468. Variable names known only to the procedure in which they are declared are ________
Local
1469. Whis is true?
A derived class may have more than one base class
A base class may have more than one derived class
1470. The keyword used to define a structure is
Struct
1471. If you omit any constructor argument when you instantiate an object, you must use default values
For all parameters to the right of the argument
1472. The c++ expression p –> val means the same thing as
(*p).vai
1473. Which of the following tells c++ to display numbers with zero decimal places?
Setprecision(0)
1474. Code that has already been tested is said to be _____
Reliable
1475. The last statement in a function is often a(n) _____
Return
1476. When the function int somefunction(char c) throw( ) is executed, _____
It may not throw anything
1477. The two statements that can be used to change the flow of control are
If and switch
1478. If p and q are assigned the values 2 and 3 respectively then the statement p = q++
Assigns a value 3 to p
1479. If you want only one memory location to be reserved for a class variable, no matter how many objects are instantiated, you should declare the variable as
Static
1480. To use a template class member function, use the ________ with the instantiation
Dot operator
1481. When a class is derived from another derived class, the newly derived class
May have more limited access to a base class member than its immediate predecessor
1482. If you assign a default value to any variable in a function prototype’s parameter list, then _____
All parameters to the right of that variable must have default values
1483. The dot operator (or class member access operator) connects the following two entities (reading from left to right):
A class object and a member of that class
1484. Which of the following calls a function named displayname, passing it no actual arguments?
Displayname();
1485. The feature that allows you to use the same function name for separate functions that have different argument lists is called _____
Overloading
1486. Which of the following are valid characters constants?
‘\N’
‘\\’
‘\0’
1487. With a template class, _____ type is generic
At least one
1488. If you want to use a class to define objects in many different programs, you should define the class in a c++ _____ file
Header
1489. Functions that returns information about an object’s state can be classified as________
Inspector functions
1490. An auxiliary function _____
Performs an action or service
1491. To create and execute a c++ program, you need to have access to
A c++ compiler
A text editor
1492. If you omit any constructor argument when you instantiate an object, you must use default values______
For all parameters to the right of the argument
1493. Many programmers separate a class into two files: _____
One for the declarations and one for the implementations
1494. Files whose names end in .h are called _____ files
Header
1495. When accessing a structure member, the identifier to the left of the dot operator is the name of
A structure variable
1496. Assume that a program contains a programmer-defined void function. When c++ encounters the function’s closing brace (}), c++ returns to the statement _____
Immediately below the statement that called the function
1497. Inheritance occurs when a class adopts all the traits of _________
A parent class
1498. Template classes that have already been written to perform common class tasks are called _____
Container classes
1499. A _____ is a single item of information about a person, place, or thing
Field
1500. Which (if any) of the following is not a programmer-defined type
An array
A structure
A class