2008 SJTU
Multiple choice questions:
Pick a few typical examples
Multiple choice questions:
1. correct the error
IntMain (){IntX// * = 10 */;Return0 ;}
Obviously, // all the subsequent comments are missing;
If you do not know whether it is/or /**/
For more information, see "C traps and defects", the so-called "greedy" principle.
2. correct the error... probably.
# Include <stdio. h>DoubleSum (DoubleA,DoubleB,DoubleC ){Return(A + B + C );}IntFX (){If(1 ){Break; FX ();}}IntMain () {printf ("% F", Sum (10.2, 12.3, 16.1); FX ();Return0 ;}
Run and find break statement not within loop or switch
3. See this question again. Wei Sheng took the test last time, but this time it was simplified and the number was given in hexadecimal notation.
# Include <iostream>Using NamespaceSTD;IntMain (){IntX = 0x1e61, countx = 0;While(X) {countx ++; X = x & (x-1) ;}cout <countx;Return0 ;}
0x1e61 = 1 1110 0110 0001
The answer is 7.
4. Print the output
VoidFoo (Int* A) {A =New Int; * A = 20 ;}IntMain () {v = 10; Foo (& V); printf ("% D", V );Return0 ;}
Obviously, the print is still 10, and foo does not actually do anything for V, although it is the transmitted address
So much.
Short answer:
1. What are the advantages of iterator pattern and for-loop iteration methods?
One of the design modes: iteration Mode
2. In rdmbs what is transaction? What is transaction log? Why we need transaction log?
I don't know much about the relational database management system.
What I answer is the access process, access process records, and log
3. What is virtual function? How compliers implement the virtual function?
Leave it alone.
4. Write Program (psudo code) How to know a linked list has a circularum?
Many times