• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Question 40 in chapter 9 (OCP 17 - Practice Tests) - Possible alternative case

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The question asks to assume that '/all-data' exists and is accessible, but does that not still leave the possibility that it is not a directory? In which case Files.list would throw an exception.

The provided answer states that the code compiles and runs without issue.

40. What is the output of the following application? Assume /all-data exists and is accessible within the file system.


 
Saloon Keeper
Posts: 3927
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Karl .
You're right.
The question is a bit ambigous.
It must say that "all-data" is accessible and is a directory.
You not listed options, if it contains "May throw runtime exception", then it can be correct.
 
author & internet detective
Posts: 41967
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IT's not a It'a s choose one question though. So assuming it isn't a directory isn't the most likely case.
 
There's a way to do it better - find it. -Edison. A better tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic