aspose file tools*
The moose likes Product and Other Certifications and the fly likes rms question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "rms question" Watch "rms question" New topic
Author

rms question

Yi Meng
Ranch Hand

Joined: May 07, 2003
Posts: 270
Q8. Which statement is true about following code segment. Suppose all objects are valid objects. (Select One)
rs.addRecord(rec1, 0, rec1.length);
rs.addRecord(rec2, 0, rec2.length);
rs.addRecord(rec3, 0, rec3.length);
rs.deleteRecord(2);
rs.getRecord(2, data, 0);
A. This code will successfully compile and run.
B. This code will compile fine but will throw an exception at runtime.
C. This code will successfully compile and run if �rs.deleteRecord(2)� is removed.
D. This code will not be compiled.

The suggested answer is c, but why not b?


Meng Yi
Eduardo Rodrigues
Ranch Hand

Joined: Jul 01, 2003
Posts: 199
I think the same...
Why not 'b'??
For me this code will throw a InvalidRecordIDException.
Some clarifications needed here!


Eduardo Rodrigues<br />SCJP 1.4/5.0 SCWCD 1.3/1.4, SCBCD 1.3, SCMAD, SCEA<br />IBM 484 & 486<br />Belo Horizonte<br />Minas Gerais<br />Brasil
Eduardo Rodrigues
Ranch Hand

Joined: Jul 01, 2003
Posts: 199
I've just tried and the Exception was thrown...
See you guys...
Bye
Mehdi Chaouachi
Ranch Hand

Joined: Jul 02, 2003
Posts: 87
The suggested answer is c, but why not b?

Who suggested this answer, if it is from sun then it is probably correct.


Mehdi Chaouachi<p>Sun Certified Java Programer (1.4)<br />Sun Certified Web Component Developer (1.4).<br />Sun Certified Mobile Application Developer.
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Hi,
Answer c seems correct to me.
After the 3 addRecord() calls there are 3 records in the RecordStore.
Don't confuse the addRecord() and setRecord() methods. The add record doesn't indicate the 'recordId'.
Hope that helps,


Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Eduardo Rodrigues
Ranch Hand

Joined: Jul 01, 2003
Posts: 199
For me is 'b'.
When you call

The Record which index is 2 is DELETED from the RecordStore.
Then you call

that throws a InvalidRecordIDException.
This question is very simple, I don't know why is generating so much doubts.

Bye
[ February 18, 2004: Message edited by: Eduardo Rodrigues ]
Cleverson Schmidt
Ranch Hand

Joined: Feb 17, 2004
Posts: 55
B AND C are correct
[ February 18, 2004: Message edited by: Cleverson Schmidt ]
Eduardo Rodrigues
Ranch Hand

Joined: Jul 01, 2003
Posts: 199
Man, I didn't paid attention to the options...
Yes, B ANDC are correct!
Bye
Forrest Xu
Ranch Hand

Joined: Nov 16, 2002
Posts: 92
compare with C, B is the best choice
Michael Zhao
Ranch Hand

Joined: Sep 19, 2000
Posts: 77
I think both B and c are correct.


SCJP,SCWCD,SCMAD,OCP9I, SCEA
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
For me, both b and c are correct as well... Where does that question come from?


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
 
wood burning stoves
 
subject: rms question