
CMPSC 101 CMPSC101 Exam 1 Solutions (Penn State University)
CMPSC 101 CMPSC101 Exam 1 Answers (Penn State University)
- The programs that run on a computer are referred to as _______.
- A computer has a(n)_______.
- The only programming language that a computer can directly understand is its own
- Objectoriented programming focuses on things (nouns) rather than actions (verbs).
- C++ source code files typically have the extension _______.
- The compiler is a program that translates a highlevel language program into machine code.
- In Visual Studio .NET, every application can have _______ solution(s) and can have _______ project(s).
- Every C++ program must have a function named 'main'.
- The C++ compiler considers the identifier 'CanofWorms' to be the same as the identifier 'canofworms' .
- The _______ file must be included, using the #include statement, for any application that outputs data to the screen or inputs data from the keyboard using C++style stream input/output.
- _______ must end the body of every function.
- Comments _______.
- The _______ character terminates a statement.
- Identifiers _______.
- Assume that input is defined as a variable of type int. Which of the following statements gives the value entered at the keyboard to input?
- When the computer executes a statement that reads values from the keyboard using cin, _______.
- The _______ character is not a C++ operator.
- A variable definition must specify a name and a data type.
- Any fractional part of an integer division result is _______.
- When a breakpoint is set at a particular statement _______.
- An algorithm specifies the ________.
- The _______ operator returns true when the right operand is greater than or equal to the left operand.
- Which of the following if else statements displays the message Passed! if int variable grade is greater than or equal to 60?
- A constant is defined using the key word 'constant'.
- Floatingpoint values are represented using the _______ primitive type.
- _______ is not an assignment operator.
- If int variable x contains the value 17, what will x contain after the expression x %= 3 is executed?
- Stream manipulator _______ indicates that floatingpoint values should be output in fixedpoint format.
- When stream manipulators fixed and setprecision( 5 ) are placed in the output stream, what is displayed when the expression cout << 1234.567 is executed?
- A char is a(n) _______; a string is a(n) _______.
- Assume that input is a string. If the user types “John Smith” and presses Enter when the expression cin >> input executes, what would input contain?.
- To which operator does the truth table in Fig. 5.1 correspond?
- The condition ( ( expression1 ) && ( ! expression2 ) ) evaluates to true when _______.
- The expression !( number == 10 ) always evaluates to the same result as (number != 10).
- The while statement’s body executes only if the loopcontinuation condition is false.
- The loop while ( x <= 10 ) terminates _______.
- What is the purpose of a table header?
- An infinite loop occurs when a loopcontinuation condition in a do while never becomes false.
- If its loopcontinuation condition is false the first time it is evaluated, a do...while repetition statement _______.
- If delta and gamma are int variables, where delta=20 and gamma=15, what value is stored into gamma by the following statement?
- A variable whose value can be either true or false has a data type of:
- Which one of the following would be an illegal variable name
- Which of the following is the list of the six C++ relational operators?
- The ______ operator always follows the cin object, and the ______ operator follows the cout object.
- After execution of the following code, what will be the value of 'angle' if the input value is 10?
- In a C++ program, two slash marks ( // ) indicate: