SCJP Questions And Answers

Home| Forums | Join Google Group | Join Yahoo Group | Jobs
Get custom programming done at GetAFreelancer.com!
Earn Money
  Trading Forex Online
  Paramount Airways
  Free Data Recovery
 Cargo
 Job Portal
  HSBC Investment
 Management
 Cheap Web Hosting
  Make Trip
  Cheap Air Travel
 Leisure Hotel
  Free Air Travel
  Mutual Fund Informations
   Cheapest Cellular Plan
 Free Sexy Indians
  Call Center Software
  Hot Indian
Programming Help | Homework Help | Counseling
Astrology Advice | Tarot Advice | Parenting
Dating Advice | Love Advice | Divorce Advice
Legal Advice | Debt Advice | Career Advice
- 22 - Question No 38
The file "
file.txt " exists on the file system and contsins ASCII text. Given:
38. try {
39. File f = new File("file.txt");
40. OutputStream out = new FileOutputStream(f, true);
41. }
42. catch (IOException) {}

What is the result?
A. The code does not compile. B. The code runs and no change is made to the file. C. The code runs and sets the length of the file to 0. D. An exception is thrown because the file is not closed. E. The code runs and deletes the file from the file system.

Answer: A



Question No 39
Which constructs a DataOutputStream?

A. New dataOutputStream("out.txt"); B. New dataOutputStream(new file("out.txt")); C. New dataOutputStream(new writer("out.txt")); D. New dataOutputStream(new FileWriter("out.txt")); E. New dataOutputStream(new OutputStream("out.txt")); F. New dataOutputStream(new FileOutputStream("out.txt"));

Answer: F



Question No 40
What writes the text "<
end >" to the end of the file " file.txt "? A. OutputStream out= new FileOutputStream ("file.txt"); Out.writeBytes ("<end>/n"); B. OutputStream os= new FileOutputStream ("file.txt", true);
DataOutputStream out = new DataOutputStream(os);
out.writeBytes ("<end>/n");
Earn Money
  Trading Forex Online
  Paramount Airways
  Free Data Recovery
 Cargo
 Job Portal
  HSBC Investment
 Management
 Cheap Web Hosting
  Make Trip
  Cheap Air Travel
 Leisure Hotel
  Free Air Travel
  Mutual Fund Informations
   Cheapest Cellular Plan
 Free Sexy Indians
  Call Center Software
  Hot Indian