2

I was taking a practice test for Microsoft Certification 70-461 and wanted to confirm if what I saw was an error (this is from the official Microsoft Press book, Ninth printing. I did not see this on existing errata).

Question:

You are adding tables to the Hovercraft database. You create a table by using the following statement:

  Create Table Hovercraft.Testing
  ( TestIdentifier uniqueidentifier
  DEFAULT NEWSEQUENTIALID() PRIMARY KEY,
  HullId tinyint NOT NULL,
  TestDate date NOT NULL,
  Registration nvarchar(8) NOT NULL,
  Notes nvarchar(max)
  )

Which of the following statements can you use to insert data into this table? (Each correct answer presents a complete solution. Choose two.)

The choices are:

  1. INSERT INTO Hovercraft.Testing (Notes, HullID, TestDate, Registration,) VALUES (N'Hovercraft requires maintenance.', 142, '20120715', N'AAA320')

  2. INSERT INTO Hovercraft.Testing (HullID, TestDate, Registration, Notes) VALUES (124, '20120722', N'AAA321', N'Hovercraft in good condition. Next service in six months' time')

  3. INSERT INTO Hovercraft.Testing (HullID, TestDate, Registration, Notes) VALUES (247, '20120722', N'ABCD54321', N'Hovercraft in good condition. Next service in three months' time')

  4. INSERT INTO Hovercraft.Testing (Notes, HullID, TestDate, Registration,) VALUES (N'Hovercraft requires maintenance.', 842, '20120709', N'AAB121')

The answer key claims the first two are correct. However, shouldn't the additional apostrophe in the word "months" cause an error in the statement?

I apologize in advance if this isn't the right forum to confirm this.

6

You are correct, the second would fail due to the extra quote. This may be just a misprint caused by an over-aggressive grammar checker, or indeed it could be an apostrophe rather than a quote, and the font delineation is difficult to determine.

  • The first one will succeed.
  • The second one would fail due to the single quote (if it's a quote)
  • The third one would fail due to registration being longer than 8 characters (and the quote, if it's a quote)
  • The fourth one would fail as the HullId is out of range for a tinyint

Side note: why they would put a Hovercraft schema in the Hovercraft database is beyond me, and a great example of nonsensical design.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.