Tuesday, May 19, 2009

You are looping through a set of results from an SQL database query,

Looking for a specific sequence of entries. Once the sequence of entries is found, you want to stop the loop and continue the program at the statement following the loop

Given the scenario described above, which line of code do you use?

Choice a : if (strcmp (DBSequence, "SEQUENCE")==0) continue;
Choice b : if (strcmp (DBSequence, "SEQUENCE")=0) break;
Choice c : if (strcmp (DBSequence, "SEQUENCE")==0) break;
Choice d : if (strcmp (DBSequence, "SEQUENCE")==0) return 0;
Choice e : if (strcmp (DBSequence, "SEQUENCE")==0) exit;

No comments: