600 likes | 608 Views
Review questions for a programming final exam, covering topics such as variables, data types, constants, operators, and decision-making structures.
E N D
Programming I Final Exam 2010-2011 - Review
Question..True or False(Please click on the answer...) • Variables hold data that may change while the program is running. True False
Question..True or False(Please click on the answer...) • Another term for integers is whole numbers. True False
Question..True or False(Please click on the answer...) • Initializing a variable means assigning a value to it. True False
Question..True or False(Please click on the answer...) • C++ keywords cannot be used as identifiers. True False
Question..True or False(Please click on the answer...) • In C++ it is possible to declare more than one variable in one statement. True False
Question..True or False(Please click on the answer...) • In C++ it is possible to declare more than one variable in one statement. True False
Question..True or False(Please click on the answer...) • Boolean variables are those that can have only three possible values. True False
Question..True or False(Please click on the answer...) • In C++ constants hold data that does not change as the program runs. True False
Question..True or False(Please click on the answer...) • Constants do not have data types. True False
Question..True or False(Please click on the answer...) • The modulus operator is the % sign. True False
Question..True or False(Please click on the answer...) • Overflow occurs when a number is too small for a variable. True False
Question..True or False(Please click on the answer...) • The * operator performs multiplication. True False
Question..True or False(Please click on the answer...) • Floating-point precision can affect calculations. True False
Question..True or False(Please click on the answer...) • The % operator returns the remainder of integer division. True False
Question..True or False(Please click on the answer...) • The number 5.6e15 is an example of exponential notation. True False
Question..True or False(Please click on the answer...) • A floating-point number would be truncated if it were converted to an integer. True False
Question..True or False(Please click on the answer...) • Floating-point rounding errors can occur if you are not aware of the data types used in calculations. True False
Question..True or False(Please click on the answer...) • Most algorithms follow a single path from beginning to end. True False
Question..True or False(Please click on the answer...) • Programs sometimes have to make decisions based on the wishes of the user. True False
Question..True or False(Please click on the answer...) • Logical operators allow an expression to evaluate more than one condition. True False
Question..True or False(Please click on the answer...) • Structures that make decisions in C++ programs are called sequence structures. True False
Question..True or False(Please click on the answer...) • The if/else structure is also called a two-way selection structure. True False
Question..True or False(Please click on the answer...) • A statement block has to end with a semicolon after the right curly brace. True False
Question..True or False(Please click on the answer...) • Programs sometimes have to make decisions based on the wishes of the user. True False
Question..True or False(Please click on the answer...) • C++ identifiers can begin with a letter or number. True False
Question..Multiple Choice(Please click on the answer...) • What is another term for integer? • a. Whole number • b. Fractional number • c. Floating point number • d. Character
Question..Multiple Choice(Please click on the answer...) • Which of the following is a legal identifier? • a. Number of cars • b. 4saleprice • c. double • d. number_of_cars
Question..Multiple Choice(Please click on the answer...) • Boolean variables can have how many different values? • a. 1 • b. 2 • c. 3 • d. 4
Question..Multiple Choice(Please click on the answer...) • Which of the following is the proper way to declare and initialize a constant? • a. const double PI = 3.14159; • b. double PI = 3.14159; • c. const PI = 3.14159; • d. PI = 3.14159;
Question..Multiple Choice(Please click on the answer...) • When variables are first declared: • a. They have a value of zero. • b. They reveive the default value for their data type. • c. They have an indeterminate value. • d. They have a value of null.
Question..Multiple Choice(Please click on the answer...) • Which of the following is true of naming variables? • a. Variable names can have spaces • b. Variable names can begin with numbers • c. Variable names may contain an underscore • d. Variable names may also be C++ keywords
Question..Multiple Choice(Please click on the answer...) • Another name for exponential notation is: • a. Long notation • b. Unsigned notation • c. Scientific notation • d. Floating point notation
Question..Multiple Choice(Please click on the answer...) • What must identifiers begin with? • a. A number • b. A letter • c. An integer • d. A space
Question..Multiple Choice(Please click on the answer...) • A group of characters put together to form a word or phrase is called: • a. A byte • b. A message • c. A string • d. An ASCII stream
Question..Multiple Choice(Please click on the answer...) • Which of the following statements is a valid way to initialize multiple variables to the same value of a single statement line? • a. X, y, z = 200; • b. X = y = z = 200; • c. X; y; & z= 200; • d. X & Y & Z = 200;
Question..Multiple Choice(Please click on the answer...) • The highest precedence when evaluating an expression is • a. Addition or subtraction • b. Minus sign used to change sign • c. Multiplication and division • d. None of these
Question..Multiple Choice(Please click on the answer...) • An overflow condition occurs when • a. A value is too large for its data type • b. A decimal value is stored into an integer field • c. Too many variables are defined in one program • d. An integer is divided by a floating-point number
Question..Multiple Choice(Please click on the answer...) • If y=3 and z=5, the statement x = y + ++z; will return a value of _____. • a. 8 • b. 9 • c. 10 • d. 11
Question..Multiple Choice(Please click on the answer...) • The symbol used in C++ for the modulus operator is the • a. & • b. * • c. % • d. $
Question..Multiple Choice(Please click on the answer...) • A variable set to a Boolean value of false will contain a(n) ____ in memory. • a. one • b. zero • c. F • d. No
Question..Multiple Choice(Please click on the answer...) • Which of the following statements does not use a relational operator? • a. x = (4 > 5); • b. x = (4 <= 5); • c. x = (4 != 5); • d. x = (4 = 5);
Question..Multiple Choice(Please click on the answer...) • The symbol used for the not logical operator is • a. & • b. ! • c. - • d. ~
Question..Multiple Choice(Please click on the answer...) • Decision-making structures in C++ are called ____ structures. • a. sequence • b. selection • c. control • d. branching
Question..Multiple Choice(Please click on the answer...) • Which of the following shows the symbols that must surround a block of code for an if structure? • a. [ ] • b. ( ) • c. { } • d. : :
Question..Multiple Choice(Please click on the answer...) • The ____ keyword can be used within a switch structure to execute specific code if no other conditions are matched. • a. continue • b. break • c. if_other • d. default
Question..Multiple Choice(Please click on the answer...) • Which operator is used to represent "less than or equal to"? • a. < • b. >= • c. <= • d. =<
Question..Multiple Choice(Please click on the answer...) • In the problem solving steps of software development, which step occurs after program documenting? • a. Run the program. • b. Test the results. • c. Write code for the program. • d. Algorithm development.
Question..Multiple Choice(Please click on the answer...) • Name an issue that is not important during problem solving for a programming team. • a. Writing style • b. Technique • c. Rewriting code • d. Communication
Question..Multiple Choice(Please click on the answer...) • What can a valid identifier not consist of? • a. Forward slashes • b. Underscore • c. Letters • d. Digits