Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

Sybex 816 Chapter 11 Assessment question 12 [tb617624.JaSE11PrgIISG.c11.12]; Erratum

 
Greenhorn
Posts: 10
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


A. Blacklist
B. Graylist
C. Orangelist
D. Whitelist
E. None of the above



Book's explanation

The validation code checks that each character is between 0 and 9.
Since it is comparing to allowed values, this is an example of a whitelist, and option D is correct.
If it were the opposite, it would be a blacklist.
There is no such thing as a gray or orange list.



Hi, Shouldn't the answer be a blacklist?

The 816 book states,  

A blacklist is a list of things that aren't allowed



The code example was looking for illegal chars and then throw an exception. If it was a whitelist, then it would also look for legal chars and then do something, not throwing an exception.



The whitelist example in the OCP 816 Kindle, page 885, checks for legal input and then do something. It does not throw an exception.
 
Olivia Johnson
Greenhorn
Posts: 10
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, if you are a mod reading this, can you add the Erratum tag to this post? I forgot to add it to the title.
Staff note (Paul Clapham) :

I edited the title to include that.

 
author & internet detective
Posts: 40469
821
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
Olivia,
I wish I didn't write this question. It doesn't test whether you know the definition well.

The definition of a blacklist is a list of what isn't allowed.If something appears that is on the blacklist, the code should fail.  A common example is "we don't allow $ or # in a string." It is an exhaustive list of characters that shouldn't appear.

The definition of a whitelist is a list of what is allowed. If something appears that isn't on the whitelist, the code should fail. So far, so good. A common example, is "we only allow letters". It is an exhaustive list of characters that are allowed to appear.

The problem here is that the answer depends on how you think about it. To me, this code says only letters are allowed, which is a whitelist.
 
A timing clock, fuse wire, high explosives and a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic