Untitled1

Page 1

Answer Q1: MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) In a C++ program, two slash marks ( // ) indicate: A) the beginning of a comment B) the end of the program C) the beginning of a block of code D) the end of a statement E) None of these 2) Which escape sequence causes the cursor to move to the beginning of the current line? A) \t B) \r C) \a D) \b E) \n 3) Which one of the following would be an illegal variable name? A) June1997 B) dayOfWeek C) 3dGraph D) itemsorderedforthemonth E) _employee_num 4) Which statement is equivalent to the following? x = x * 2; A) x = x * x; B) x * 2; C) None of these D) x *= 2; 5) Of the following, which is a valid C++ identifier? A) June1997 B) myExtraLongVariableName C) _employee_number D) ___department E) All of the above are valid identifiers.

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

B) 12

C) 72

D) 63

E) None of these

7) This is used to mark the end of a complete C++ programming statement. A) data type B) semicolon C) void D) pound sign E) None of these 8) What is the value of number after the following statements execute? int number = 10; number += 5; number -= 2; number *= 3; A) 2 B) 15 C) 3 D) 30 9) The ________ operator always follows the cin object, and the ________ operator follows the cout object. A) <<, >> B) >>, << C) conditional, binary D) binary, unary E) None of these 10) A variable whose value can be either true or false is of this data type. A) float B) bool C) binary D) T/F E) None of these 11) In C++ the = operator indicates: A) negation B) assignment C) subtraction

D) equality

E) None of these

12) This operator represents the logical AND. A) || B) && C) ++ D) @ E) None of these 13) ________ are used to translate each source code instruction into the appropriate machine language instruction. A) Preprocessor directives B) Compilers C) Library routines D) Modules E) None of these 14) When an if statement is placed within the conditionally-executed code of another if statement, this is known as: A) validation B) nesting C) overloading D) complexity E) None of these 15) In a broad sense, the two primary categories of programming languages are: A) single-tasking and multi-tasking B) low-level and high-level C) COBOL and BASIC D) mainframe and PC E) None of these


1) A 2) B 3) C 4) D 5) E 6) B 7) B 8) B 9) B 10) B 11) B 12) B 13) B 14) B 15) B


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.