c ++ program

Topics: Computer programming / Pages: 1 (252 words) / Published: Jul 10th, 2014
1. Mark the following statements as true or false. a. An identifier can be any sequence of digits and letters. b. In C++, there is no difference between a reserved word and a pre- 
defined identifier. c. A C++ identifier can start with a digit. d. The operands of the modulus operator must be integers. e. Ifa=4;andb=3;,thenafterthestatementa=b;thevalueofbisstill3. f. In the statement cin >> y;, y can only be an int or a double variable. g. In an output statement, the newline character may be a part of the string. h. The following is a legal C++ program: 
 10. Which of the following variable declarations are correct? If a variable declaration is not correct, give the reason(s) and provide the correct variable declaration. b. Declare and initialize an int variable temp to 10 and a char variable 
ch to 'A'. c. Update the value of an int variable x by adding 5 to it. d. Declare and initialize a double variable payRate to 12.50. e. Copy the value of an int variable firstNum into an int variable tempNum. f. Swap the contents of the int variables x and y. (Declare additional variables, if necessary.) g. Suppose x and y are double variables. Output the contents of x, y, and the expression x + 12 / y - 18. h. Declare a char variable grade and set the value of grade to 'A'. i. Declare int variables to store four integers. j. Copy the value of a double variable z to the nearest integer into an int variable x.

You May Also Find These Documents Helpful

  • C++ Programs
  • C Program
  • C Program
  • C Program
  • 89s52 C Program
  • Gauss Program on C++
  • Simple Program for Student C++
  • Pythagorean Theorem and C++ Program
  • Odd-Even Program C++
  • Generating Test Cases for a C Program