本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
Q21: For the following code segment,which is correct?
a) type has numeric value 6
b) type has numeric value 3
c) pica has numeric value 1
d) type is an integer
e) font is an integer
Q22: What is the following line of code an example of?
b) nested conditionals
d) good programming style
23: For the following structure,what does employee.first return?
a) the 1st letter of the first name of the 5th employee
b) the 2nd letter of the first name of the 6th employee
c) the 1st letter of the first name of the 6th employee
d) the first name of the 5th employee
e) the first name of the 6th employee
Q24: What is the function of the code ofstream outFile("myfile",ios:app);?
a) It doesn't create a file if the named one doesn't exist
b) It opens the file and seeks to the end for writing
c) It allows reading of the file
d) It overwrites the file info
e) It adds data to the end of the file
Q26: Which of the following is true about the index variable in a for loop?
a) It is initialized at the end of the loop
b) It is never incremented or decremented
c) It should be compared to a variable that changes inside of the loop
d) It counts the loop repetitions
e) It must be auto-incremented
Q27: Which of the following is true about a static storage class variable,when declared with a function?
a) It has scope throughout the entire program
b) It is reinitialized each time its block is entered
c) It has a variable name that cannot be used by other functions
d) It retains its value between function calls
e) It is reserved prior to the actual declaration
Q28: Which should NOT be part of the comments in a function header?
a) name of the function
b) input to the function
c) actual value returned by the function
d) external variables affected by the function
e) purpose of the function
Q29: Which of the following occurs in a switch statement?
a) Breaks are always required
b) The default is always executed
c) Case values are always compared to the switch variable
d) The cases must be in numeric order
e) Curly brackets are never used
Q30: Which of the following are NOT true about the statement below?
a) statement_1 cannot be a function call
b) if expr1 and expr3 are null it is the same as a while loop
c) any of expr1,expr2,expr3 can be omitted
d) break can terminate the loop
e) another for can be nested
Q31: What do the following lines of code have in common?
result = ( 1 && 0 ) || 6;
result = ( 1 & 0 ) | 6;
a) They both store the same value in result
b) They both evaluate as true
c) They both evaluate as false
d) They both store 6 in result
e) They both store 1 in result
Q32: What is the result of this code segment?
int x = 4;
float y = 0.00;
z = x + y;
a) z contains the character '4'
b) z contains 4.0
c) z's value is undetermined
d) A runtime error occurs
e) z contains 4
Q33: Which of the following is true for the bitwise left shift operation?
a) The high bit is rotated in on the right
b) Vacated bits are always filled with 0's
c) The result is system dependent
d) Floats may be used
e) The sign bit never changes
Q34: Which of the following is true about recursive functions?
a) They are often shorter than iterative ones
b) They can never call themselves
c) They do not need persistent data types
d) They involve stack space that is allocated through explicit declaration
e) They may only be invoked once
Q35: Which of the following is a feature of a good user interface?
a) It uses color whenever possible
b) It is consistent throughout the application
c) It redefines the keyboard for ease of use
d) It uses the mouse exclusively
e) It contains windows
Q36: Which of the following can valid C++ statements NOT do?
a) produce overflow errors
b) contain nested assignment
c) assign values within the clause of an if statement
d) call undefined functions
e) use promotion of data types
Q37: Which of the following is true about variables declared as extern?
a) They are always accessible at each program line
b) They may be set from within a function
c) They have values that never change
d) They may not be initialized
e) They can only be used as pointers
Q38: For which of the following can escape sequences NOT be used?
a) entering single characters
b) page control
c) formatting output
d) unquoted literal strings
Q39: Which of the following is true about the body of a while loop?
a) It must change the index variable
b) It will always be executed once
c) It is skipped if the starting condition is false
d) It cannot call a function
e) It cannot affect the while condition
Q40: On which of the following should the addtion operation NOT be performed?
a) the value returned by a pointer to an integer
b) a single pointer
c) mixed data types
d) character variables
e) two pointers
Q41: Which of the following is true about a function declared as void?
a) It cannot affect global variables
b) It returns only a 0 value
c) It has no statements in its body
d) It will be defined by a #include file
e) It cannot be invoked in an experssion expecting a return value
更多精彩文章及讨论，请光临枫下论坛. 网址: rolia.net/zh