1. iostream is part of:
a) the comment section
b) the C++ standard library
c) the compiler
d) the main function
Answer: B
2. Which of the following lines must end with a semicolon (;)?
a) #include <iostream>
b) int main ( )
c) // a comment
d) using namespace std
Answer: D
3. Which of the following is a compiler directive:
a) #include <iostream>
b) using namespace std;
c) int main ( )
d) return 0;
Answer: A
4. main is a:
a) compiler directive
b) comment
c) function
d) namespace
Answer: C
5. Which of the following is not a C++ reserved word?
a) float
b) number
c) const
d) using
Answer: B
6. Which of the following could be used as an identifier?
a) first_name
b) 5stars
c) small number
d) yes&no
Answer: A
7. Which of the following is not a valid identifier?
a) Pig3
b) I_HAVE_A_DOG
c) help!
d) _answer
Answer: C
8. Which of the following would be the best choice for a pay rate of a student?
a) payrate
b) PAYRATE
c) p
d) pay_rate
Answer: D
9. What would be the best choice for the data type for a person’s take home pay?
a) int
b) float
c) char
d) string
Answer: B
10. What would be the best choice for the data type for the number of students in a class?
a) int
b) float
c) bool
d) char
Answer: A
11) What would be the best choice of data type for a person’s address?
a) int
b) float
c) char
d) string
Answer: D
12) Which of the following statements is correct?
a) float num1; num2;
b) int day, night;
c) int blue = 5.0;
d) string black = ‘white’;
Answer: B
13) What kind of error is the following:
float height = 6.0,
a) syntax
b) logic
c) run-time
d) undetected
Answer: A
Post A Comment:
0 comments: