Re: About Question enthuware.ocpjp.v11.-2-.3630 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
treilhes
Posts: 1
Joined: Tue Apr 13, 2021 3:52 am
Contact:

Re: About Question enthuware.ocpjp.v11.-2-.3630 :

Post by treilhes »

Hello, i'm pretty disapointed by this question

One of the expected right answer is : Three SQL statements are executed.

But the table schema is :

Code: Select all

ID(int)  NAME(varchar)   SUBJECT(varchar)
And the update statement query is:

Code: Select all

PreparedStatement insertPS = c.prepareStatement("insert into SUBJECT (NAME, TEACHERID) VALUES (?, ?)");
This query use a wrong column name (TEACHERID != ID) so an sqlexception will be thrown on the first update preventing the execution of the third.
AM i right on this or am i missing something?

As a side note, the code used to prevent SPAM during the registration process does not make sense

Code: Select all

To help us prevent SPAM, tell us what will this code print?: int 1 = 10; System.out.println("hello"+i);:
You can't declare a avariable named "1" and "i" is unknown. Just a typo but a disturbing one during the registration process

admin
Site Admin
Posts: 10383
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v11.2.3630 :

Post by admin »

You are right. The column name in the query is incorrect.
Fixed.
thank you for your feedback!

PS. Fixe the question spam settings as well.

Monteragi
Posts: 4
Joined: Sun Apr 25, 2021 1:03 pm
Contact:

Re: About Question enthuware.ocpjp.v11.2.3630 :

Post by Monteragi »

java.png
java.png (42.78 KiB) Viewed 5317 times


I think there is problem with question.

We have only TEACHER table ("given" section)

But second prepared statement try to insert into "SUBJECT" table. But we don't have such table so SQLException should be thrown on this statement execution.

So technically only 2 SQL statement are executed. (the second execution leads to error from data base side).

Please correct me if I'm wrong.

admin
Site Admin
Posts: 10383
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v11.2.3630 :

Post by admin »

Since none of the option is about an error due to lack of SUBJECT table, you may safely assume that such a table exists.
The problem statement has now been updated to make it clear nevertheless.
thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests