
CS 101 Pledged Test 1 Spring 1998
Pledged Page 1 of 4
This pledged test is closed-book, closed-notes. All answers must be written on the answer sheet.
In the questions that follow you are sometimes asked to give the output of a code segment. If you believe
the code segment does not produce any output, write NONE.
1. What is your intended major?
2. What base ten integer is represented by the eight bit two’s complement number 01001011?
3. Write down the eight-bit, two’s complement representation of the base ten number -47.
4. For each of the following C++ constant values identify its base and its type.
(a) 7L
(b) 00101100
(c) 800
(d) 0x98
(e) 17.4
5. Does a syntax rule or a semantic rule specify program form?
6. Does a syntax rule or a semantic rule specify program behavior?
7. Which one of the following is not a legal character for a C++ identifier?
(a) period
(b) uppercase alphabetic
(c) underscore
(d) uppercase alphabetic
(e) digit
8. True or False An object can have a value.
9. True or False An object can have member functions.
10. True or False The objects "1" and ’1’ have the same type.
11. True or False The ^ is the C++ exponentiation operator.
12. What return value(s) for functions main() and ApiMain() indicate success?
13. Suppose the following definitions are in effect.
int i = 8;
int j = 4;
float a = 1.0;
float b = 4.0;
For each of the following expressions give the computed value and its type.
(a) j / i
(b) a / b
(c) 4 % 3
(d) 1 + 2 * 3
(e) 4 / 8 * 2.0