C++ Test( 一) 答对优秀,我会告诉你可以去哪个AGENCY公司闯关了

ivy_sh (Ivy_sh)
本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
Q1: Which of the following has the same result as this fuction declaration?
void NewFun(int[10]);
a) void NewFun(int*);
b) void NewFun(int);
c) void NewFun(int[]);
d) void NewFun(10);
e) both a and c above

Q2: Which statement is NOT true about struct?
a) A struct is a class with public access as the default
b) A struct that is legal in C is legal in C++
c) A struct can contain a union as a member
d) There must be a function declaration within the struct
e) They can be nested (a struct within a struct)

Q3: Which statement is NOT true about inline functions?
a) They typically execute slower than called functions
b) They may be expanded at the point in the program where invoked
c) They return a value of the type stated at definition
d) They are similar(but not identical) to preprocessor macro definitions
e) They can call non-inline functions

Q4: Which of the following is a literal character constant(such as 'a') stored as?
a) a character data tye
b) an integer data type
c) a long integer data type
d) two characters,one to hold the letter and one to hold a null terminator
e) void since it is not a variable

Q5: What must you do in order to compile,link and execute a C function in C++?
a) declare the function as extern "C" in the module calling it and specify its parameters
b) declare the function as import "C" in the module calling it ans specify its parameters
c) overload the C function name for char,int and float data types
d) add an ellipsis(...) to the argument list in the function definition
e) rewrite all of the C code in C++

Q6: Which of the following is true about this statement?
cout << (x>y)?x:y;
a) It outputs the larger of x or y
b) It evaluates as (cout<<(x>y))?x:y;
c) It requires endl in order to print
d) It should be typed within quotation marks
e) It evaluates x and y twice

Q7: Which of the following is true about objects created through dynamic memory allocation (new)?
a) They are automatically deleted when the function in which they were created terminates
b) They are initialized to zero when first created
c) They are given random names assigned by the compiler
d) They are to be deleted by invoking delete
e) They are reorganized via garbage collection if memory becomes exhausted

Q8: Which of the following are true about derived classes?
a) All of their members public by default
b) They have inheritance of all members of their base class including any base constructors
c) They have a public base class if no access keyword is specified
d) They have a public base class if they have some public members
e) They have a public base class if the visibility of all inherited member is maintained

Q9: Which of the following takes place within a class?
a) Member functions can only access public members of the class
b) Information can be hidden from friends by declaring data members as private
c) Constructors can be used to manage initializations
d) Protected members behave as private members to derived classes
e) There must be at least one member function defined

Q10: Which of the following is true about the extraction operator (>>)?
a) It is used extensively by the stream library,but can be defined to do any operation
b) It allows whitespace characters if within quoted strings
c) It is used to direct output to the printer
d) It cannot be overloaded
e) It has a higher precedence than the bitwise shift operator

Q11: For what reason are formal arguments,such as argv and argc,typically given to main()?
a) to prohibit recursive calls
b) to provide interrupt vectors for hardward
c) to act as error handing flags
d) to allow passing of information from the command line
e) to deal with graphical screen control

Q12: With which of the following should pointers NOT be used?
a) casted tye conversions
b) character strings
c) names of functions
d) static class members
e) objects that have been deallocated

Q13: Operators can be overloaded by the programmer:
a) to take an arbitrary number of arguments
b) if they are any of the C++ operators
c) by creating a new operator not in the C++ list
d) to extend the meaning of an operator to objects of a class
e) to override the predefined meaning for operations on built-in data types

Q14: Which of the following is NOT true about user-defined conversions?
a) They can be used in assignments
b) They can be used in initializations
c) They can be applied if there are ambiguities
d) They can be inherited
e) They can be virtual

Q15: Which of the following is true about volatile objects?
a) They are always destroyed using delete()
b) They should always be accessed from memory by the code generated by the compiler
c) They are accesses to out-of-bounds array locations
d) They result from class conflicts
e) They can have only bitwise operations performed

Q16: Which of the following is true about classes defined as type union?
a) They change size depending on what is currently stored
b) They can have static data members
c) They can have objects that define constructors
d) They can have objects that define destructors
e) They have their nonstatic member variables stored at the same address

Q17: What must be true in order to overload functions?
a) They do not have the same name
b) They are not defined
c) They have the exact same argument types
d) They are unique in the number,type or order of arguments
e) They are not declared in .h files

Q18: Which of the following is true of multiple inheritance?
a) There is always a single base class
b) Private members that are inherited are not directly accessible
c) Inherited protected members are only accessible to their immediate successor
d) Ambiguous references are resolved by the compiler
e) All virtual functions must be fully defined

Q19: After the following code segment is executed, on an 8-bit machine,what is DEF?
XYZ = ~5;
ABC = 20|XYZ;
a) 5
b) 25
c) 4
d) -1
e) -6

Q20: After the following code segment is executed,what is the value of c?
int a,b,c;

a) 52
b) 0
c) 1
d) 6
e) undefined
更多精彩文章及讨论,请光临枫下论坛. 网址: rolia.net/zh
2001-7-4 -05:00

回到话题: C++ Test( 一) 答对优秀,我会告诉你可以去哪个AGENCY公司闯关了

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论