Question 4: Which of the following statements correctly describe the code below in C++?
2010-11-30 10:24
1356 查看
#define language 437 //Line 1
#if language < 400
#undef language //Line 2
#else //Line 3
#define language 850 //Line 4
#ifdef language //Line 5
printf("%d", language); //Line 6
#endif
#endif
A. An error or warning will occur on Line 6 because a macro cannot be used as
part of a preprocessor directive.
B. An error or warning will occur on Line 2 because #undef is not a valid preprocessor directive.
C. An error or warning will occur on Line 4 because language has already been defined.
D. If Line 1 is changed to #define language 300, Line 6 will print "850".
E. An error or warning will occur on Line 3 because #else can only be used as the last conditional in the chain.
A C
#if language < 400
#undef language //Line 2
#else //Line 3
#define language 850 //Line 4
#ifdef language //Line 5
printf("%d", language); //Line 6
#endif
#endif
A. An error or warning will occur on Line 6 because a macro cannot be used as
part of a preprocessor directive.
B. An error or warning will occur on Line 2 because #undef is not a valid preprocessor directive.
C. An error or warning will occur on Line 4 because language has already been defined.
D. If Line 1 is changed to #define language 300, Line 6 will print "850".
E. An error or warning will occur on Line 3 because #else can only be used as the last conditional in the chain.
A C
相关文章推荐
- Question 9: Which of the following statements correctly describe the results of executing the code below in C++?
- Question 15: Which of the following statements describe the results of executing the code snippet below in C++?
- /*程序员面试宝典*/Which of the following statements describe the results of executing the code snippet below in C++?
- (NOT CLEAR)Question 18: In the given C++ code snippet, which of the following statements correctly identify how Mon of enum DOW
- Question 29: The C++ code below generates a compiler error. Which of the following solutions can be used to correctly access the
- Question 37: In C++, which of the following statements regarding the code below are valid?
- Question 28: Which of the following statements accurately describe the new[] operator in C++?
- Question 39: Which of the following are possible outputs of the C++ code below?
- Question 17: Which of the following identify const-correctness failures in the C++ program below?
- Question 25: For the code snippet below, which of the following statements provide the correct order of constructor calls when o
- Question 11: Which of the following statements describe the result when standard new cannot allocate the requested storage in C+
- Question 27: Which of the following reasons describe why a destructor cannot throw an exception in C++?
- (NOT CLEAR)Question 47: Which of the following statements correctly describe functions of the endl manipulator for the ostream o
- Question 46: Which of the following statements describe correct methods of handling C++ exceptions?
- Question 48: In C++, which of the following statements accurately describe a base class destructor calling a virtual function ov
- Question 31: A C++ developer wants to handle a static_cast() operation for the class String shown below. Which of the following
- Question 43: Which of the following define valid string constants in C++?
- Question 6: Which of the following are container adapters in the STL (Standard Template Library) in C++?
- (NOT CLEAR)Question 45: Which of the following options are returned by the typeid operator in C++?
- Question #8: Given the code below, the variable y can be accessed in which blocks of code?