• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Doubt in K&B mock exam

 
Ranch Hand
Posts: 173
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

Question
What is true? (Choose all that apply.)
Correct Answer
A: A java.io.File object can represent a file on a file system.
B: A java.io.File object can represent a directory on a file system.
C: The File.delete() method can delete directories only if they are empty.
D: The File.renameTo() method can rename directories even if they are NOT empty.

Answers: A,B,C and D

Documentation for java.io.File says it is "An abstract representation of file and directory pathnames. "
But the file may not be present in the file system, so how can A&B be right ??
 
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hareendra Reddy wrote:Hello all,

Question
What is true? (Choose all that apply.)
Correct Answer
A: A java.io.File object can represent a file on a file system.
B: A java.io.File object can represent a directory on a file system.
C: The File.delete() method can delete directories only if they are empty.
D: The File.renameTo() method can rename directories even if they are NOT empty.

Answers: A,B,C and D

Documentation for java.io.File says it is "An abstract representation of file and directory pathnames. "
But the file may not be present in the file system, so how can A&B be right ??



Hi Hareendra... I recommend that you READ CARFULLY A AND B...I make such mistakes also, of not reading carefully.
A: A java.io.File object "can" represent a file on a file system.
B: A java.io.File object "can" represent a directory on a file system.
It did NOT say that a java.io.File object represents, it says it "CAN" represent.
That is conditional! in the sense that in the process of creating a File using a File object,
if the File or Directory you specify already exists in the system, the File Object
WILL NOT create a new File or directory when you invoke the corresponding
createNewFile() or mkdir() methods, the File object simply "hooks up" (represents)
the existing ones!.
BE CAREFULL and read the questions CAREFULLY as mis understanding such little details
as "is", "can", "only", could make the difference between passing and failing the exams
thanks.
PLEASE TAKE NOTE: I am a learner like you, if there's any mistake on the above. Excuse me.

 
Hareendra Reddy
Ranch Hand
Posts: 173
Firefox Browser Fedora Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you jackzia ...

I observed that but still i was unable to confirm that ...
So english is ambigous ...
One more note.. You dont need to write disclaimer each time, after all we all are learners...
 
author
Posts: 9046
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On the real exam you will encounter many questions that test whether you know if a certain fact:

- must always be true

or

- might be true sometimes (like in this case with the word "can")

or

- is never true

So, it's really, really important to read the questions carefully with these distinctions in mind.
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic