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

Question about Mock Exam 3 OCP Book - Online Material

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

Mock Exam 3

There are currently 100 rows in a table species before inserting...

Code executes update for row 3, where 3 is primary key.
I believe it shall throw SQLIntegrityConstraintViolationException because of duplicate key value.
If we have 100 rows already, we may add 101st row only, isn't it?
 
author & internet detective
Posts: 41878
909
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
John,
The question doesn't say the keys were inserted in order. You can't assume things ;).

More importantly, the exam doesn't expect you to know SQL. Which means it is testing you about other things in the question.
 
John Longer
Greenhorn
Posts: 16
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see, but at the same time you can't assume that keys (in this case it is primary key) are not in order (although most likely they are).
Question is ambiguous.
 
Jeanne Boyarsky
author & internet detective
Posts: 41878
909
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
Maybe. However, if an exam question is ambiguous on the real exam, you can't make any assumptions there either.

Again, I'd like to point out that key uniqueness is not on the exam. We cover it because a reader who doesn't know JDBC will run into it when practicing.
 
John Longer
Greenhorn
Posts: 16
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand your point.
Thank you.
 
Paper beats rock. Scissors beats tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic